WoopsiUI::CycleButton Class Reference

#include <cyclebutton.h>

Inheritance diagram for WoopsiUI::CycleButton:
WoopsiUI::Button WoopsiUI::ListDataEventHandler WoopsiUI::Label WoopsiUI::Gadget

List of all members.

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 ListDataItemgetSelectedOption () const
const u32 getValue () const
virtual const ListDataItemgetOption (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

Detailed Description

Cycle button gadget. Displays text within the button. Clicking it cycles through its available options.


Constructor & Destructor Documentation

WoopsiUI::CycleButton::CycleButton ( s16  x,
s16  y,
u16  width,
u16  height,
GadgetStyle style = NULL 
)

Constructor for cycle buttons.

Parameters:
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.


Member Function Documentation

void WoopsiUI::CycleButton::addOption ( const WoopsiString text,
const u32  value 
)

Add a new option to the gadget.

Parameters:
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.

Parameters:
port The GraphicsPort to draw to.
See also:
redraw()

Reimplemented from WoopsiUI::Button.

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.

Parameters:
port The GraphicsPort to draw to.
See also:
redraw()

Reimplemented from WoopsiUI::Button.

virtual void WoopsiUI::CycleButton::drawOutline ( GraphicsPort port  )  [protected, virtual]

Draws the outline of the button.

Parameters:
port Graphics port to draw to.

Reimplemented from WoopsiUI::Button.

virtual const ListDataItem* WoopsiUI::CycleButton::getOption ( const s32  index  )  [inline, virtual]

Get the specified option.

Returns:
The specified option.
virtual const s32 WoopsiUI::CycleButton::getOptionCount (  )  const [inline, virtual]

Get the total number of options.

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

Parameters:
rect Reference to a rect to populate with data.

Reimplemented from WoopsiUI::Label.

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.

Returns:
The selected index.
virtual const ListDataItem* WoopsiUI::CycleButton::getSelectedOption (  )  const [virtual]

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

Returns:
The selected option.
const u32 WoopsiUI::CycleButton::getValue (  )  const [inline]

Get the value of the current option.

Returns:
Value of the current option.
virtual void WoopsiUI::CycleButton::handleListDataChangedEvent ( const ListDataEventArgs e  )  [virtual]

Handles list data changed events.

Parameters:
e Event arguments.

Implements WoopsiUI::ListDataEventHandler.

virtual void WoopsiUI::CycleButton::handleListDataSelectionChangedEvent ( const ListDataEventArgs e  )  [virtual]

Handles list selection changed events.

Parameters:
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 redraws the button.

Parameters:
x The x co-ordinate of the stylus.
y The y co-ordinate of the stylus.

Reimplemented from WoopsiUI::Button.

virtual void WoopsiUI::CycleButton::onReleaseOutside ( s16  x,
s16  y 
) [protected, virtual]

Redraws the button.

Parameters:
x The x co-ordinate of the stylus.
y The y co-ordinate of the stylus.

Reimplemented from WoopsiUI::Button.

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.

Parameters:
width The new width.
height The new height.

Reimplemented from WoopsiUI::Label.

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.

Parameters:
index The index of the option to remove.
virtual void WoopsiUI::CycleButton::selectOption ( const s32  index  )  [virtual]

Select an option by its index. Redraws the gadget and raises a value changed event.

Parameters:
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. Redraws the gadget and raises a value changed event.

Parameters:
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.

Parameters:
sortInsertedItems True to enable sort on insertion.
virtual void WoopsiUI::CycleButton::sort (  )  [virtual]

Sort the options alphabetically by the text of the options.


Member Data Documentation

Option storage.


The documentation for this class was generated from the following file:
Generated by  doxygen 1.6.3