Woopsi 1.0
GUI Framework for Nintendo DS Homebrew
|
#include <requester.h>
Public Member Functions | |
Requester (s16 x, s16 y, u16 width, u16 height, const WoopsiString &title, GadgetStyle *style=NULL) | |
virtual void | handleReleaseEvent (const GadgetEventArgs &e) |
virtual void | handleDoubleClickEvent (const GadgetEventArgs &e) |
virtual void | addOption (const WoopsiString &text, const u32 value) |
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 const s32 | getSelectedIndex () const |
virtual const ListBoxDataItem * | getSelectedOption () const |
virtual void | setAllowMultipleSelections (const bool allowMultipleSelections) |
virtual const ListBoxDataItem * | getOption (const s32 index) const |
virtual void | sort () |
virtual const s32 | getOptionCount () const |
Protected Member Functions | |
virtual void | onResize (u16 width, u16 height) |
virtual | ~Requester () |
Requester (const Requester &requester) | |
Protected Attributes | |
Button * | _okButton |
Button * | _cancelButton |
ScrollingListBox * | _listbox |
Class providing a window containing a listbox, an OK button and a Cancel button. Designed to allow users to make a selection from a number of options. When an option is selected the requester will automatically close. To read the value of the selected option or options, you should listen for the value changed event. This will fire when the user double-clicks an option or clicks the OK button.
WoopsiUI::Requester::Requester | ( | s16 | x, |
s16 | y, | ||
u16 | width, | ||
u16 | height, | ||
const WoopsiString & | title, | ||
GadgetStyle * | style = NULL |
||
) |
Constructor.
x | The x co-ordinate of the window. |
y | The y co-ordinate of the window. |
width | The width of the window. |
height | The height of the window. |
title | The title of the window. |
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::Requester::~Requester | ( | ) | [inline, protected, virtual] |
Destructor.
WoopsiUI::Requester::Requester | ( | const Requester & | requester | ) | [inline, protected] |
Copy constructor is protected to prevent usage.
virtual void WoopsiUI::Requester::addOption | ( | const WoopsiString & | text, |
const u32 | value | ||
) | [inline, virtual] |
Add a new option to the gadget using default colours.
text | Text to show in the option. |
value | The value of the option. |
virtual void WoopsiUI::Requester::addOption | ( | const WoopsiString & | text, |
const u32 | value, | ||
const u16 | normalTextColour, | ||
const u16 | normalBackColour, | ||
const u16 | selectedTextColour, | ||
const u16 | selectedBackColour | ||
) | [inline, 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. |
virtual const ListBoxDataItem* WoopsiUI::Requester::getOption | ( | const s32 | index | ) | const [inline, virtual] |
Get the selected index. Returns -1 if nothing is selected.
virtual const s32 WoopsiUI::Requester::getOptionCount | ( | ) | const [inline, virtual] |
Get the total number of options.
virtual const s32 WoopsiUI::Requester::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.
virtual const ListBoxDataItem* WoopsiUI::Requester::getSelectedOption | ( | ) | const [inline, virtual] |
Get the selected option. Returns NULL if nothing is selected.
virtual void WoopsiUI::Requester::handleDoubleClickEvent | ( | const GadgetEventArgs & | e | ) | [virtual] |
Handles events raised by its sub-gadgets.
e | Event arguments. |
Reimplemented from WoopsiUI::GadgetEventHandler.
virtual void WoopsiUI::Requester::handleReleaseEvent | ( | const GadgetEventArgs & | e | ) | [virtual] |
Handles events raised by its sub-gadgets.
e | Event arguments. |
Reimplemented from WoopsiUI::AmigaWindow.
virtual void WoopsiUI::Requester::onResize | ( | u16 | width, |
u16 | height | ||
) | [protected, virtual] |
Resize the requester to the new dimensions.
width | The new width. |
height | The new height. |
Reimplemented from WoopsiUI::AmigaWindow.
virtual void WoopsiUI::Requester::removeAllOptions | ( | ) | [inline, virtual] |
Remove all options from the gadget.
virtual void WoopsiUI::Requester::removeOption | ( | const s32 | index | ) | [inline, virtual] |
Remove an option from the gadget by its index.
index | The index of the option to remove. |
virtual void WoopsiUI::Requester::setAllowMultipleSelections | ( | const bool | allowMultipleSelections | ) | [inline, virtual] |
Sets whether multiple selections are possible or not.
allowMultipleSelections | True to allow multiple selections. |
virtual void WoopsiUI::Requester::sort | ( | ) | [inline, virtual] |
Sort the options alphabetically by the text of the options.
Button* WoopsiUI::Requester::_cancelButton [protected] |
Pointer to the cancel button.
ScrollingListBox* WoopsiUI::Requester::_listbox [protected] |
Pointer to the list box.
Button* WoopsiUI::Requester::_okButton [protected] |
Pointer to the OK button.