# 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 char *title, FontBase *font=NULL)
virtual void | handleReleaseEvent (const GadgetEventArgs &e)
virtual void | handleDoubleClickEvent (const GadgetEventArgs &e)
virtual void | addOption (const char *text, const u32 value)
virtual void | addOption (const char *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 ListData::ListDataItem * | getSelectedOption () const
virtual void | setAllowMultipleSelections (const bool allowMultipleSelections)
virtual const ListData::ListDataItem * | getOption (const s32 index) const
virtual void | sort ()
virtual const s32 | getOptionCount () const
virtual bool | resize (u16 width, u16 height)
## Protected Member Functions
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

Requester::Requester | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | const char * | title,
|  | FontBase * | font = `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.
  | font | Optional font to use for text output.

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 char * | 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. 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.

virtual void WoopsiUI::Requester::addOption | ( | const char * | text,
|  | const u32 | value |
| ) |  |  | `[inline, 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 ListData::ListDataItem* 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 ListData::ListDataItem* WoopsiUI::Requester::getSelectedOption | ( |  | ) | const`[inline, virtual]`

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

Returns:
  The selected option.

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

Handles events raised by its sub-gadgets.

Parameters:

  | e | Event arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

void 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::removeAllOptions | ( |  | ) | `[inline, virtual]`

Remove all options from the gadget. Does not redraw the gadget.

virtual void WoopsiUI::Requester::removeOption | ( | const s32 | index | ) | `[inline, virtual]`

Remove an option from the gadget by its index. Does not redraw the gadget.

Parameters:

  | index | The index of the option to remove.

bool Requester::resize | ( | u16 | width,
|  | u16 | height |
| ) |  |  | `[virtual]`

Resize the textbox to the new dimensions.

Parameters:

  | width | The new width.
  | height | The new height.

Returns:
  True if the resize was successful.

Reimplemented from WoopsiUI::AmigaWindow.

virtual void WoopsiUI::Requester::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.

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 files:

- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.39/Woopsi/woopsi/requester.h
- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.39/Woopsi/woopsi/requester.cpp

All Classes Functions Variables Enumerations Enumerator