# WoopsiUI::ListBoxBase Class Reference

`#include <listboxbase.h>`

Inheritance diagram for WoopsiUI::ListBoxBase:

List of all members.

## Public Member Functions
virtual void | addOption (const WoopsiString &text, const u32 value)=0
virtual void | addOption (ListBoxDataItem *option)=0
virtual void | removeOption (const s32 index)=0
virtual void | removeAllOptions ()=0
virtual void | addOption (const WoopsiString &text, const u32 value, const u16 normalTextColour, const u16 normalBackColour, const u16 selectedTextColour, const u16 selectedBackColour)=0
virtual void | selectOption (const s32 index)=0
virtual void | deselectOption (const s32 index)=0
virtual void | selectAllOptions ()=0
virtual void | deselectAllOptions ()=0
virtual const s32 | getSelectedIndex () const =0
virtual void | setSelectedIndex (const s32 index)=0
virtual const ListBoxDataItem * | getSelectedOption () const =0
virtual void | setAllowMultipleSelections (const bool allowMultipleSelections)=0
virtual const bool | allowsMultipleSelections () const =0
virtual const ListBoxDataItem * | getOption (const s32 index)=0
virtual void | sort ()=0
virtual const s32 | getOptionCount () const =0
virtual const u16 | getOptionHeight () const =0
virtual void | setSortInsertedItems (const bool sortInsertedItems)=0

## Detailed Description

Defines the interface for ListBox classes.

## Member Function Documentation

virtual void WoopsiUI::ListBoxBase::addOption | ( | const WoopsiString & | text,
|  | const u32 | value,
|  | const u16 | normalTextColour,
|  | const u16 | normalBackColour,
|  | const u16 | selectedTextColour,
|  | const u16 | selectedBackColour |
| ) |  |  | `[pure virtual]`

Add a new option to the gadget.

Parameters:

  | text | Text to show in the option.
  | value | The value of the option.
  | normalTextColour | Colour to draw the text with when not selected.
  | normalBackColour | Colour to draw the background with when not selected.
  | selectedTextColour | Colour to draw the text with when selected.
  | selectedBackColour | Colour to draw the background with when selected.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual void WoopsiUI::ListBoxBase::addOption | ( | ListBoxDataItem * | option | ) | `[pure virtual]`

Add an option to the gadget.

Parameters:

  | option | The option to add.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual void WoopsiUI::ListBoxBase::addOption | ( | const WoopsiString & | text,
|  | const u32 | value |
| ) |  |  | `[pure virtual]`

Add a new option to the gadget using default colours.

Parameters:

  | text | Text to show in the option.
  | value | The value of the option.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual const bool WoopsiUI::ListBoxBase::allowsMultipleSelections | ( |  | ) | const`[pure virtual]`

Sets whether multiple selections are possible or not.

Returns:
  True if multiple selections are allowed.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual void WoopsiUI::ListBoxBase::deselectAllOptions | ( |  | ) | `[pure virtual]`

Deselect all options. Redraws the gadget and raises a value changed event.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual void WoopsiUI::ListBoxBase::deselectOption | ( | const s32 | index | ) | `[pure virtual]`

Select an option by its index. Redraws the gadget and raises a value changed event.

Parameters:

  | index | The index of the option to select.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual const ListBoxDataItem* WoopsiUI::ListBoxBase::getOption | ( | const s32 | index | ) | `[pure virtual]`

Get the specified option.

Returns:
  The specified option.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual const s32 WoopsiUI::ListBoxBase::getOptionCount | ( |  | ) | const`[pure virtual]`

Get the total number of options.

Returns:
  The number of options.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual const u16 WoopsiUI::ListBoxBase::getOptionHeight | ( |  | ) | const`[pure virtual]`

Get the height of a single option.

Returns:
  The height of an option.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual const s32 WoopsiUI::ListBoxBase::getSelectedIndex | ( |  | ) | const`[pure virtual]`

Get the selected index. Returns -1 if nothing is selected. If more than one option is selected, the index of the first selected option is returned.

Returns:
  The selected index.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual const ListBoxDataItem* WoopsiUI::ListBoxBase::getSelectedOption | ( |  | ) | const`[pure virtual]`

Get the selected option. Returns NULL if nothing is selected.

Returns:
  The selected option.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual void WoopsiUI::ListBoxBase::removeAllOptions | ( |  | ) | `[pure virtual]`

Remove all options from the gadget.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual void WoopsiUI::ListBoxBase::removeOption | ( | const s32 | index | ) | `[pure virtual]`

Remove an option from the gadget by its index.

Parameters:

  | index | The index of the option to remove.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual void WoopsiUI::ListBoxBase::selectAllOptions | ( |  | ) | `[pure virtual]`

Select all options. Does nothing if the listbox does not allow multiple selections. Redraws the gadget and raises a value changed event.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual void WoopsiUI::ListBoxBase::selectOption | ( | const s32 | index | ) | `[pure virtual]`

Select an option by its index. Redraws the gadget and raises a value changed event.

Parameters:

  | index | The index of the option to select.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual void WoopsiUI::ListBoxBase::setAllowMultipleSelections | ( | const bool | allowMultipleSelections | ) | `[pure virtual]`

Sets whether multiple selections are possible or not.

Parameters:

  | allowMultipleSelections | True to allow multiple selections.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual void WoopsiUI::ListBoxBase::setSelectedIndex | ( | const s32 | index | ) | `[pure virtual]`

Sets the selected index. Specify -1 to select nothing. Resets any other selected options to deselected. Redraws the gadget and raises a value changed event.

Parameters:

  | index | The selected index.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual void WoopsiUI::ListBoxBase::setSortInsertedItems | ( | const bool | sortInsertedItems | ) | `[pure virtual]`

Sets whether or not items added to the list are automatically sorted on insert or not.

Parameters:

  | sortInsertedItems | True to enable sort on insertion.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

virtual void WoopsiUI::ListBoxBase::sort | ( |  | ) | `[pure virtual]`

Sort the options alphabetically by the text of the options.

Implemented in WoopsiUI::ListBox, and WoopsiUI::ScrollingListBox.

The documentation for this class was generated from the following file:

- listboxbase.h