Woopsi 1.3
Nintendo DS Gui Framework
Public Member Functions | Protected Member Functions | Protected Attributes
WoopsiUI::Requester Class Reference

#include <libwoopsi/include/requester.h>

Inheritance diagram for WoopsiUI::Requester:
WoopsiUI::AmigaWindow WoopsiUI::Window WoopsiUI::GadgetEventHandler WoopsiUI::Gadget

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 ListBoxDataItemgetSelectedOption () const
virtual void setAllowMultipleSelections (const bool allowMultipleSelections)
virtual const ListBoxDataItemgetOption (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:
xThe x co-ordinate of the window.
yThe y co-ordinate of the window.
widthThe width of the window.
heightThe height of the window.
titleThe title of the window.
styleThe 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:
textText to show in the option.
valueThe 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:
textText to show in the option.
valueThe value of the option.
normalTextColourColour to draw the text with when not selected.
normalBackColourColour to draw the background with when not selected.
selectedTextColourColour to draw the text with when selected.
selectedBackColourColour 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:
eEvent arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

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

Handles events raised by its sub-gadgets.

Parameters:
eEvent arguments.

Reimplemented from WoopsiUI::AmigaWindow.

virtual void WoopsiUI::Requester::onResize ( u16  width,
u16  height 
) [protected, virtual]

Resize the requester to the new dimensions.

Parameters:
widthThe new width.
heightThe 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:
indexThe 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:
allowMultipleSelectionsTrue to allow multiple selections.
virtual void WoopsiUI::Requester::sort ( ) [inline, virtual]

Sort the options alphabetically by the text of the options.


Member Data Documentation

Pointer to the cancel button.

Pointer to the list box.

Pointer to the OK button.


The documentation for this class was generated from the following file:
 All Classes Functions Variables Enumerations Enumerator