#include <uielem.h>
Inheritance diagram for VisibleList:
Public Member Functions | |
VisibleList () | |
virtual | ~VisibleList () |
Virtual destructor clears its lists. | |
virtual BOOL | Display (DialogOp &Dialog) |
Hmm.. haven't quite decided what these should do. How about: Display - show disabled Interact - show enabled Hide - remove from sight. | |
virtual BOOL | Interact (DialogOp &Dialog) |
virtual void | Hide () |
virtual BOOL | Display (ListControl &Control) |
virtual BOOL | Interact (ListControl &Control) |
virtual BOOL | InsertEntry (VisibleListItem &EntryToInsert) |
Inserts an entry into a visible list. | |
virtual BOOL | DeleteSelectedEntries () |
Deletes the selected entries in this list. | |
virtual BOOL | DeleteAllEntries () |
Deletes all the entries in this list. | |
virtual UINT32 | GetNumberOfEntries () const |
Determines how much space you would need for the whole list were you building an array. | |
virtual UINT32 | GetNumberOfSelectedEntries () const |
Determines if there's a selection. | |
virtual VisibleListItem * | GetFirstSelectedEntry () const |
Gets the VisibleListItem that's selected in this list. | |
virtual void | RemoveSelection () |
Deselects any entries in this list. | |
virtual VisibleListIterator | Begin () |
Returns an iterator so you can run through all the entries in this list. | |
virtual const VisibleListIterator & | End () const |
So you know when to stop iterating use this 'cos it marks the end of this list. | |
virtual VisibleListIterator | BeginOfEnd () |
Returns an iterator so you can back through all the entries in this list. | |
virtual VisibleListIterator | SelectionBegin () |
Returns an iterator so you can run through the selected entries in this list. | |
Protected Member Functions | |
virtual VisibleListItem & | GetEntryAt (UINT32 Index) |
Support function to get the Index'th entry in the list. | |
virtual BOOL | DeleteEntryAtIndex (UINT32 Index) |
Deletes the Index'th entry in this list. | |
List & | GetContainer () |
Support function to exposeget the VisibleList's innards. | |
Private Member Functions | |
CC_DECLARE_MEMDUMP (VisibleList) | |
Private Attributes | |
ListControl * | m_pUIElement |
List | m_Container |
Definition at line 208 of file uielem.h.
|
Definition at line 213 of file uielem.h. 00213 : m_pUIElement(NULL) {}
|
|
Virtual destructor clears its lists.
Definition at line 369 of file uielem.cpp. 00370 { 00371 DeleteAllEntries(); 00372 }
|
|
Returns an iterator so you can run through all the entries in this list.
Definition at line 765 of file uielem.cpp. 00766 { 00767 return VisibleListIterator(m_Container, (VisibleListItemPtr*)m_Container.GetHead()); 00768 }
|
|
Returns an iterator so you can back through all the entries in this list.
Definition at line 781 of file uielem.cpp. 00782 { 00783 return VisibleListIterator(m_Container, (VisibleListItemPtr*)m_Container.GetTail()); 00784 }
|
|
|
|
Deletes all the entries in this list.
Reimplemented in VisibleListWithEditableEntries, and UsedPropertiesList. Definition at line 605 of file uielem.cpp. 00606 { 00607 BOOL DeletedAllEntries = TRUE; 00608 00609 m_Container.DeleteAll(); 00610 00611 if (m_pUIElement != NULL) 00612 { 00613 DeletedAllEntries = m_pUIElement->DeleteAllItems(); 00614 } 00615 00616 return DeletedAllEntries; 00617 }
|
|
Deletes the Index'th entry in this list.
Reimplemented in UsedPropertiesList. Definition at line 557 of file uielem.cpp. 00558 { 00559 BOOL Success = TRUE; // return this 00560 00561 //#ifdef _DEBUG 00562 // String_256 ListText = m_pUIElement->GetText(pText) _R(IDC_TMLPTDLG_USED), &Success, 00563 // Index); 00564 // VisibleListItem* pItem = pEntryToDelete->GetEntry(); 00565 00566 // ASSERT(ListText == pEntryToDelete->GetText()); 00567 00568 VisibleListItemPtr* pEntryToDelete = (VisibleListItemPtr*)m_Container.FindItem(LISTPOS(Index)); 00569 Success = (pEntryToDelete != NULL); 00570 00571 if (Success) 00572 { 00573 Success = (m_Container.RemoveItem(pEntryToDelete) != NULL); 00574 } 00575 00576 if (Success) 00577 { 00578 delete pEntryToDelete; 00579 pEntryToDelete = NULL; 00580 } 00581 00582 // Remove the entry from the display if it's there 00583 if (Success && m_pUIElement != NULL) 00584 { 00585 Success = m_pUIElement->DeleteItemAtIndex(Index); 00586 } 00587 00588 00589 return Success; 00590 }
|
|
Deletes the selected entries in this list.
Reimplemented in VisibleListWithEditableEntries. Definition at line 632 of file uielem.cpp. 00633 { 00634 ENSURE_NOT_NULL(m_pUIElement); 00635 00636 // Delete the selected argument from the used list and copy it to the available list 00637 INT32* pIndexes = NULL; 00638 BOOL Success = m_pUIElement->GetSelectedIndexes(&pIndexes); 00639 00640 UINT32 ArrayIndex = 0; 00641 UINT32 EntriesDeleted = 0; 00642 while (Success && pIndexes[ArrayIndex] != -1) 00643 { 00644 const UINT32 IndexOfEntryToDelete = pIndexes[ArrayIndex] - EntriesDeleted; 00645 Success = DeleteEntryAtIndex(IndexOfEntryToDelete); 00646 00647 ++EntriesDeleted; 00648 ++ArrayIndex; 00649 } 00650 00651 if (pIndexes != NULL) 00652 { 00653 delete pIndexes; 00654 pIndexes = NULL; 00655 } 00656 00657 return Success; 00658 }
|
|
Definition at line 407 of file uielem.cpp. 00408 { 00409 m_pUIElement = &Control; 00410 Control.Disable(); 00411 // should display the entries we have and InsertEntry, etc. only update if we've 00412 // got a UIElement, but for now we'll insist on a display before InsertEntry, etc. 00413 return TRUE; 00414 }
|
|
Hmm.. haven't quite decided what these should do. How about: Display - show disabled Interact - show enabled Hide - remove from sight.
Implements UserInterface. Definition at line 391 of file uielem.cpp. 00392 { 00393 return TRUE; 00394 }
|
|
So you know when to stop iterating use this 'cos it marks the end of this list.
Definition at line 798 of file uielem.cpp. 00799 { 00800 // doesn't matter about which list it's in 00801 List list; 00802 static const VisibleListIterator TheEnd( list, NULL ); 00803 00804 return TheEnd; 00805 }
|
|
Support function to exposeget the VisibleList's innards.
Definition at line 435 of file uielem.cpp. 00436 { 00437 return m_Container; 00438 }
|
|
Support function to get the Index'th entry in the list.
Definition at line 533 of file uielem.cpp. 00534 { 00535 VisibleListItemPtr* const pEntry = (VisibleListItemPtr*)GetContainer().FindItem(LISTPOS(Index)); 00536 if (pEntry == NULL) 00537 { 00538 ERROR2RAW("NULL member"); 00539 } 00540 00541 return pEntry->GetEntry(); 00542 }
|
|
Gets the VisibleListItem that's selected in this list.
Definition at line 717 of file uielem.cpp. 00718 { 00719 VisibleListItem* pSelectedEntry = NULL; // return this 00720 00721 INT32 SelectedIndex = 0; 00722 00723 if (m_pUIElement != NULL && m_pUIElement->GetFirstSelectedIndex(&SelectedIndex)) 00724 { 00725 VisibleListItemPtr* pEntryPtr = (VisibleListItemPtr*)m_Container.FindItem(LISTPOS(SelectedIndex)); 00726 if (pEntryPtr != NULL) 00727 { 00728 pSelectedEntry = &pEntryPtr->GetEntry(); 00729 } 00730 } 00731 00732 return pSelectedEntry; 00733 }
|
|
Determines how much space you would need for the whole list were you building an array.
Definition at line 674 of file uielem.cpp. 00675 { 00676 return UINT32(m_Container.GetCount()); 00677 }
|
|
Determines if there's a selection.
Definition at line 692 of file uielem.cpp. 00693 { 00694 UINT32 NumberOfSelectedEntries = 0; 00695 00696 if (m_pUIElement != NULL) 00697 { 00698 NumberOfSelectedEntries = m_pUIElement->GetNumberOfSelectedItems(); 00699 } 00700 00701 return NumberOfSelectedEntries; 00702 }
|
|
Implements UserInterface. Definition at line 402 of file uielem.cpp.
|
|
Inserts an entry into a visible list.
Reimplemented in UsedPropertiesList. Definition at line 451 of file uielem.cpp. 00452 { 00453 BOOL Success = TRUE; // return this 00454 00455 // Find the entry to insert after & its index 00456 BOOL Found = FALSE; 00457 INT32 Index = 0; 00458 VisibleListItemPtr* pItemToInsertBefore = NULL; 00459 00460 VisibleListItemPtr* pCurrentItem = (VisibleListItemPtr*)m_Container.GetHead(); 00461 while (pCurrentItem != NULL && !Found) 00462 { 00463 if (!(EntryToInsert > pCurrentItem->GetEntry())) 00464 { 00465 pItemToInsertBefore = pCurrentItem; 00466 Found = TRUE; 00467 } 00468 else 00469 { 00470 ++Index; 00471 pCurrentItem = (VisibleListItemPtr*)m_Container.GetNext(pCurrentItem); 00472 } 00473 } 00474 00475 // Create a new pointer to the given entry and put it in the container 00476 VisibleListItemPtr* pNewItem = NULL; 00477 if (Success) 00478 { 00479 pNewItem = new VisibleListItemPtr(EntryToInsert); 00480 Success = (pNewItem != NULL); 00481 } 00482 00483 if (Success) 00484 { 00485 if (!Found) 00486 { 00487 m_Container.AddTail(pNewItem); 00488 } 00489 else 00490 { 00491 Success = (m_Container.InsertBefore(pItemToInsertBefore, pNewItem) != NULL); 00492 } 00493 } 00494 00495 // Add a text entry for the VisibleListItem in the UI Element (if it's there) 00496 if (Success && m_pUIElement != NULL) 00497 { 00498 String_64 ListText; 00499 EntryToInsert.GetText(ListText); 00500 if (!Found) 00501 { 00502 Success = m_pUIElement->AddItem(ListText); 00503 } 00504 else 00505 { 00506 Success = m_pUIElement->InsertItem(ListText, Index); 00507 } 00508 } 00509 00510 // tidy up any mess if it goes wrong 00511 if (!Success) 00512 { 00513 delete pNewItem; 00514 pNewItem = NULL; 00515 } 00516 00517 return Success; 00518 }
|
|
Definition at line 417 of file uielem.cpp.
|
|
Implements UserInterface. Definition at line 397 of file uielem.cpp. 00398 { 00399 return TRUE; 00400 }
|
|
Deselects any entries in this list.
Reimplemented in VisibleListWithEditableEntries. Definition at line 747 of file uielem.cpp. 00748 { 00749 VOID_ENSURE_NOT_NULL(m_pUIElement); 00750 00751 m_pUIElement->DeselectAll(); 00752 }
|
|
Returns an iterator so you can run through the selected entries in this list.
Definition at line 819 of file uielem.cpp. 00820 { 00821 ERROR2IF(m_pUIElement == NULL, End(), "NULL Member"); 00822 00823 INT32* pIndexes = NULL; 00824 if (m_pUIElement->GetSelectedIndexes(&pIndexes)) 00825 { 00826 return VisibleListIterator(m_Container, (VisibleListItemPtr*)m_Container.GetHead(), pIndexes); 00827 } 00828 else 00829 { 00830 return End(); 00831 } 00832 }
|
|
|
|
|