#include <scrollinglistbox.h>
Public Member Functions | |
ScrollingListBox (s16 x, s16 y, u16 width, u16 height, GadgetStyle *style=NULL) | |
virtual void | addOption (const WoopsiString &text, const u32 value) |
virtual void | addOption (ListBoxDataItem *option) |
virtual void | addOption (const WoopsiString &text, const u32 value, const u16 normalTextColour, const u16 normalBackColour, const u16 selectedTextColour, const u16 selectedBackColour) |
virtual void | removeOption (const s32 index) |
virtual void | removeAllOptions () |
virtual void | selectOption (const s32 index) |
virtual void | deselectOption (const s32 index) |
virtual void | selectAllOptions () |
virtual void | deselectAllOptions () |
virtual const s32 | getSelectedIndex () const |
virtual void | setSelectedIndex (const s32 index) |
virtual const ListBoxDataItem * | getSelectedOption () const |
virtual void | setAllowMultipleSelections (const bool allowMultipleSelections) |
virtual const bool | allowsMultipleSelections () const |
virtual void | resizeCanvas () |
virtual const ListBoxDataItem * | getOption (const s32 index) |
virtual const ListBoxDataItem * | getOption (const s32 index) const |
virtual void | sort () |
virtual const s32 | getOptionCount () const |
virtual const u16 | getOptionHeight () const |
virtual void | handleValueChangeEvent (const GadgetEventArgs &e) |
virtual void | handleActionEvent (const GadgetEventArgs &e) |
virtual void | handleScrollEvent (const GadgetEventArgs &e) |
virtual void | handleClickEvent (const GadgetEventArgs &e) |
virtual void | handleDoubleClickEvent (const GadgetEventArgs &e) |
virtual void | handleReleaseEvent (const GadgetEventArgs &e) |
virtual void | handleReleaseOutsideEvent (const GadgetEventArgs &e) |
virtual void | setFont (FontBase *font) |
virtual void | setSortInsertedItems (const bool sortInsertedItems) |
virtual void | getPreferredDimensions (Rect &rect) const |
Protected Member Functions | |
virtual void | drawContents (GraphicsPort *port) |
virtual void | onResize (u16 width, u16 height) |
virtual | ~ScrollingListBox () |
ScrollingListBox (const ScrollingListBox &scrollingListBox) | |
Protected Attributes | |
ListBox * | _listbox |
ScrollbarVertical * | _scrollbar |
u8 | _scrollbarWidth |
Gadget containing a ListBox and a vertical scrollbar. Exposed methods are more or less identical to the methods exposed by the ListBox to ensure that the two are interchangeable.
WoopsiUI::ScrollingListBox::ScrollingListBox | ( | s16 | x, | |
s16 | y, | |||
u16 | width, | |||
u16 | height, | |||
GadgetStyle * | style = NULL | |||
) |
Constructor.
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. | |
style | The style that the gadget should use. If this is not specified, the gadget will use the values stored in the global defaultGadgetStyle object. The gadget will copy the properties of the style into its own internal style object. |
virtual WoopsiUI::ScrollingListBox::~ScrollingListBox | ( | ) | [inline, protected, virtual] |
Destructor.
WoopsiUI::ScrollingListBox::ScrollingListBox | ( | const ScrollingListBox & | scrollingListBox | ) | [inline, protected] |
Copy constructor is protected to prevent usage.
virtual void WoopsiUI::ScrollingListBox::addOption | ( | const WoopsiString & | text, | |
const u32 | value, | |||
const u16 | normalTextColour, | |||
const u16 | normalBackColour, | |||
const u16 | selectedTextColour, | |||
const u16 | selectedBackColour | |||
) | [virtual] |
Add a new option to the gadget.
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. |
Implements WoopsiUI::ListBoxBase.
virtual void WoopsiUI::ScrollingListBox::addOption | ( | ListBoxDataItem * | option | ) | [virtual] |
Add an option to the gadget.
option | The option to add. |
Implements WoopsiUI::ListBoxBase.
virtual void WoopsiUI::ScrollingListBox::addOption | ( | const WoopsiString & | text, | |
const u32 | value | |||
) | [virtual] |
Add a new option to the gadget using default colours.
text | Text to show in the option. | |
value | The value of the option. |
Implements WoopsiUI::ListBoxBase.
virtual const bool WoopsiUI::ScrollingListBox::allowsMultipleSelections | ( | ) | const [inline, virtual] |
Sets whether multiple selections are possible or not.
Implements WoopsiUI::ListBoxBase.
virtual void WoopsiUI::ScrollingListBox::deselectAllOptions | ( | ) | [inline, virtual] |
Deselect all options. Redraws the gadget and raises a value changed event.
Implements WoopsiUI::ListBoxBase.
virtual void WoopsiUI::ScrollingListBox::deselectOption | ( | const s32 | index | ) | [inline, virtual] |
Select an option by its index. Does not deselect any other selected options. Redraws the gadget and raises a value changed event.
index | The index of the option to select. |
Implements WoopsiUI::ListBoxBase.
virtual void WoopsiUI::ScrollingListBox::drawContents | ( | GraphicsPort * | port | ) | [protected, virtual] |
Draw the area of this gadget that falls within the clipping region. Called by the redraw() function to draw all visible regions.
port | The GraphicsPort to draw to. |
Reimplemented from WoopsiUI::Gadget.
virtual const ListBoxDataItem* WoopsiUI::ScrollingListBox::getOption | ( | const s32 | index | ) | const [inline, virtual] |
Get the selected index. Returns -1 if nothing is selected.
virtual const ListBoxDataItem* WoopsiUI::ScrollingListBox::getOption | ( | const s32 | index | ) | [inline, virtual] |
virtual const s32 WoopsiUI::ScrollingListBox::getOptionCount | ( | ) | const [inline, virtual] |
virtual const u16 WoopsiUI::ScrollingListBox::getOptionHeight | ( | ) | const [inline, virtual] |
Get the height of a single option.
Implements WoopsiUI::ListBoxBase.
virtual void WoopsiUI::ScrollingListBox::getPreferredDimensions | ( | Rect & | rect | ) | const [virtual] |
Insert the dimensions that this gadget wants to have into the rect passed in as a parameter. All co-ordinates are relative to the gadget's parent. Value is based on the length of the largest string in the set of options.
rect | Reference to a rect to populate with data. |
Reimplemented from WoopsiUI::Gadget.
virtual const s32 WoopsiUI::ScrollingListBox::getSelectedIndex | ( | ) | const [inline, 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.
Implements WoopsiUI::ListBoxBase.
virtual const ListBoxDataItem* WoopsiUI::ScrollingListBox::getSelectedOption | ( | ) | const [inline, virtual] |
Get the selected option. Returns NULL if nothing is selected.
Implements WoopsiUI::ListBoxBase.
virtual void WoopsiUI::ScrollingListBox::handleActionEvent | ( | const GadgetEventArgs & | e | ) | [virtual] |
Handle a gadget action event.
e | The event data. |
Reimplemented from WoopsiUI::GadgetEventHandler.
virtual void WoopsiUI::ScrollingListBox::handleClickEvent | ( | const GadgetEventArgs & | e | ) | [virtual] |
Handle a stylus click event.
e | The event data. |
Reimplemented from WoopsiUI::GadgetEventHandler.
virtual void WoopsiUI::ScrollingListBox::handleDoubleClickEvent | ( | const GadgetEventArgs & | e | ) | [virtual] |
Handles events raised by its sub-gadgets.
e | Event arguments. |
Reimplemented from WoopsiUI::GadgetEventHandler.
virtual void WoopsiUI::ScrollingListBox::handleReleaseEvent | ( | const GadgetEventArgs & | e | ) | [virtual] |
Handle a stylus release event that occurred within the bounds of the source gadget.
e | The event data. |
Reimplemented from WoopsiUI::GadgetEventHandler.
virtual void WoopsiUI::ScrollingListBox::handleReleaseOutsideEvent | ( | const GadgetEventArgs & | e | ) | [virtual] |
Handle a stylus release event that occurred outside the bounds of the source gadget.
e | The event data. |
Reimplemented from WoopsiUI::GadgetEventHandler.
virtual void WoopsiUI::ScrollingListBox::handleScrollEvent | ( | const GadgetEventArgs & | e | ) | [virtual] |
Handles events raised by its sub-gadgets.
e | Event arguments. |
Reimplemented from WoopsiUI::GadgetEventHandler.
virtual void WoopsiUI::ScrollingListBox::handleValueChangeEvent | ( | const GadgetEventArgs & | e | ) | [virtual] |
Handles events raised by its sub-gadgets.
e | Event arguments. |
Reimplemented from WoopsiUI::GadgetEventHandler.
virtual void WoopsiUI::ScrollingListBox::onResize | ( | u16 | width, | |
u16 | height | |||
) | [protected, virtual] |
Resize the listbox to the new dimensions.
width | The new width. | |
height | The new height. |
Reimplemented from WoopsiUI::Gadget.
virtual void WoopsiUI::ScrollingListBox::removeAllOptions | ( | ) | [virtual] |
Remove all options from the gadget.
Implements WoopsiUI::ListBoxBase.
virtual void WoopsiUI::ScrollingListBox::removeOption | ( | const s32 | index | ) | [virtual] |
Remove an option from the gadget by its index.
index | The index of the option to remove. |
Implements WoopsiUI::ListBoxBase.
virtual void WoopsiUI::ScrollingListBox::resizeCanvas | ( | ) | [inline, virtual] |
Resize the scrolling canvas to encompass all options.
virtual void WoopsiUI::ScrollingListBox::selectAllOptions | ( | ) | [inline, virtual] |
Select all options. Does nothing if the listbox does not allow multiple selections. Redraws the gadget and raises a value changed event.
Implements WoopsiUI::ListBoxBase.
virtual void WoopsiUI::ScrollingListBox::selectOption | ( | const s32 | index | ) | [inline, virtual] |
Select an option by its index. Does not deselect any other selected options. Redraws the gadget and raises a value changed event.
index | The index of the option to select. |
Implements WoopsiUI::ListBoxBase.
virtual void WoopsiUI::ScrollingListBox::setAllowMultipleSelections | ( | const bool | allowMultipleSelections | ) | [inline, virtual] |
Sets whether multiple selections are possible or not.
allowMultipleSelections | True to allow multiple selections. |
Implements WoopsiUI::ListBoxBase.
virtual void WoopsiUI::ScrollingListBox::setFont | ( | FontBase * | font | ) | [virtual] |
Set the font used in the textbox.
font | Pointer to the new font. |
Reimplemented from WoopsiUI::Gadget.
virtual void WoopsiUI::ScrollingListBox::setSelectedIndex | ( | const s32 | index | ) | [inline, virtual] |
Sets the selected index. Specify -1 to select nothing. Resets any other selected items to deselected. Redraws the gadget and raises a value changed event.
index | The selected index. |
Implements WoopsiUI::ListBoxBase.
virtual void WoopsiUI::ScrollingListBox::setSortInsertedItems | ( | const bool | sortInsertedItems | ) | [inline, virtual] |
Sets whether or not items added to the list are automatically sorted on insert or not.
sortInsertedItems | True to enable sort on insertion. |
Implements WoopsiUI::ListBoxBase.
virtual void WoopsiUI::ScrollingListBox::sort | ( | ) | [inline, virtual] |
Sort the options alphabetically by the text of the options.
Implements WoopsiUI::ListBoxBase.
ListBox* WoopsiUI::ScrollingListBox::_listbox [protected] |
Pointer to the list box.
ScrollbarVertical* WoopsiUI::ScrollingListBox::_scrollbar [protected] |
Pointer to the scrollbar.
u8 WoopsiUI::ScrollingListBox::_scrollbarWidth [protected] |
Width of the scrollbar.