Crazy Eddie's GUI System  0.8.4
CEGUI::ItemListbox Class Reference

ItemListbox window class. More...

+ Inheritance diagram for CEGUI::ItemListbox:
+ Collaboration diagram for CEGUI::ItemListbox:

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.
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 Sizef getContentSize () const
 Returns the Size in unclipped pixels of the content attached to this ItemListbox.
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
static const String EventMultiSelectModeChanged

Protected Member Functions

ItemEntryfindSelectedItem (size_t start_index) const
 Returns a pointer to the first selected item starting the search from start_index.
bool handle_PaneChildRemoved (const EventArgs &e)
 Handler to manage items being removed from the content pane. If there is one!
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.

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_indexThe 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
ItemEntry* CEGUI::ItemListbox::getFirstSelectedItem ( size_t  start_index = 0) const

Returns a pointer to the first selected item.

Parameters:
start_indexThe 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

Returns a pointer to the last selected item.

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

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.

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.
bool CEGUI::ItemListbox::handle_PaneChildRemoved ( const EventArgs e) [protected, virtual]

Handler to manage items being removed from the content pane. If there is one!

Note:
If you override this, you should call this base class version to ensure correct behaviour is maintained.

Reimplemented from CEGUI::ItemListBase.

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

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

Parameters:
eKeyEventArgs 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.

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

Select a range of items.

Parameters:
aStart item. (inclusive)
zEnd item. (inclusive)

Member Data Documentation

Event fired when the multiselect mode of the list box is changed. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the ItemListbox whose multiselect mode has been changed.

Event fired when the list selection changes. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the ItemListbox whose current selection has been changed.

 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends