gui::font_string Class Reference

The GUI class used to draw text on the screen. More...

#include <gui_fontstring.hpp>

Inheritance diagram for gui::font_string:
gui::layered_region gui::region gui::uiobject

List of all members.

Public Member Functions

 font_string (manager *pManager)
 Constructor.
virtual ~font_string ()
 Destructor.
virtual std::string serialize (const std::string &sTab) const
 Prints all relevant information about this widget in a string.
virtual void render ()
 Renders this widget on the current render target.
virtual void copy_from (uiobject *pObj)
 Copies an uiobject's parameters into this font_string (inheritance).
virtual void update (float fDelta)
 updates this widget's logic.
const std::string & get_font_name () const
 Returns the name of the font file.
uint get_font_height () const
 Returns the heigh of the font.
void set_outlined (bool bIsOutlined)
 Adds or remove the outline around the text.
bool is_outlined () const
 Check if this font_string is outlined.
text::alignment get_justify_h () const
 Returns the horizontal alignment behavior.
text::vertical_alignment get_justify_v () const
 Returns the vertical alignment behavior.
const colorget_shadow_color () const
 Returns this font_string's shadow color.
std::array< int, 2 > get_shadow_offsets () const
 Returns this font_string's shadow offsets.
int get_shadow_x_offset () const
 Returns this font_string's shadow X offset.
int get_shadow_y_offset () const
 Returns this font_string's shadow Y offset.
std::array< int, 2 > get_offsets () const
 Returns this font_string's offsets.
float get_spacing () const
 Returns the space between each letter.
const colorget_text_color () const
 Returns the text color.
void set_font (const std::string &sFontName, uint uiHeight)
 Sets this font_string's font (file and size).
void set_justify_h (text::alignment mJustifyH)
 Sets this font_string's horizontal aligment behavior.
void set_justify_v (text::vertical_alignment mJustifyV)
 Sets this font_string's vertical aligment behavior.
void set_shadow_color (const color &mShadowColor)
 Sets this font_string's shadow color.
void set_shadow_offsets (int iShadowXOffset, int iShadowYOffset)
 Sets this font_string's shadow offsets.
void set_shadow_offsets (const std::array< int, 2 > &lShadowOffsets)
 Sets this font_string's shadow offsets.
void set_offsets (int iXOffset, int iYOffset)
 Sets this font_string's offsets.
void set_offsets (const std::array< int, 2 > &lOffsets)
 Sets this font_string's offsets.
void set_spacing (float fSpacing)
 Sets the space between each letter.
void set_text_color (const color &mTextColor)
 Sets the text color.
bool can_non_space_wrap () const
 Checks is large text is truncated or wrapped.
float get_string_height () const
 Returns the height of the string if not format is applied.
float get_string_width () const
 Returns the width of the string if not format is applied.
const std::string & get_text () const
 Returns the rendered text (with format tags).
const utils::ustring & get_unicode_text () const
 Returns the rendered text (with format tags, unicode character set).
void set_non_space_wrap (bool bCanNonSpaceWrap)
 Sets whether large text is truncated or wrapped.
bool has_shadow () const
 Checks if this font_string draws a shadow under its text.
void set_shadow (bool bHasShadow)
 Sets whether this font_string should draw a shadow under its text.
void set_word_wrap (bool bCanWordWrap, bool bAddEllipsis)
 Enables word wrap.
bool can_word_wrap () const
 Checks if word wrap is enabled.
void enable_formatting (bool bFormatting)
 Enables color formatting.
bool is_formatting_enabled () const
 Checks if color formatting is enabled.
void set_text (const std::string &sText)
 Sets the rendered text.
virtual void create_glue ()
 Creates the associated Lua glue.
virtual void parse_block (xml::block *pBlock)
 Parses data from an xml::block.
utils::wptr< textget_text_object ()
 Returns the text used to render this fontString.

Static Public Member Functions

static void register_glue (utils::wptr< lua::state > pLua)
 Registers this widget to the provided lua::state.

Detailed Description

The GUI class used to draw text on the screen.

This object contains formated text, managed by the text class.

Definition at line 14 of file gui_fontstring.hpp.


Constructor & Destructor Documentation

gui::font_string::font_string ( manager pManager  )  [explicit]

Constructor.

Definition at line 14 of file gui_fontstring.cpp.

gui::font_string::~font_string (  )  [virtual]

Destructor.

Definition at line 25 of file gui_fontstring.cpp.


Member Function Documentation

bool gui::font_string::can_non_space_wrap (  )  const

Checks is large text is truncated or wrapped.

Returns:
'true' if larget text is truncated
Note:
See set_non_space_wrap for more infos.

Definition at line 370 of file gui_fontstring.cpp.

bool gui::font_string::can_word_wrap (  )  const

Checks if word wrap is enabled.

Returns:
'true' if word wrap is enabled

Definition at line 436 of file gui_fontstring.cpp.

void gui::font_string::copy_from ( uiobject pObj  )  [virtual]

Copies an uiobject's parameters into this font_string (inheritance).

Parameters:
pObj The uiobject to copy

Definition at line 154 of file gui_fontstring.cpp.

void gui::font_string::create_glue (  )  [virtual]

Creates the associated Lua glue.

Reimplemented from gui::layered_region.

Definition at line 145 of file gui_fontstring.cpp.

void gui::font_string::enable_formatting ( bool  bFormatting  ) 

Enables color formatting.

Parameters:
bFormatting 'true' to enable color formatting
Note:
Enabled by default. See text::enable_formatting().

Definition at line 441 of file gui_fontstring.cpp.

uint gui::font_string::get_font_height (  )  const

Returns the heigh of the font.

Returns:
The heigh of the font

Definition at line 188 of file gui_fontstring.cpp.

const std::string & gui::font_string::get_font_name (  )  const

Returns the name of the font file.

Returns:
The name of the font file

Definition at line 183 of file gui_fontstring.cpp.

text::alignment gui::font_string::get_justify_h (  )  const

Returns the horizontal alignment behavior.

Returns:
The horizontal alignment behavior

Definition at line 207 of file gui_fontstring.cpp.

text::vertical_alignment gui::font_string::get_justify_v (  )  const

Returns the vertical alignment behavior.

Returns:
The vertical alignment behavior

Definition at line 212 of file gui_fontstring.cpp.

std::array< int, 2 > gui::font_string::get_offsets (  )  const

Returns this font_string's offsets.

Returns:
This font_string's offsets
Note:
Contains (X, Y) offsets.

Definition at line 227 of file gui_fontstring.cpp.

const color & gui::font_string::get_shadow_color (  )  const

Returns this font_string's shadow color.

Returns:
This font_string's shadow color

Definition at line 217 of file gui_fontstring.cpp.

std::array< int, 2 > gui::font_string::get_shadow_offsets (  )  const

Returns this font_string's shadow offsets.

Returns:
This font_string's shadow offsets
Note:
Contains (X, Y) offsets.

Definition at line 222 of file gui_fontstring.cpp.

int gui::font_string::get_shadow_x_offset (  )  const

Returns this font_string's shadow X offset.

Returns:
This font_string's shadow X offset

Definition at line 232 of file gui_fontstring.cpp.

int gui::font_string::get_shadow_y_offset (  )  const

Returns this font_string's shadow Y offset.

Returns:
This font_string's shadow Y offset

Definition at line 237 of file gui_fontstring.cpp.

float gui::font_string::get_spacing (  )  const

Returns the space between each letter.

Returns:
The space between each letter

Definition at line 242 of file gui_fontstring.cpp.

float gui::font_string::get_string_height (  )  const

Returns the height of the string if not format is applied.

Returns:
The height of the string if not format is applied

Definition at line 375 of file gui_fontstring.cpp.

float gui::font_string::get_string_width (  )  const

Returns the width of the string if not format is applied.

Returns:
The width of the string if not format is applied

Definition at line 383 of file gui_fontstring.cpp.

const std::string & gui::font_string::get_text (  )  const

Returns the rendered text (with format tags).

Returns:
The rendered text (with format tags)

Definition at line 391 of file gui_fontstring.cpp.

const color & gui::font_string::get_text_color (  )  const

Returns the text color.

Returns:
The text color

Definition at line 247 of file gui_fontstring.cpp.

utils::wptr< text > gui::font_string::get_text_object (  ) 

Returns the text used to render this fontString.

Returns:
The text used to render this fontString

Definition at line 466 of file gui_fontstring.cpp.

const utils::ustring & gui::font_string::get_unicode_text (  )  const

Returns the rendered text (with format tags, unicode character set).

Returns:
The rendered text (with format tags, unicode character set)

Definition at line 396 of file gui_fontstring.cpp.

bool gui::font_string::has_shadow (  )  const

Checks if this font_string draws a shadow under its text.

Returns:
'true' if this font_string draws a shadow under its text

Definition at line 414 of file gui_fontstring.cpp.

bool gui::font_string::is_formatting_enabled (  )  const

Checks if color formatting is enabled.

Returns:
'true' if color formatting is enabled

Definition at line 448 of file gui_fontstring.cpp.

bool gui::font_string::is_outlined (  )  const

Check if this font_string is outlined.

Returns:
'true' if this font_string is outlined

Definition at line 202 of file gui_fontstring.cpp.

void gui::font_string::parse_block ( xml::block *  pBlock  )  [virtual]

Parses data from an xml::block.

Parameters:
pBlock The font_string's xml::block

Reimplemented from gui::layered_region.

Definition at line 8 of file gui_fontstring_parser.cpp.

void gui::font_string::register_glue ( utils::wptr< lua::state >  pLua  )  [static]

Registers this widget to the provided lua::state.

Definition at line 10 of file gui_fontstring_glues.cpp.

void gui::font_string::render (  )  [virtual]

Renders this widget on the current render target.

Reimplemented from gui::region.

Definition at line 29 of file gui_fontstring.cpp.

std::string gui::font_string::serialize ( const std::string &  sTab  )  const [virtual]

Prints all relevant information about this widget in a string.

Parameters:
sTab The offset to give to all lines
Returns:
All relevant information about this widget

Reimplemented from gui::layered_region.

Definition at line 103 of file gui_fontstring.cpp.

void gui::font_string::set_font ( const std::string &  sFontName,
uint  uiHeight 
)

Sets this font_string's font (file and size).

Parameters:
sFontName The file path to the .ttf file
uiHeight The font height

Definition at line 252 of file gui_fontstring.cpp.

void gui::font_string::set_justify_h ( text::alignment  mJustifyH  ) 

Sets this font_string's horizontal aligment behavior.

Parameters:
mJustifyH The horizontal alignment behavior

Definition at line 270 of file gui_fontstring.cpp.

void gui::font_string::set_justify_v ( text::vertical_alignment  mJustifyV  ) 

Sets this font_string's vertical aligment behavior.

Parameters:
mJustifyV The vertical alignment behavior

Definition at line 283 of file gui_fontstring.cpp.

void gui::font_string::set_non_space_wrap ( bool  bCanNonSpaceWrap  ) 

Sets whether large text is truncated or wrapped.

Parameters:
bCanNonSpaceWrap 'true' to truncate the text
Note:
This applies to large chunks of text with no spaces. When truncated, "..." is appended at the line's end. Else, the "word" is cut and continues on the next line.

Definition at line 405 of file gui_fontstring.cpp.

void gui::font_string::set_offsets ( const std::array< int, 2 > &  lOffsets  ) 

Sets this font_string's offsets.

Parameters:
lOffsets Offsets
Note:
Contains (X, Y) offsets.

Definition at line 338 of file gui_fontstring.cpp.

void gui::font_string::set_offsets ( int  iXOffset,
int  iYOffset 
)

Sets this font_string's offsets.

Parameters:
iXOffset The horizontal offset
iYOffset The vertical offset

Definition at line 328 of file gui_fontstring.cpp.

void gui::font_string::set_outlined ( bool  bIsOutlined  ) 

Adds or remove the outline around the text.

Parameters:
bIsOutlined 'true' to enable the outline
Note:
The thickness of this outline is constant and does not depend on the font's size.

Definition at line 193 of file gui_fontstring.cpp.

void gui::font_string::set_shadow ( bool  bHasShadow  ) 

Sets whether this font_string should draw a shadow under its text.

Parameters:
bHasShadow 'true' to enable shadow

Definition at line 419 of file gui_fontstring.cpp.

void gui::font_string::set_shadow_color ( const color mShadowColor  ) 

Sets this font_string's shadow color.

Parameters:
mShadowColor The shadow color

Definition at line 296 of file gui_fontstring.cpp.

void gui::font_string::set_shadow_offsets ( const std::array< int, 2 > &  lShadowOffsets  ) 

Sets this font_string's shadow offsets.

Parameters:
lShadowOffsets Offsets
Note:
Contains (X, Y) offsets.

Definition at line 317 of file gui_fontstring.cpp.

void gui::font_string::set_shadow_offsets ( int  iShadowXOffset,
int  iShadowYOffset 
)

Sets this font_string's shadow offsets.

Parameters:
iShadowXOffset The horizontal offset
iShadowYOffset The vertical offset

Definition at line 306 of file gui_fontstring.cpp.

void gui::font_string::set_spacing ( float  fSpacing  ) 

Sets the space between each letter.

Parameters:
fSpacing The space between each letter

Definition at line 348 of file gui_fontstring.cpp.

void gui::font_string::set_text ( const std::string &  sText  ) 

Sets the rendered text.

Parameters:
sText The rendered text
Note:
See text::set_text for more infos about formatting.

Definition at line 453 of file gui_fontstring.cpp.

void gui::font_string::set_text_color ( const color mTextColor  ) 

Sets the text color.

Parameters:
mTextColor The text color

Definition at line 361 of file gui_fontstring.cpp.

void gui::font_string::set_word_wrap ( bool  bCanWordWrap,
bool  bAddEllipsis 
)

Enables word wrap.

Parameters:
bCanWordWrap 'true' to enable word wrap
bAddEllipsis 'true' to put "..." at the end of a truncated line
Note:
Enabled by default.

Definition at line 428 of file gui_fontstring.cpp.

void gui::font_string::update ( float  fDelta  )  [virtual]

updates this widget's logic.

Reimplemented from gui::uiobject.

Definition at line 87 of file gui_fontstring.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Tue Jan 1 21:58:12 2013 for gui by  doxygen 1.6.1