#include <Label.h>
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 |
Defines a label control.
This is capable of rendering text within its border.
gameplay::Label::Label | ( | ) | [protected] |
Constructor.
virtual gameplay::Label::~Label | ( | ) | [protected, virtual] |
Destructor.
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.
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.
id | The label id. |
style | The label style (optional). |
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.
style | The control's custom style. |
properties | A properties object containing a definition of the label (optional). |
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] |
Reimplemented from gameplay::Control.
Reimplemented in gameplay::Slider, and gameplay::TextBox.
const char* gameplay::Label::getText | ( | ) |
Get 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.
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] |
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.
text | The text to display. |
void gameplay::Label::update | ( | float | elapsedTime | ) | [protected, virtual] |
void gameplay::Label::updateAbsoluteBounds | ( | const Vector2 & | offset | ) | [protected, virtual] |
Reimplemented from gameplay::Control.
Reimplemented in gameplay::RadioButton, and gameplay::CheckBox.
void gameplay::Label::updateBounds | ( | ) | [protected, virtual] |
Reimplemented from gameplay::Control.
Reimplemented in gameplay::Slider, gameplay::RadioButton, and gameplay::CheckBox.
void gameplay::Label::updateState | ( | State | state | ) | [protected, virtual] |
Reimplemented from gameplay::Control.
Reimplemented in gameplay::Slider, gameplay::TextBox, gameplay::RadioButton, and gameplay::CheckBox.
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.