#include <cyclebutton.h>
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 |
Cycle button gadget. Displays text within the button. Clicking it cycles through its available options.
CycleButton::CycleButton | ( | s16 | x, | |
s16 | y, | |||
u16 | width, | |||
u16 | height, | |||
FontBase * | font = NULL | |||
) |
Constructor for cycle buttons.
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. |
CycleButton::~CycleButton | ( | ) | [protected, virtual] |
Destructor.
WoopsiUI::CycleButton::CycleButton | ( | const CycleButton & | cycleButton | ) | [inline, protected] |
Copy constructor is protected to prevent usage.
void CycleButton::addOption | ( | const char * | text, | |
const u32 | value | |||
) |
Add a new option to the gadget.
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.
void CycleButton::draw | ( | Rect | clipRect | ) | [virtual] |
Draw the region of the textbox within the clipping rect. Should not be called directly.
clipRect | The clipping rect to limit drawing to. |
Reimplemented from WoopsiUI::Button.
void 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.
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.
bool CycleButton::release | ( | s16 | x, | |
s16 | y | |||
) | [virtual] |
Release this gadget at the supplied co-ordinates.
x | X co-ordinate of the release. | |
y | Y co-ordinate of the release. |
Reimplemented from WoopsiUI::Button.
WoopsiArray<CycleButtonOption*> WoopsiUI::CycleButton::_options [protected] |
Array of options.
s16 WoopsiUI::CycleButton::_selectedIndex [protected] |
Index of the currently selected option.