|  | 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::CheckBox Class Reference

`#include <CheckBox.h>`

Inheritance diagram for gameplay::CheckBox:

List of all members.

## Public Member Functions

const char * | getTypeName () const
bool | isChecked ()
void | setChecked (bool checked)
virtual void | addListener (Control::Listener *listener, int eventFlags)

## Static Public Member Functions

static CheckBox * | create (const char *id, Theme::Style *style=NULL)

## Protected Member Functions

| CheckBox ()
| ~CheckBox ()
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)

## Protected Attributes

bool | _checked
Theme::ThemeImage * | _image

## Detailed Description

Defines a checkbox control.

This is a button that can be enabled or disabled.

See also:
  http://gameplay3d.github.io/GamePlay/docs/file-formats.html#wiki-UI_Forms

## Constructor & Destructor Documentation

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

Constructor.

gameplay::CheckBox::~CheckBox | ( |  | ) | `[protected]`

Destructor.

## Member Function Documentation

virtual void gameplay::CheckBox::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.

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

See also:
  Control::controlEvent

Reimplemented from gameplay::Control.

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

Creates a new CheckBox.

Parameters:

  id | The checkbox ID.
  style | The checkbox style (optional).

Returns:
  The new checkbox.

Reimplemented from gameplay::Button.

static Control* gameplay::CheckBox::create | ( | Theme::Style * | style,
|  | Properties * | properties = `NULL`
| ) |  | `[static, protected]`

Create a checkbox with a given style and properties.

Parameters:

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

Returns:
  The new checkbox.

Reimplemented from gameplay::Button.

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

See also:
  Control::drawImages

Reimplemented from gameplay::Control.

const char* gameplay::CheckBox::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: "CheckBox"

See also:
  ScriptTarget::getTypeName()

Reimplemented from gameplay::Button.

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

See also:
  Control::initialize

Reimplemented from gameplay::Button.

bool gameplay::CheckBox::isChecked | ( |  | ) |

Gets whether this checkbox is checked.

Returns:
  Whether this checkbox is checked.

bool gameplay::CheckBox::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::CheckBox::setChecked | ( | bool | checked | ) |

Sets whether the checkbox is checked.

Parameters:

  checked | TRUE if the checkbox is checked; FALSE if the checkbox is not checked.

void gameplay::CheckBox::updateAbsoluteBounds | ( | const Vector2 & | offset | ) | `[protected, virtual]`

See also:
  Control::updateAbsoluteBounds

Reimplemented from gameplay::Label.

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

See also:
  Control::updateBounds

Reimplemented from gameplay::Label.

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

See also:
  Control::updateState

Reimplemented from gameplay::Label.

## Member Data Documentation

bool gameplay::CheckBox::_checked `[protected]`

Whether this checkbox is currently checked.

Theme::ThemeImage* gameplay::CheckBox::_image `[protected]`

The Theme::ThemeImage to display for the checkbox.

All Classes Functions Variables Typedefs Enumerations Enumerator