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

#include <Label.h>

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

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 Labelcreate (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 Controlcreate (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:
listenerThe listener to add.
eventFlagsThe 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:
idThe label id.
styleThe 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:
styleThe control's custom style.
propertiesA 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]
void gameplay::Label::setText ( const char *  text)

Set the text for this label to display.

Parameters:
textThe 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]
void gameplay::Label::updateState ( State  state) [protected, virtual]

Member Data Documentation

The font being used to display the label.

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

The text displayed by this label.

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

The text color being used to display the label.

 All Classes Functions Variables Typedefs Enumerations Enumerator