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

`#include <Label.h>`

Inheritance diagram for gameplay::Label:

List of all members.

## Public Member Functions

const char * | getTypeName () const
void | setText (const char *text)
const char * | getText ()
virtual void | addListener (Control::Listener *listener, int eventFlags)

## Static Public Member Functions

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

## Protected Member Functions

| Label ()
virtual | ~Label ()
void | initialize (const char *typeName, Theme::Style *style, Properties *properties)
void | update (float elapsedTime)
void | updateState (State state)
void | updateBounds ()
void | updateAbsoluteBounds (const Vector2 &offset)
virtual unsigned int | drawText (Form *form, const Rectangle &clip)

## Static Protected Member Functions

static Control * | create (Theme::Style *style, Properties *properties)

## Protected Attributes

std::string | _text
Font * | _font
Vector4 | _textColor
Rectangle | _textBounds

## Detailed Description

Defines a label control.

This is capable of rendering text within its border.

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

## Constructor & Destructor Documentation

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

Constructor.

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

Destructor.

## Member Function Documentation

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

Reimplemented in gameplay::Slider, gameplay::TextBox, gameplay::CheckBox, and gameplay::RadioButton.

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

Creates a new label.

Parameters:

  id | The label id.
  style | The label style (optional).

Returns:
  The new label.

Reimplemented in gameplay::TextBox, gameplay::RadioButton, gameplay::Slider, gameplay::Button, and gameplay::CheckBox.

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

Create a new label control.

Parameters:

  style | The control's custom style.
  properties | A properties object containing a definition of the label (optional).

Returns:
  The new label.

Reimplemented in gameplay::Slider, gameplay::TextBox, gameplay::RadioButton, gameplay::CheckBox, and gameplay::Button.

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

See also:
  Control::drawText

Reimplemented from gameplay::Control.

Reimplemented in gameplay::Slider, and gameplay::TextBox.

const char* gameplay::Label::getText | ( |  | ) |

Get the text displayed by this label.

Returns:
  The text displayed by this label.

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

See also:
  ScriptTarget::getTypeName()

Reimplemented from gameplay::Control.

Reimplemented in gameplay::Button, gameplay::TextBox, gameplay::RadioButton, gameplay::Slider, and gameplay::CheckBox.

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

See also:
  Control::initialize

Reimplemented from gameplay::Control.

Reimplemented in gameplay::Slider, gameplay::TextBox, gameplay::RadioButton, gameplay::CheckBox, and gameplay::Button.

void gameplay::Label::setText | ( | const char * | text | ) |

Set the text for this label to display.

Parameters:

  text | The text to display.

void gameplay::Label::update | ( | float | elapsedTime | ) | `[protected, virtual]`

See also:
  Control::update

Reimplemented from gameplay::Control.

Reimplemented in gameplay::Slider.

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

See also:
  Control::updateAbsoluteBounds

Reimplemented from gameplay::Control.

Reimplemented in gameplay::RadioButton, and gameplay::CheckBox.

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

See also:
  Control::updateBounds

Reimplemented from gameplay::Control.

Reimplemented in gameplay::Slider, gameplay::RadioButton, and gameplay::CheckBox.

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

See also:
  Control::updateState

Reimplemented from gameplay::Control.

Reimplemented in gameplay::Slider, gameplay::TextBox, gameplay::RadioButton, and gameplay::CheckBox.

## Member Data Documentation

Font* gameplay::Label::_font `[protected]`

The font being used to display the label.

std::string gameplay::Label::_text `[protected]`

The text displayed by this label.

Rectangle gameplay::Label::_textBounds `[protected]`

The position and size of this control's text area, before clipping. Used for text alignment.

Vector4 gameplay::Label::_textColor `[protected]`

The text color being used to display the label.

All Classes Functions Variables Typedefs Enumerations Enumerator