CEGUI::ItemListbox Class Reference

ItemListbox window class. More...

Inheritance diagram for CEGUI::ItemListbox:

Inheritance graph
[legend]
Collaboration diagram for CEGUI::ItemListbox:

Collaboration graph
[legend]

List of all members.

Public Member Functions

size_t getSelectedCount (void) const
 Returns the number of selected items in this ItemListbox.
ItemEntrygetLastSelectedItem (void) const
 Returns a pointer to the last selected item.
ItemEntrygetFirstSelectedItem (size_t start_index=0) const
 Returns a pointer to the first selected item.
ItemEntrygetNextSelectedItem (void) const
 Returns a pointer to the next seleced item relative to a previous call to getFirstSelectedItem or getNextSelectedItem.
ItemEntrygetNextSelectedItemAfter (const ItemEntry *start_item) const
 Returns a pointer to the next selected item after the item 'start_item' given.
bool isMultiSelectEnabled (void) const
 Returns 'true' if multiple selections are allowed. 'false' if not.
bool isItemSelected (size_t index) const
 Returns 'true' if the item at the given index is selectable and currently selected.
virtual void initialiseComponents (void)
 Initialise the Window based object ready for use.
void setMultiSelectEnabled (bool state)
 Set whether or not multiple selections should be allowed.
void clearAllSelections (void)
 Clears all selections.
void selectRange (size_t a, size_t z)
 Select a range of items.
void selectAllItems (void)
 Select all items. Does nothing if multiselect is disabled.
 ItemListbox (const String &type, const String &name)
 Constructor for the ItemListbox base class constructor.
virtual ~ItemListbox (void)
 Destructor for the ItemListbox base class.
virtual void layoutItemWidgets ()
 Setup size and position for the item widgets attached to this ItemListbox.
virtual Size getContentSize () const
 Returns the Size in unclipped pixels of the content attached to this ItemListbox.
virtual bool testClassName_impl (const String &class_name) const
 Return whether this window was inherited from the given class name at some point in the inheritance hierarchy.
virtual void notifyItemClicked (ItemEntry *li)
 Notify this ItemListbox that the given ListItem was just clicked. Internal function - not to be used from client code.
virtual void notifyItemSelectState (ItemEntry *li, bool state)
 Notify this ItemListbox that the given ListItem just changed selection state. Internal function - not to be used from client code.

Static Public Attributes

static const String EventNamespace
 Namespace for global events.
static const String WidgetTypeName
 Window factory name.
static const String EventSelectionChanged
 Event fired when the selection changes.
static const String EventMultiSelectModeChanged
 Event fired when the multiselect mode changes.

Protected Member Functions

ItemEntryfindSelectedItem (size_t start_index) const
 Returns a pointer to the first selected item starting the search from start_index.
virtual void onSelectionChanged (WindowEventArgs &e)
virtual void onMultiSelectModeChanged (WindowEventArgs &e)
virtual void onKeyDown (KeyEventArgs &e)
 Handler called when a key as been depressed while this window has input focus.

Protected Attributes

bool d_multiSelect
ItemEntryd_lastSelected
 Controls whether multiple items can be selected simultaneously.
size_t d_nextSelectionIndex
 The last item that was selected.

Static Protected Attributes

static
ItemListboxProperties::MultiSelect 
d_multiSelectProperty


Detailed Description

ItemListbox window class.

Member Function Documentation

ItemEntry * CEGUI::ItemListbox::findSelectedItem ( size_t  start_index  )  const [protected]

Returns a pointer to the first selected item starting the search from start_index.

Parameters:
start_index The index where the search should begin (inclusive)
Returns:
A pointer to the first selected item in the listbox found If no item is selected the return value is 0 If start_index is out of bounds the return value is 0
Note:
This function advances the internal counter and is made for getFirstSelectedItem and getNextSelectedItem

References CEGUI::ItemListBase::d_listItems, d_nextSelectionIndex, and CEGUI::ItemEntry::isSelected().

Referenced by getFirstSelectedItem(), and getNextSelectedItem().

ItemEntry * CEGUI::ItemListbox::getFirstSelectedItem ( size_t  start_index = 0  )  const

Returns a pointer to the first selected item.

Parameters:
start_index The index where the search should begin. If omitted the search will begin with the first item.
Returns:
A pointer to the first selected item in the listbox. If no item is selected the return value is 0. If start_index is out of bounds the return value is 0.
Note:
If multiselect is disabled then this does the equivalent of calling getLastSelectedItem. If multiselect is enabled it will search the array starting at start_index

References d_lastSelected, and findSelectedItem().

ItemEntry* CEGUI::ItemListbox::getLastSelectedItem ( void   )  const [inline]

Returns a pointer to the last selected item.

Returns:
A pointer to the last selected item, 0 is none.

ItemEntry * CEGUI::ItemListbox::getNextSelectedItem ( void   )  const

Returns a pointer to the next seleced item relative to a previous call to getFirstSelectedItem or getNextSelectedItem.

Returns:
A pointer to the next seleced item. If there are no further selected items the return value is 0. If multiselect is disabled the return value is 0.
Note:
This member function will take on from where the last call to getFirstSelectedItem or getNextSelectedItem returned. So be sure to start with a call to getFirstSelectedItem.
This member function should be preferred over getNextSelectedItemAfter as it will perform better, especially on large lists.

References d_nextSelectionIndex, and findSelectedItem().

ItemEntry * CEGUI::ItemListbox::getNextSelectedItemAfter ( const ItemEntry start_item  )  const

Returns a pointer to the next selected item after the item 'start_item' given.

Note:
This member function will search the array from the beginning and will be slow for large lists, it will not advance the internal counter used by getFirstSelectedItem and getNextSelectedItem either.

References CEGUI::ItemListBase::d_listItems, CEGUI::ItemListBase::getItemIndex(), and CEGUI::ItemEntry::isSelected().

void CEGUI::ItemListbox::initialiseComponents ( void   )  [virtual]

Initialise the Window based object ready for use.

Note:
This must be called for every window created. Normally this is handled automatically by the WindowFactory for each Window type.
Returns:
Nothing

Reimplemented from CEGUI::ScrolledItemListBase.

References CEGUI::ItemListBase::d_pane, CEGUI::Window::EventChildRemoved, and CEGUI::EventSet::subscribeEvent().

void CEGUI::ItemListbox::onKeyDown ( KeyEventArgs e  )  [protected, virtual]

Handler called when a key as been depressed while this window has input focus.

Parameters:
e KeyEventArgs object whose 'scancode' field is set to the Key::Scan value representing the key that was pressed, and whose 'sysKeys' field represents the combination of SystemKey that were active when the event was generated.

Reimplemented from CEGUI::Window.

References CEGUI::Control, CEGUI::System::getSingletonPtr(), CEGUI::System::getSystemKeys(), CEGUI::EventArgs::handled, CEGUI::KeyEventArgs::scancode, and selectAllItems().

void CEGUI::ItemListbox::selectRange ( size_t  a,
size_t  z 
)

Select a range of items.

Parameters:
a Start item. (inclusive)
z End item. (inclusive)

References d_lastSelected, and CEGUI::ItemListBase::d_listItems.

Referenced by notifyItemClicked().

virtual bool CEGUI::ItemListbox::testClassName_impl ( const String class_name  )  const [inline, virtual]

Return whether this window was inherited from the given class name at some point in the inheritance hierarchy.

Parameters:
class_name The class name that is to be checked.
Returns:
true if this window was inherited from class_name. false if not.

Reimplemented from CEGUI::ScrolledItemListBase.

References CEGUI::ScrolledItemListBase::testClassName_impl().


Generated on Thu Nov 27 20:34:35 2008 for Crazy Eddies GUI System by  doxygen 1.5.7.1