overview wiki api reference download
 All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
gameplay::RadioButton Class Reference

#include <RadioButton.h>

Inheritance diagram for gameplay::RadioButton:
gameplay::Button gameplay::Label gameplay::Control gameplay::Ref gameplay::AnimationTarget gameplay::ScriptTarget

List of all members.

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 RadioButtoncreate (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 Controlcreate (Theme::Style *style, Properties *properties=NULL)
static void clearSelected (const std::string &groupId)

Protected Attributes

std::string _groupId
bool _selected

Detailed Description

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.

See also:

Constructor & Destructor Documentation


virtual gameplay::RadioButton::~RadioButton ( ) [protected, virtual]


Member Function Documentation

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.

listenerThe listener to add.
eventFlagsThe 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.

groupIdThe group to clear.
See also:

Reimplemented from gameplay::Control.

static RadioButton* gameplay::RadioButton::create ( const char *  id,
Theme::Style style = NULL 
) [static]

Creates a new RadioButton.

idThe radio button ID.
styleThe radio button style (optional).
The new radio button.

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.

styleThe style to apply to this radio button.
propertiesA properties object containing a definition of the radio button (optional).
The new radio button.

Reimplemented from gameplay::Button.

unsigned int gameplay::RadioButton::drawImages ( Form form,
const Rectangle clip 
) [protected, virtual]
See also:

Reimplemented from gameplay::Control.

const char* gameplay::RadioButton::getGroupId ( ) const

Gets the RadioButton's group ID.

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.

The type name of this class: "RadioButton"
See also:

Reimplemented from gameplay::Button.

void gameplay::RadioButton::initialize ( const char *  typeName,
Theme::Style style,
Properties properties 
) [protected, virtual]
See also:

Reimplemented from gameplay::Button.

Get whether this radio button is currently selected.

Whether this radio button is currently selected.
bool gameplay::RadioButton::keyEvent ( Keyboard::KeyEvent  evt,
int  key 
) [protected, virtual]

Keyboard callback on key events.

See also:

Reimplemented from gameplay::Control.

void gameplay::RadioButton::setGroupId ( const char *  groupId)
void gameplay::RadioButton::setSelected ( bool  selected)

Sets whether this radio button is currently selected.

void gameplay::RadioButton::updateAbsoluteBounds ( const Vector2 offset) [protected, virtual]
See also:

Reimplemented from gameplay::Label.

void gameplay::RadioButton::updateBounds ( ) [protected, virtual]
See also:

Reimplemented from gameplay::Label.

void gameplay::RadioButton::updateState ( State  state) [protected, virtual]
See also:

Reimplemented from gameplay::Label.

Member Data Documentation

std::string gameplay::RadioButton::_groupId [protected]

The RadioButton's group ID.

The theme image for the radio button.

Whether the RadioButton is currently selected.

 All Classes Functions Variables Typedefs Enumerations Enumerator