Crazy Eddies GUI System: CEGUI::ItemListbox Class Reference

Crazy Eddies GUI System 0.7.6

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes
CEGUI::ItemListbox Class Reference

ItemListbox window class. More...

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

List of all members.

## Public Member Functions
size_t | getSelectedCount (void) const
| Returns the number of selected items in this ItemListbox.
ItemEntry * | getLastSelectedItem (void) const
| Returns a pointer to the last selected item.
ItemEntry * | getFirstSelectedItem (size_t start_index=0) const
| Returns a pointer to the first selected item.
ItemEntry * | getNextSelectedItem (void) const
| Returns a pointer to the next seleced item relative to a previous call to getFirstSelectedItem or getNextSelectedItem.
ItemEntry * | getNextSelectedItemAfter (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
static const String | EventMultiSelectModeChanged
## Protected Member Functions
ItemEntry * | findSelectedItem (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
ItemEntry * | d_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

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

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.

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.

virtual 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.

virtual 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.

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

Select a range of items.

Parameters:

  a | Start item. (inclusive)
  z | End item. (inclusive)

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().

## Member Data Documentation

const String CEGUI::ItemListbox::EventMultiSelectModeChanged`[static]`

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.

const String CEGUI::ItemListbox::EventSelectionChanged`[static]`

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.