|  | overview |  | wiki |  | api reference |  | download

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

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:

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 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

## 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:
  http://gameplay3d.github.io/GamePlay/docs/file-formats.html#wiki-UI_Forms

## Constructor & Destructor Documentation

gameplay::RadioButton::RadioButton | ( |  | ) | `[protected]`

Constructor.

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

Destructor.

## 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.

Parameters:

  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.

Parameters:

  groupId | The group to clear.

void gameplay::RadioButton::controlEvent | ( | Control::Listener::EventType | evt | ) | `[protected, virtual]`

See also:
  Control::controlEvent

Reimplemented from gameplay::Control.

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

Creates a new RadioButton.

Parameters:

  id | The radio button ID.
  style | The radio button style (optional).

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

Parameters:

  style | The style to apply to this radio button.
  properties | A properties object containing a definition of the radio button (optional).

Returns:
  The new radio button.

Reimplemented from gameplay::Button.

unsigned int gameplay::RadioButton::drawImages | ( | Form * | form,
|  | const Rectangle & | clip
| ) |  | `[protected, virtual]`

See also:
  Control::drawImages

Reimplemented from gameplay::Control.

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

Gets the RadioButton's group ID.

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

Returns:
  The type name of this class: "RadioButton"

See also:
  ScriptTarget::getTypeName()

Reimplemented from gameplay::Button.

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

See also:
  Control::initialize

Reimplemented from gameplay::Button.

bool gameplay::RadioButton::isSelected | ( |  | ) | const

Get whether this radio button is currently selected.

Returns:
  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:
  Keyboard::KeyEvent
  Keyboard::Key

Reimplemented from gameplay::Control.

void gameplay::RadioButton::setGroupId | ( | const char * | groupId | ) |

Parameters:

  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:
  Control::updateAbsoluteBounds

Reimplemented from gameplay::Label.

void gameplay::RadioButton::updateBounds | ( |  | ) | `[protected, virtual]`

See also:
  Control::updateBounds

Reimplemented from gameplay::Label.

void gameplay::RadioButton::updateState | ( | State | state | ) | `[protected, virtual]`

See also:
  Control::updateState

Reimplemented from gameplay::Label.

## Member Data Documentation

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.

All Classes Functions Variables Typedefs Enumerations Enumerator