#include <RadioButton.h>
Public Member Functions | |
| const char * | getTypeName () const |
| bool | isSelected () const |
| void | setSelected (bool selected) |
| virtual void | addListener (Control::Listener *listener, int eventFlags) |
| void | setGroupId (const char *groupId) |
| const char * | getGroupId () const |
Static Public Member Functions | |
| static RadioButton * | create (const char *id, Theme::Style *style=NULL) |
Protected Member Functions | |
| RadioButton () | |
| virtual | ~RadioButton () |
| void | initialize (const char *typeName, Theme::Style *style, Properties *properties) |
| bool | keyEvent (Keyboard::KeyEvent evt, int key) |
| void | controlEvent (Control::Listener::EventType evt) |
| void | updateState (State state) |
| void | updateBounds () |
| void | updateAbsoluteBounds (const Vector2 &offset) |
| unsigned int | drawImages (Form *form, const Rectangle &clip) |
Static Protected Member Functions | |
| static Control * | create (Theme::Style *style, Properties *properties=NULL) |
| static void | clearSelected (const std::string &groupId) |
Protected Attributes | |
| std::string | _groupId |
| bool | _selected |
| Theme::ThemeImage * | _image |
Defines a radio button control.
Radio buttons can be toggled between two states. A radio button can belong to a group, and only one radio button from a group can be selected at one time.
| gameplay::RadioButton::RadioButton | ( | ) | [protected] |
Constructor.
| virtual gameplay::RadioButton::~RadioButton | ( | ) | [protected, virtual] |
Destructor.
| virtual void gameplay::RadioButton::addListener | ( | Control::Listener * | listener, |
| int | eventFlags | ||
| ) | [virtual] |
Add a listener to be notified of specific events affecting this control. Event types can be OR'ed together. E.g. To listen to touch-press and touch-release events, pass Control::Listener::TOUCH | Control::Listener::RELEASE as the second parameter.
| listener | The listener to add. |
| eventFlags | The events to listen for. |
Reimplemented from gameplay::Label.
| static void gameplay::RadioButton::clearSelected | ( | const std::string & | groupId | ) | [static, protected] |
Clear the _selected flag of all radio buttons in the given group.
| groupId | The group to clear. |
| void gameplay::RadioButton::controlEvent | ( | Control::Listener::EventType | evt | ) | [protected, virtual] |
Reimplemented from gameplay::Control.
| static RadioButton* gameplay::RadioButton::create | ( | const char * | id, |
| Theme::Style * | style = NULL |
||
| ) | [static] |
Creates a new RadioButton.
| id | The radio button ID. |
| style | The radio button style (optional). |
Reimplemented from gameplay::Button.
| static Control* gameplay::RadioButton::create | ( | Theme::Style * | style, |
| Properties * | properties = NULL |
||
| ) | [static, protected] |
Create a radio button with a given style and properties.
| style | The style to apply to this radio button. |
| properties | A properties object containing a definition of the radio button (optional). |
Reimplemented from gameplay::Button.
| unsigned int gameplay::RadioButton::drawImages | ( | Form * | form, |
| const Rectangle & | clip | ||
| ) | [protected, virtual] |
Reimplemented from gameplay::Control.
| const char* gameplay::RadioButton::getGroupId | ( | ) | const |
Gets the RadioButton's group ID.
| const char* gameplay::RadioButton::getTypeName | ( | ) | const [virtual] |
Extends ScriptTarget::getTypeName() to return the type name of this class.
Child controls should override this function to return the correct type name.
Reimplemented from gameplay::Button.
| void gameplay::RadioButton::initialize | ( | const char * | typeName, |
| Theme::Style * | style, | ||
| Properties * | properties | ||
| ) | [protected, virtual] |
Reimplemented from gameplay::Button.
| bool gameplay::RadioButton::isSelected | ( | ) | const |
Get whether this radio button is currently selected.
| bool gameplay::RadioButton::keyEvent | ( | Keyboard::KeyEvent | evt, |
| int | key | ||
| ) | [protected, virtual] |
Keyboard callback on key events.
Reimplemented from gameplay::Control.
| void gameplay::RadioButton::setGroupId | ( | const char * | groupId | ) |
| groupId |
| void gameplay::RadioButton::setSelected | ( | bool | selected | ) |
Sets whether this radio button is currently selected.
| void gameplay::RadioButton::updateAbsoluteBounds | ( | const Vector2 & | offset | ) | [protected, virtual] |
Reimplemented from gameplay::Label.
| void gameplay::RadioButton::updateBounds | ( | ) | [protected, virtual] |
Reimplemented from gameplay::Label.
| void gameplay::RadioButton::updateState | ( | State | state | ) | [protected, virtual] |
Reimplemented from gameplay::Label.
std::string gameplay::RadioButton::_groupId [protected] |
The RadioButton's group ID.
Theme::ThemeImage* gameplay::RadioButton::_image [protected] |
The theme image for the radio button.
bool gameplay::RadioButton::_selected [protected] |
Whether the RadioButton is currently selected.
1.7.6.1