WoopsiUI::ListBox Class Reference
#include <listbox.h>
List of all members.
Public Member Functions |
| ListBox (s16 x, s16 y, u16 width, u16 height, FontBase *font=NULL) |
virtual void | addOption (const char *text, const u32 value) |
virtual void | removeOption (const s32 index) |
virtual void | removeAllOptions () |
virtual void | addOption (const char *text, const u32 value, const u16 normalTextColour, const u16 normalBackColour, const u16 selectedTextColour, const u16 selectedBackColour) |
virtual void | selectOption (const s32 index) |
virtual void | deselectOption (const s32 index) |
virtual void | selectAllOptions () |
virtual void | deselectAllOptions () |
virtual void | draw (Rect clipRect) |
virtual const s32 | getSelectedIndex () const |
virtual void | setSelectedIndex (const s32 index) |
virtual const
ListData::ListDataItem * | getSelectedOption () const |
virtual bool | click (s16 x, s16 y) |
virtual bool | doubleClick (s16 x, s16 y) |
virtual void | setAllowMultipleSelections (const bool allowMultipleSelections) |
virtual const bool | allowsMultipleSelections () const |
virtual void | resizeCanvas () |
virtual ListData::ListDataItem * | getOption (const s32 index) |
virtual void | sort () |
virtual const s32 | getOptionCount () const |
virtual const u16 | getOptionHeight () const |
virtual void | setSortInsertedItems (const bool sortInsertedItems) |
virtual void | handleListDataChangedEvent (const ListDataEventArgs &e) |
virtual void | handleListDataSelectionChangedEvent (const ListDataEventArgs &e) |
Protected Member Functions |
virtual | ~ListBox () |
virtual void | setOptionSelected (const s32 index, const bool selected) |
| ListBox (const ListBox &listBox) |
Protected Attributes |
ListData | _options |
u8 | _optionPadding |
Detailed Description
Class providing a scrollable list of options. The ListBox can be set up to only allow one selection or multiple selections. Processes double-clicks and raises double-click events, so that a double-click on an option can be made to automatically select and close a window/etc. The options themselves have user-definable text and background colours for their selected and unselected states.
Constructor & Destructor Documentation
ListBox::ListBox |
( |
s16 |
x, |
|
|
s16 |
y, |
|
|
u16 |
width, |
|
|
u16 |
height, |
|
|
FontBase * |
font = NULL | |
|
) |
| | |
Constructor.
- Parameters:
-
| x | The x co-ordinate of the gadget. |
| y | The y co-ordinate of the gadget. |
| width | The width of the gadget. |
| height | The height of the gadget. |
| font | The font to use with the listbox. |
ListBox::~ListBox |
( |
|
) |
[protected, virtual] |
WoopsiUI::ListBox::ListBox |
( |
const ListBox & |
listBox |
) |
[inline, protected] |
Copy constructor is protected to prevent usage.
Member Function Documentation
void ListBox::addOption |
( |
const char * |
text, |
|
|
const u32 |
value, |
|
|
const u16 |
normalTextColour, |
|
|
const u16 |
normalBackColour, |
|
|
const u16 |
selectedTextColour, |
|
|
const u16 |
selectedBackColour | |
|
) |
| | [virtual] |
Add a new option to the gadget. Does not redraw 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. |
void ListBox::addOption |
( |
const char * |
text, |
|
|
const u32 |
value | |
|
) |
| | [virtual] |
Add a new option to the gadget using default colours. Does not redraw the gadget.
- Parameters:
-
| text | Text to show in the option. |
| value | The value of the option. |
virtual const bool WoopsiUI::ListBox::allowsMultipleSelections |
( |
|
) |
const [inline, virtual] |
Sets whether multiple selections are possible or not. Does not redraw the gadget.
- Returns:
- True if multiple selections are allowed.
bool ListBox::click |
( |
s16 |
x, |
|
|
s16 |
y | |
|
) |
| | [virtual] |
Click this gadget at the supplied co-ordinates.
- Parameters:
-
| x | X co-ordinate of the click. |
| y | Y co-ordinate of the click. |
- Returns:
- True if the click was successful.
Reimplemented from WoopsiUI::Gadget.
void ListBox::deselectAllOptions |
( |
|
) |
[virtual] |
Deselect all options. Redraws the gadget and raises a value changed event.
void ListBox::deselectOption |
( |
const s32 |
index |
) |
[virtual] |
Select an option by its index. Does not deselect any other selected options. Redraws the gadget and raises a value changed event.
- Parameters:
-
| index | The index of the option to select. |
bool ListBox::doubleClick |
( |
s16 |
x, |
|
|
s16 |
y | |
|
) |
| | [virtual] |
Double-click this gadget at the supplied co-ordinates.
- Parameters:
-
| x | X co-ordinate of the click. |
| y | Y co-ordinate of the click. |
- Returns:
- True if the click was successful.
Reimplemented from WoopsiUI::Gadget.
void ListBox::draw |
( |
Rect |
clipRect |
) |
[virtual] |
Draw the region of the menu within the clipping rect.
- Parameters:
-
| clipRect | The clipping rect to limit drawing to. |
Reimplemented from WoopsiUI::ScrollingPanel.
Get the specified option.
- Returns:
- The specified option.
virtual const s32 WoopsiUI::ListBox::getOptionCount |
( |
|
) |
const [inline, virtual] |
Get the total number of options.
- Returns:
- The number of options.
const u16 ListBox::getOptionHeight |
( |
|
) |
const [virtual] |
Get the height of a single option.
- Returns:
- The height of an option.
const s32 ListBox::getSelectedIndex |
( |
|
) |
const [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.
Get the selected option. Returns NULL if nothing is selected.
- Returns:
- The selected option.
void ListBox::handleListDataSelectionChangedEvent |
( |
const ListDataEventArgs & |
e |
) |
[virtual] |
void ListBox::removeAllOptions |
( |
|
) |
[virtual] |
Remove all options from the gadget. Does not redraw the gadget.
void ListBox::removeOption |
( |
const s32 |
index |
) |
[virtual] |
Remove an option from the gadget by its index. Does not redraw the gadget.
- Parameters:
-
| index | The index of the option to remove. |
void ListBox::resizeCanvas |
( |
|
) |
[virtual] |
Resize the scrolling canvas to encompass all options. Does not redraw the gadget.
void ListBox::selectAllOptions |
( |
|
) |
[virtual] |
Select all options. Does nothing if the listbox does not allow multiple selections. Redraws the gadget and raises a value changed event.
void ListBox::selectOption |
( |
const s32 |
index |
) |
[virtual] |
Select an option by its index. Does not deselect any other selected options. Redraws the gadget and raises a value changed event.
- Parameters:
-
| index | The index of the option to select. |
virtual void WoopsiUI::ListBox::setAllowMultipleSelections |
( |
const bool |
allowMultipleSelections |
) |
[inline, virtual] |
Sets whether multiple selections are possible or not. Does not redraw the gadget.
- Parameters:
-
| allowMultipleSelections | True to allow multiple selections. |
void ListBox::setOptionSelected |
( |
const s32 |
index, |
|
|
const bool |
selected | |
|
) |
| | [protected, virtual] |
Select or deselect an option by its index. Does not deselect any other selected options. Set index to -1 to select nothing. Redraws the gadget and raises a value changed event.
- Parameters:
-
| index | The index of the option to select. |
| selected | True to select the option, false to deselect it. |
void ListBox::setSelectedIndex |
( |
const s32 |
index |
) |
[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. |
virtual void WoopsiUI::ListBox::setSortInsertedItems |
( |
const bool |
sortInsertedItems |
) |
[inline, 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. |
void ListBox::sort |
( |
|
) |
[virtual] |
Sort the options alphabetically by the text of the options.
Member Data Documentation
The documentation for this class was generated from the following files:
- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.39/Woopsi/woopsi/listbox.h
- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.39/Woopsi/woopsi/listbox.cpp