# WoopsiUI::CycleButton Class Reference

`#include <cyclebutton.h>`

Inheritance diagram for WoopsiUI::CycleButton:

List of all members.

## Classes
struct | CycleButtonOption
## Public Member Functions
| CycleButton (s16 x, s16 y, u16 width, u16 height, FontBase *font=NULL)
virtual void | draw (Rect clipRect)
void | addOption (const char *text, const u32 value)
const u32 | getValue () const
virtual bool | release (s16 x, s16 y)
virtual void | getPreferredDimensions (Rect &rect) const
## Protected Member Functions
virtual void | calculateTextPosition ()
virtual | ~CycleButton ()
| CycleButton (const CycleButton &cycleButton)
## Protected Attributes
WoopsiArray< CycleButtonOption * > | _options
s16 | _selectedIndex

## 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,
|  | FontBase * | font = `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.
  | font | The font that the button should use.

virtual WoopsiUI::CycleButton::~CycleButton | ( |  | ) | `[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 char * | 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]`

Prevent recalculation of text positions.

Reimplemented from WoopsiUI::Label.

virtual void WoopsiUI::CycleButton::draw | ( | Rect | clipRect | ) | `[virtual]`

Draw the region of the textbox within the clipping rect. Should not be called directly.

Parameters:

  | clipRect | The clipping rect to limit drawing to.

Reimplemented from WoopsiUI::Button.

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.

const u32 WoopsiUI::CycleButton::getValue | ( |  | ) | const`[inline]`

Get the value of the current option.

Returns:
  Value of the current option.

virtual bool WoopsiUI::CycleButton::release | ( | s16 | x,
|  | s16 | y |
| ) |  |  | `[virtual]`

Release this gadget at the supplied co-ordinates.

Parameters:

  | x | X co-ordinate of the release.
  | y | Y co-ordinate of the release.

Returns:
  True if the release was successful.

Reimplemented from WoopsiUI::Button.

## Member Data Documentation

WoopsiArray<CycleButtonOption*> WoopsiUI::CycleButton::_options`[protected]`

Array of options.

s16 WoopsiUI::CycleButton::_selectedIndex`[protected]`

Index of the currently selected option.

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

- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.40/Woopsi/libwoopsi/include/cyclebutton.h