Woopsi 1.0 GUI Framework for Nintendo DS Homebrew

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes

# WoopsiUI::Requester Class Reference

`#include <requester.h>`

Inheritance diagram for WoopsiUI::Requester:

List of all members.

## 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

## Detailed Description

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.

## Constructor & Destructor Documentation

WoopsiUI::Requester::Requester | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | const WoopsiString & | title,
|  | GadgetStyle * | style = `NULL`
| ) |  |

Constructor.

Parameters:

  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.

## Member Function Documentation

virtual void WoopsiUI::Requester::addOption | ( | const WoopsiString & | text,
|  | const u32 | value
| ) |  | `[inline, 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.

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.

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.

virtual const ListBoxDataItem* WoopsiUI::Requester::getOption | ( | const s32 | index | ) | const`[inline, virtual]`

Get the selected index. Returns -1 if nothing is selected.

Returns:
  The selected index.

virtual const s32 WoopsiUI::Requester::getOptionCount | ( |  | ) | const`[inline, virtual]`

Get the total number of options.

Returns:
  The 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.

Returns:
  The selected index.

virtual const ListBoxDataItem* WoopsiUI::Requester::getSelectedOption | ( |  | ) | const`[inline, virtual]`

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

Returns:
  The selected option.

virtual void WoopsiUI::Requester::handleDoubleClickEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

Handles events raised by its sub-gadgets.

Parameters:

  e | Event arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::Requester::handleReleaseEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

Handles events raised by its sub-gadgets.

Parameters:

  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.

Parameters:

  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.

Parameters:

  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.

Parameters:

  allowMultipleSelections | True to allow multiple selections.

virtual void WoopsiUI::Requester::sort | ( |  | ) | `[inline, virtual]`

Sort the options alphabetically by the text of the options.

## Member Data Documentation

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.

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

- requester.h