home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-26 | 4.3 KB | 167 lines | [TEXT/MPS ] |
- // Copyright © 1995 Apple Computer, Inc. All rights reserved.
- // Release Version: $ 1.0d11 $
-
- //========================================================================
- // --- DU Selection FW ---------------------
- #ifndef DULISTSELECTION_H
- #include "DUListSelection.h" // DU_CListSelection
- #endif
-
- #ifndef DULISTPART_H
- #include "DUListPart.h" // DU_CListPart
- #endif
-
- #ifndef DUSELECTABLE_H
- #include "DUSelectable.h" // DU_MSelectable
- #endif
-
- #ifndef DULIST_H
- #include "DUList.h" // DU_CList
- #endif
-
- // ----- Part Layer -----
- #ifndef FWPRESEN_H
- #include "FWPresen.h"
- #endif
-
- // ----- Foundation Layer -----
- #ifndef FWSUSINK_H
- #include "FWSUSink.h"
- #endif
-
- #ifndef FWSTREAM_H
- #include "FWStream.h"
- #endif
-
- //========================================================================
- #ifdef FW_BUILD_MAC
- #pragma segment talker
- #endif
-
- //========================================================================
- DU_CListSelection::DU_CListSelection(Environment* ev, DU_CListPart* thePart)
- : FW_CSelection(ev, FALSE, FALSE),
- fListPart(thePart),
- fSelectedItemList(NULL),
- fHasSelection(FALSE)
- {
- fSelectedItemList = new DU_CList;
- }
-
- //-------------------------------------------------------------------------
- DU_CListSelection::~DU_CListSelection()
- {
- delete fSelectedItemList;
- }
-
- //-------------------------------------------------------------------------
- FW_Boolean
- DU_CListSelection::DoInternalizeSelection(Environment* ev,
- ODStorageUnit* sourceSU,
- FW_CCloneInfo* cloneInfo)
- {
- FW_UNUSED(cloneInfo);
- FW_Boolean internalized = FALSE;
- return internalized;
- }
-
- //-------------------------------------------------------------------------
- void
- DU_CListSelection::CloseSelection(Environment* ev)
- {
- DU_MSelectable* item = NULL;
- while ((item = fSelectedItemList->FirstItem()) != NULL) {
- fSelectedItemList->Remove(item);
- item->Select(FALSE);
- this->GetPresentation(ev)->Invalidate(ev, item->GetBounds());
- }
- }
-
- //-------------------------------------------------------------------------
- FW_Boolean
- DU_CListSelection::ClearSelection(Environment* ev)
- {
- DU_MSelectable* item = NULL;
- while ((item = fSelectedItemList->FirstItem()) != NULL) {
- fSelectedItemList->Remove(item);
- fListPart->RemoveItem(ev, item); // Remove from part
- }
- this->GetPresentation(ev)->Invalidate(ev);
- return TRUE;
- }
-
- //-------------------------------------------------------------------------
- void
- DU_CListSelection::SelectAll(Environment* ev)
- {
- DU_CList* list = fListPart->GetItemList();
- DU_CListIterator iter(list);
- DU_MSelectable* item;
- for (item = iter.First(); iter.IsNotComplete(); item = iter.Next()) {
- this->AddItemToSelection(ev, item);
- }
- }
-
- //-------------------------------------------------------------------------
- void
- DU_CListSelection::AddItemToPart(Environment* ev, DU_MSelectable* item)
- {
- fListPart->AddItem(ev, item);
- this->CloseSelection(ev);
- this->AddItemToSelection(ev, item);
- }
-
- //-------------------------------------------------------------------------
- void
- DU_CListSelection::AddItemToSelection(Environment* ev, DU_MSelectable* item)
- {
- if ( ! item->IsSelected() ) {
- item->Select(TRUE);
- fSelectedItemList->AddLast(item);
- this->InvalidateItem(ev, item);
- }
- }
-
- //-------------------------------------------------------------------------
- void
- DU_CListSelection::RemoveItemFromPart(Environment* ev, DU_MSelectable* item)
- {
- this->RemoveItemFromSelection(ev, item);
- fListPart->RemoveItem(ev, item);
- }
-
- //-------------------------------------------------------------------------
- void
- DU_CListSelection::RemoveItemFromSelection(Environment* ev, DU_MSelectable* item)
- {
- item->Select(FALSE);
- fSelectedItemList->Remove(item);
- this->InvalidateItem(ev, item);
- }
-
- //-------------------------------------------------------------------------
- void
- DU_CListSelection::InvalidateItem(Environment* ev, DU_MSelectable* item)
- {
- this->GetPresentation(ev)->Invalidate(ev, item->GetBounds());
- }
-
- //-------------------------------------------------------------------------
- FW_Boolean
- DU_CListSelection::IsEmpty(Environment* ev) const
- {
- return (fListPart->GetNumItems() == 0);
- }
-
- //-------------------------------------------------------------------------
- void
- DU_CListSelection::DoExternalizeSelection(Environment* ev,
- ODStorageUnit* destinationSU,
- FW_CCloneInfo* cloneInfo)
- {
- FW_UNUSED(ev);
- FW_UNUSED(destinationSU);
- FW_UNUSED(cloneInfo);
- }
-
-