# CEGUI::StaticText Class Reference

Base class for a static text widget. More...

Inheritance diagram for CEGUI::StaticText:

[legend]
Collaboration diagram for CEGUI::StaticText:

[legend]
List of all members.

## Public Types

enum | HorzFormatting { LeftAligned, RightAligned, HorzCentred, HorzJustified, WordWrapLeftAligned, WordWrapRightAligned, WordWrapCentred, WordWrapJustified }
| Enumeration of horizontal formatting options for static text widgets. More...
enum | VertFormatting { TopAligned, BottomAligned, VertCentred }
| Enumeration of vertical formatting options for a static text widgets. More...

## Public Member Functions

| StaticText (const String &type, const String &name)
| Constructor for static text widgets.
virtual | ~StaticText (void)
| Destructor for static text widgets.
ColourRect | getTextColours (void) const
| Return a ColourRect object containing the colours used when rendering this widget.
HorzFormatting | getHorizontalFormatting (void) const
| Return the current horizontal formatting option set for this widget.
VertFormatting | getVerticalFormatting (void) const
| Return the current vertical formatting option set for this widget.
bool | isVerticalScrollbarEnabled (void) const
| Return whether the vertical scroll bar is set to be shown if needed.
bool | isHorizontalScrollbarEnabled (void) const
| Return whether the horizontal scroll bar is set to be shown if needed.
virtual Rect | getUnclippedInnerRect (void) const
| Return a Rect object that describes, unclipped, the inner rectangle for this window. The inner rectangle is typically an area that excludes some frame or other rendering that should not be touched by subsequent rendering.
virtual void | initialise (void)
| Initialise the Window based object ready for use.
void | setTextColours (const ColourRect &colours)
| Sets the colours to be applied when rendering the text.
void | setTextColours (const colour &top_left_colour, const colour &top_right_colour, const colour &bottom_left_colour, const colour &bottom_right_colour)
| Sets the colours to be applied when rendering the text.
void | setTextColours (const colour &col)
| Sets the colour to be applied when rendering the text.
void | setFormatting (HorzFormatting h_fmt, VertFormatting v_fmt)
| Set the formatting required for the text.
void | setVerticalFormatting (VertFormatting v_fmt)
| Set the formatting required for the text.
void | setHorizontalFormatting (HorzFormatting h_fmt)
| Set the formatting required for the text.
void | setVerticalScrollbarEnabled (bool setting)
| Set whether the vertical scroll bar will be shown if needed.
void | setHorizontalScrollbarEnabled (bool setting)
| Set whether the horizontal scroll bar will be shown if needed.

## Static Public Attributes

static const String | EventNamespace
| Namespace for global events.

## Protected Member Functions

virtual void | populateRenderCache ()
| Update the rendering cache.
virtual void | onTextChanged (WindowEventArgs &e)
| Handler called when the window's text is changed.
virtual void | onSized (WindowEventArgs &e)
| Handler called when the window's size changes.
virtual void | onFontChanged (WindowEventArgs &e)
| Handler called when the window's font is changed.
virtual void | onMouseWheel (MouseEventArgs &e)
| Handler called when the mouse wheel (z-axis) position changes within this window's area.
virtual Rect | getTextRenderArea (void) const
| Return a Rect object describing, in un-clipped pixels, the window relative area that the text should be rendered in to.
void | configureScrollbars (void)
| display required integrated scroll bars according to current state of the edit box and update their values.
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.
virtual Scrollbar * | createVertScrollbar (const String &name) const =0
| create and return a pointer to a Scrollbar widget for use as vertical scroll bar
virtual Scrollbar * | createHorzScrollbar (const String &name) const =0
| create and return a pointer to a Scrollbar widget for use as horizontal scroll bar
bool | handleScrollbarChange (const EventArgs &e)

## Protected Attributes

HorzFormatting | d_horzFormatting
| Horizontal formatting to be applied to the text.
VertFormatting | d_vertFormatting
| Vertical formatting to be applied to the text.
ColourRect | d_textCols
| Colours used when rendering the text.
Scrollbar * | d_vertScrollbar
| Widget used as vertical scrollbar;.
Scrollbar * | d_horzScrollbar
| Widget used as horizontal scrollbar;.
bool | d_enableVertScrollbar
| true if vertical scroll bar is enabled.
bool | d_enableHorzScrollbar
| true if horizontal scroll bar is enabled.

## Detailed Description

Base class for a static text widget.

## Member Enumeration Documentation

enum CEGUI::StaticText::HorzFormatting

Enumeration of horizontal formatting options for static text widgets.

Enumerator:

  LeftAligned | Text is output as a single line of text with the first character aligned with the left edge of the widget.
  RightAligned | Text is output as a single line of text with the last character aligned with the right edge of the widget.
  HorzCentred | Text is output as a single line of text horizontally centred within the widget.
  HorzJustified | Text is output as a single line of text with the first and last characters aligned with the edges of the widget.
  WordWrapLeftAligned | Text is output as multiple word-wrapped lines of text with the first character of each line aligned with the left edge of the widget.
  WordWrapRightAligned | Text is output as multiple word-wrapped lines of text with the last character of each line aligned with the right edge of the widget.
  WordWrapCentred | Text is output as multiple word-wrapped lines of text with each line horizontally centered within the widget.
  WordWrapJustified | Text is output as multiple word-wrapped lines of text with the first and last characters of each line aligned with the edges of the widget.

enum CEGUI::StaticText::VertFormatting

Enumeration of vertical formatting options for a static text widgets.

Enumerator:

  TopAligned | Text is output with the top of first line of text aligned with the top edge of the widget.
  BottomAligned | Text is output with the bottom of last line of text aligned with the bottom edge of the widget.
  VertCentred | Text is output vertically centred within the widget.

## Member Function Documentation

virtual Scrollbar* CEGUI::StaticText::createHorzScrollbar | ( | const String & | name | ) | const`[protected, pure virtual]`

create and return a pointer to a Scrollbar widget for use as horizontal scroll bar

Parameters:

  | name | String containing the name to be given to the created component.

Returns:
  Pointer to a Scrollbar to be used for scrolling horizontally.

virtual Scrollbar* CEGUI::StaticText::createVertScrollbar | ( | const String & | name | ) | const`[protected, pure virtual]`

create and return a pointer to a Scrollbar widget for use as vertical scroll bar

Parameters:

  | name | String containing the name to be given to the created component.

Returns:
  Pointer to a Scrollbar to be used for scrolling vertically.

HorzFormatting CEGUI::StaticText::getHorizontalFormatting | ( | void |  | ) | const`[inline]`

Return the current horizontal formatting option set for this widget.

Returns:
  One of the StaticText::HorzFormatting enumerated values specifying the horizontal formatting currently set.

ColourRect CEGUI::StaticText::getTextColours | ( | void |  | ) | const`[inline]`

Return a ColourRect object containing the colours used when rendering this widget.

Returns:
  ColourRect object initialised with the colours used when rendering the text for this widget.

Rect CEGUI::StaticText::getTextRenderArea | ( | void |  | ) | const`[protected, virtual]`

Return a Rect object describing, in un-clipped pixels, the window relative area that the text should be rendered in to.

Returns:
  Rect object describing the area of the Window to be used for rendering text.

Rect CEGUI::StaticText::getUnclippedInnerRect | ( | void |  | ) | const`[virtual]`

Return a Rect object that describes, unclipped, the inner rectangle for this window. The inner rectangle is typically an area that excludes some frame or other rendering that should not be touched by subsequent rendering.

Returns:
  Rect object that describes, in unclipped screen pixel co-ordinates, the window object's inner rect area.

Reimplemented from CEGUI::Static.

VertFormatting CEGUI::StaticText::getVerticalFormatting | ( | void |  | ) | const`[inline]`

Return the current vertical formatting option set for this widget.

Returns:
  One of the StaticText::VertFormatting enumerated values specifying the vertical formatting currently set.

void CEGUI::StaticText::initialise | ( | void |  | ) | `[virtual]`

Initialise the Window based object ready for use.

Note:
  This must be called for every window created. Normally this is handled automatically by the WindowFactory for each Window type.

Returns:
  Nothing

Reimplemented from CEGUI::Window.

bool CEGUI::StaticText::isHorizontalScrollbarEnabled | ( | void |  | ) | const

Return whether the horizontal scroll bar is set to be shown if needed.

Returns:
  - true if the horizontal scroll bar will be shown if needed (non-word wrapped, left or right aligned formatting only).
  - false if the horizontal scroll bar will never be shown (default behaviour).

bool CEGUI::StaticText::isVerticalScrollbarEnabled | ( | void |  | ) | const

Return whether the vertical scroll bar is set to be shown if needed.

Returns:
  - true if the vertical scroll bar will be shown if needed (top or bottom aligned formatting only).
  - false if the vertical scroll bar will never be shown (default behaviour).

void CEGUI::StaticText::onFontChanged | ( | WindowEventArgs & | e | ) | `[protected, virtual]`

Handler called when the window's font 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::StaticText::onMouseWheel | ( | MouseEventArgs & | e | ) | `[protected, virtual]`

Handler called when the mouse wheel (z-axis) position changes within this window's area.

Parameters:

  | e | MouseEventArgs object. All fields are valid.

Reimplemented from CEGUI::Window.

void CEGUI::StaticText::onSized | ( | WindowEventArgs & | e | ) | `[protected, virtual]`

Handler called when the window's size changes.

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::Static.

void CEGUI::StaticText::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::StaticText::populateRenderCache | ( |  | ) | `[protected, virtual]`

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

void CEGUI::StaticText::setFormatting | ( | HorzFormatting | h_fmt,
|  | VertFormatting | v_fmt
| ) |

Set the formatting required for the text.

Parameters:

  | h_fmt | One of the HorzFormatting enumerated values specifying the formatting required.
  | v_fmt | One of the VertFormatting enumerated values specifying the formatting required.

Returns:
  Nothing

void CEGUI::StaticText::setHorizontalFormatting | ( | HorzFormatting | h_fmt | ) |

Set the formatting required for the text.

Parameters:

  | h_fmt | One of the HorzFormatting enumerated values specifying the formatting required.

Returns:
  Nothing

void CEGUI::StaticText::setHorizontalScrollbarEnabled | ( | bool | setting | ) |

Set whether the horizontal scroll bar will be shown if needed.

Parameters:

  setting

  - true if the horizontal scroll bar should be shown if needed (non-word wrapped, left or right aligned formatting only).
  - false if the horizontal scroll bar should never be shown (default behaviour).

void CEGUI::StaticText::setTextColours | ( | const colour & | col | ) | `[inline]`

Sets the colour to be applied when rendering the text.

Parameters:

  | col | colour value to be used when rendering.

Returns:
  Nothing.

void CEGUI::StaticText::setTextColours | ( | const colour & | top_left_colour,
|  | const colour & | top_right_colour,
|  | const colour & | bottom_left_colour,
|  | const colour & | bottom_right_colour
| ) |

Sets the colours to be applied when rendering the text.

Parameters:

  | top_left_colour | Colour to be applied to the top-left corner of each text glyph rendered.
  | top_right_colour | Colour to be applied to the top-right corner of each text glyph rendered.
  | bottom_left_colour | Colour to be applied to the bottom-left corner of each text glyph rendered.
  | bottom_right_colour | Colour to be applied to the bottom-right corner of each text glyph rendered.

Returns:
  Nothing.

void CEGUI::StaticText::setTextColours | ( | const ColourRect & | colours | ) |

Sets the colours to be applied when rendering the text.

Parameters:

  | colours | ColourRect object describing the colours to be used for each text glyph rendered.

Returns:
  Nothing.

void CEGUI::StaticText::setVerticalFormatting | ( | VertFormatting | v_fmt | ) |

Set the formatting required for the text.

Parameters:

  | v_fmt | One of the VertFormatting enumerated values specifying the formatting required.

Returns:
  Nothing

void CEGUI::StaticText::setVerticalScrollbarEnabled | ( | bool | setting | ) |

Set whether the vertical scroll bar will be shown if needed.

Parameters:

  setting

  - true if the vertical scroll bar should be shown if needed (top or bottom aligned formatting only).
  - false if the vertical scroll bar should never be shown (default behaviour).

virtual bool CEGUI::StaticText::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::Static.