# CEGUI::TextItem Class Reference

Base class for all the TextItem widgets. More...

Inheritance diagram for CEGUI::TextItem:

[legend]
Collaboration diagram for CEGUI::TextItem:

[legend]
List of all members.

## Public Member Functions

TextFormatting | getTextFormatting () const
| Return the TextFormatting currently used for rendering the text.
float | getTextXOffset (void) const
| get the offset that is used to shift of the text in the x-direction this is useful if the button-images are not symmetrical and the text shouldn't be completely centered
colour | getTextColour (void) const
| Get the current text colour of the item.
void | setTextFormatting (TextFormatting format)
| Set the TextFormatting to be used when rendering the text.
void | setTextColour (const colour &col)
| Set the current text colour of the item.
void | setTextXOffset (float offset)
| Set the offset to use for a shift of the text in the x-direction this is useful if the button-images are not symmetrical and the text shouldn't be completely centered.
virtual Size | getItemPixelSize (void)
| Return the "optimal" size for the item.
| TextItem (const String &type, const String &name)
| Constructor for TextItem objects.
virtual | ~TextItem (void)
| Destructor for TextItem objects.

## Static Public Attributes

static const colour | DefaultTextColour = 0xFFFFFFFF
| Default colour used when rendering text.

## Protected Member Functions

virtual void | onTextChanged (WindowEventArgs &e)
| Handler called when the window's text is changed.
virtual void | populateRenderCache ()
| Update the rendering cache.
virtual bool | testClassName_impl (const String &class_name) const
| Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.

## Protected Attributes

colour | d_textColour
| the current text colour
TextFormatting | d_textFormatting
| the current text formatting
float | d_textXOffset
| offset applied to the x co-ordinate of the text rendered.

## Detailed Description

Base class for all the TextItem widgets.

## Member Function Documentation

Size CEGUI::TextItem::getItemPixelSize | ( | void |  | ) | `[virtual]`

Return the "optimal" size for the item.

Returns:
  Size describing the size in pixel that this TextItem's content requires for non-clipped rendering

Implements CEGUI::ItemEntry.

colour CEGUI::TextItem::getTextColour | ( | void |  | ) | const`[inline]`

Get the current text colour of the item.

Returns:
  The current text colour.

TextFormatting CEGUI::TextItem::getTextFormatting | ( |  | ) | const`[inline]`

Return the TextFormatting currently used for rendering the text.

Returns:
  TextFormatting value describing the currently used text formatting option.

float CEGUI::TextItem::getTextXOffset | ( | void |  | ) | const`[inline]`

get the offset that is used to shift of the text in the x-direction this is useful if the button-images are not symmetrical and the text shouldn't be completely centered

Returns:
  the offset in pixels

void CEGUI::TextItem::onTextChanged | ( | WindowEventArgs & | e | ) | `[protected, virtual]`

Handler called when the window's text is changed.

Parameters:

  | e | WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event. For this event the trigger window is always 'this'.

Reimplemented from CEGUI::Window.

void CEGUI::TextItem::populateRenderCache | ( |  | ) | `[protected, virtual]`

| Update the rendering cache. Populates the Window's RenderCache with imagery to be sent to the renderer. Reimplemented from CEGUI::Window.

void CEGUI::TextItem::setTextColour | ( | const colour & | col | ) | `[inline]`

Set the current text colour of the item.

Parameters:

  | col | The colour to set as the current text colour.

void CEGUI::TextItem::setTextXOffset | ( | float | offset | ) | `[inline]`

Set the offset to use for a shift of the text in the x-direction this is useful if the button-images are not symmetrical and the text shouldn't be completely centered.

Parameters:

  | offset | The offset to use - in pixels.

Returns:
  Nothing.

virtual bool CEGUI::TextItem::testClassName_impl | ( | const String & | class_name | ) | const`[inline, protected, virtual]`

Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.

Parameters:

  | class_name | The class name that is to be checked.

Returns:
  true if this window was inherited from class_name. false if not.

Reimplemented from CEGUI::ItemEntry.

Reimplemented in CEGUI::MenuItem.