Woopsi 1.0
GUI Framework for Nintendo DS Homebrew
|
#include <cyclebutton.h>
Public Member Functions | |
CycleButton (s16 x, s16 y, u16 width, u16 height, GadgetStyle *style=NULL) | |
void | addOption (const WoopsiString &text, const u32 value) |
virtual void | removeOption (const s32 index) |
virtual void | removeAllOptions () |
virtual void | selectOption (const s32 index) |
virtual const s32 | getSelectedIndex () const |
virtual void | setSelectedIndex (const s32 index) |
virtual const ListDataItem * | getSelectedOption () const |
const u32 | getValue () const |
virtual const ListDataItem * | getOption (const s32 index) |
virtual void | sort () |
virtual const s32 | getOptionCount () const |
virtual void | setSortInsertedItems (const bool sortInsertedItems) |
virtual void | handleListDataChangedEvent (const ListDataEventArgs &e) |
virtual void | handleListDataSelectionChangedEvent (const ListDataEventArgs &e) |
virtual void | getPreferredDimensions (Rect &rect) const |
Protected Member Functions | |
virtual void | drawContents (GraphicsPort *port) |
virtual void | drawBorder (GraphicsPort *port) |
virtual void | drawOutline (GraphicsPort *port) |
virtual void | onRelease (s16 x, s16 y) |
virtual void | onReleaseOutside (s16 x, s16 y) |
virtual void | onResize (u16 width, u16 height) |
virtual void | calculateTextPosition () |
virtual | ~CycleButton () |
CycleButton (const CycleButton &cycleButton) | |
Protected Attributes | |
ListData | _options |
Cycle button gadget. Displays text within the button. Clicking it cycles through its available options.
WoopsiUI::CycleButton::CycleButton | ( | s16 | x, |
s16 | y, | ||
u16 | width, | ||
u16 | height, | ||
GadgetStyle * | style = NULL |
||
) |
Constructor for cycle buttons.
x | The x co-ordinate of the button, relative to its parent. |
y | The y co-ordinate of the button, relative to its parent. |
width | The width of the button. |
height | The height of the button. |
style | The style that the button should use. If this is not specified, the button will use the values stored in the global defaultGadgetStyle object. The button will copy the properties of the style into its own internal style object. |
virtual WoopsiUI::CycleButton::~CycleButton | ( | ) | [inline, protected, virtual] |
Destructor.
WoopsiUI::CycleButton::CycleButton | ( | const CycleButton & | cycleButton | ) | [inline, protected] |
Copy constructor is protected to prevent usage.
void WoopsiUI::CycleButton::addOption | ( | const WoopsiString & | text, |
const u32 | value | ||
) |
Add a new option to the gadget.
text | The text of the option. |
value | The value of the option. |
virtual void WoopsiUI::CycleButton::calculateTextPosition | ( | ) | [inline, protected, virtual] |
Override method in Label class to prevent recalculation of text positions.
virtual void WoopsiUI::CycleButton::drawBorder | ( | 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. |
virtual void WoopsiUI::CycleButton::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. |
virtual void WoopsiUI::CycleButton::drawOutline | ( | GraphicsPort * | port | ) | [protected, virtual] |
Draws the outline of the button.
port | Graphics port to draw to. |
virtual const ListDataItem* WoopsiUI::CycleButton::getOption | ( | const s32 | index | ) | [inline, virtual] |
Get the specified option.
virtual const s32 WoopsiUI::CycleButton::getOptionCount | ( | ) | const [inline, virtual] |
Get the total number of options.
virtual void WoopsiUI::CycleButton::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. |
virtual const s32 WoopsiUI::CycleButton::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.
virtual const ListDataItem* WoopsiUI::CycleButton::getSelectedOption | ( | ) | const [virtual] |
Get the selected option. Returns NULL if nothing is selected.
const u32 WoopsiUI::CycleButton::getValue | ( | ) | const [inline] |
Get the value of the current option.
virtual void WoopsiUI::CycleButton::handleListDataChangedEvent | ( | const ListDataEventArgs & | e | ) | [virtual] |
Handles list data changed events.
e | Event arguments. |
Implements WoopsiUI::ListDataEventHandler.
virtual void WoopsiUI::CycleButton::handleListDataSelectionChangedEvent | ( | const ListDataEventArgs & | e | ) | [virtual] |
Handles list selection changed events.
e | Event arguments. |
Implements WoopsiUI::ListDataEventHandler.
virtual void WoopsiUI::CycleButton::onRelease | ( | s16 | x, |
s16 | y | ||
) | [protected, virtual] |
Selects the next option in the list and marks the button for redraw.
x | The x co-ordinate of the stylus. |
y | The y co-ordinate of the stylus. |
virtual void WoopsiUI::CycleButton::onReleaseOutside | ( | s16 | x, |
s16 | y | ||
) | [protected, virtual] |
Marks the button for redraw.
x | The x co-ordinate of the stylus. |
y | The y co-ordinate of the stylus. |
virtual void WoopsiUI::CycleButton::onResize | ( | u16 | width, |
u16 | height | ||
) | [inline, protected, virtual] |
Prevents the Button onResize() method from recalculating the text positions by overriding it.
width | The new width. |
height | The new height. |
virtual void WoopsiUI::CycleButton::removeAllOptions | ( | ) | [virtual] |
Remove all options from the gadget.
virtual void WoopsiUI::CycleButton::removeOption | ( | const s32 | index | ) | [virtual] |
Remove an option from the gadget by its index.
index | The index of the option to remove. |
virtual void WoopsiUI::CycleButton::selectOption | ( | const s32 | index | ) | [virtual] |
Select an option by its index. Raises a value changed event.
index | The index of the option to select. |
virtual void WoopsiUI::CycleButton::setSelectedIndex | ( | const s32 | index | ) | [virtual] |
Sets the selected index. Specify -1 to select nothing. Resets any other selected options to deselected. Raises a value changed event.
index | The selected index. |
virtual void WoopsiUI::CycleButton::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. |
virtual void WoopsiUI::CycleButton::sort | ( | ) | [virtual] |
Sort the options alphabetically by the text of the options.
ListData WoopsiUI::CycleButton::_options [protected] |
Option storage.