Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

TextRenderer Class Reference

#include <textrenderer.h>

Inheritance diagram for TextRenderer:

Inheritance graph
[legend]
List of all members.

Public Types

typedef list< PG_Widget * > Widgets

Public Member Functions

 TextRenderer (PG_Widget *parent, const PG_Rect &r, const std::string &text, const std::string &style="ScrollWidget")
 TextRenderer (PG_Widget *parent, const PG_Rect &r=PG_Rect::null)
void SetText (const std::string &text)
 Sets text.
void saveText (bool stripFormatting)
PG_WidgetparsingError (const ASCString &errorMessage)

Static Public Member Functions

static bool registerTagRenderer (TagRenderer *renderer)

Protected Member Functions

bool isSpace (ASCString::charT character)
bool isBreaker (ASCString::charT character)
int arrangeLine (int y, const Widgets &line, int lineHeight, int indent)
int AreaWidth ()
void layout ()
void addWidget (PG_Widget *w)
void addWidget (Widgets w)
void addSpace (int space)
void addLinebreak (int pixel, int lines)
void addIndentation (int firstLine, int furtherLines)
void addAbsPosition (int pos)
ASCString substr (const ASCString &text, ASCString::const_iterator begin, ASCString::const_iterator end)
ASCString::const_iterator token (const ASCString &text, ASCString::const_iterator start)
ASCString::const_iterator token_command (const ASCString &text, ASCString::const_iterator start)
void parse (const ASCString &text)
virtual PG_Widgetrender (const ASCString &token)
virtual Widgets eval_command (const ASCString &token)
bool eventKeyDown (const SDL_KeyboardEvent *key)
 Overridable Eventhandler for a SDL_KeyboardEvent message.
void clear ()

Classes

struct  RenderingAttribute
class  TagRenderer
struct  TextAttributes

Member Typedef Documentation

typedef list<PG_Widget*> TextRenderer::Widgets
 

Definition at line 47 of file textrenderer.h.


Constructor & Destructor Documentation

TextRenderer::TextRenderer PG_Widget parent,
const PG_Rect r,
const std::string &  text,
const std::string &  style = "ScrollWidget"
 

Definition at line 51 of file textrenderer.cpp.

References SetText(), and PG_ThemeWidget::SetTransparency().

TextRenderer::TextRenderer PG_Widget parent,
const PG_Rect r = PG_Rect::null
 

Definition at line 45 of file textrenderer.cpp.

References PG_ScrollWidget::SetLineSize(), and PG_ThemeWidget::SetTransparency().


Member Function Documentation

void TextRenderer::addAbsPosition int  pos  )  [protected]
 

Definition at line 190 of file textrenderer.cpp.

References addWidget(), PG_Rect::PG_Rect(), and PG_Widget::PG_Widget().

Referenced by eval_command().

void TextRenderer::addIndentation int  firstLine,
int  furtherLines
[protected]
 

Definition at line 177 of file textrenderer.cpp.

References addWidget(), PG_Rect::PG_Rect(), and PG_Widget::PG_Widget().

Referenced by eval_command().

void TextRenderer::addLinebreak int  pixel,
int  lines
[protected]
 

Definition at line 165 of file textrenderer.cpp.

Referenced by eval_command(), and token().

void TextRenderer::addSpace int  space  )  [protected]
 

Definition at line 159 of file textrenderer.cpp.

Referenced by token().

void TextRenderer::addWidget Widgets  w  )  [protected]
 

Definition at line 145 of file textrenderer.cpp.

References addWidget().

void TextRenderer::addWidget PG_Widget w  )  [protected]
 

Definition at line 151 of file textrenderer.cpp.

Referenced by addAbsPosition(), addIndentation(), addWidget(), token(), and token_command().

int TextRenderer::AreaWidth  )  [protected]
 

Definition at line 73 of file textrenderer.cpp.

References PG_ScrollWidget::GetListWidth(), max(), and PG_Rect::Width().

Referenced by layout().

int TextRenderer::arrangeLine int  y,
const Widgets line,
int  lineHeight,
int  indent
[protected]
 

Definition at line 58 of file textrenderer.cpp.

Referenced by layout().

void TextRenderer::clear  )  [protected]
 

Definition at line 437 of file textrenderer.cpp.

TextRenderer::Widgets TextRenderer::eval_command const ASCString token  )  [protected, virtual]
 

Definition at line 302 of file textrenderer.cpp.

References addAbsPosition(), addIndentation(), addLinebreak(), assert, Surface::getBaseSurface(), PG_Widget::GetFontColor(), IconRepository::getIcon(), PG_Rect::index, pal, parsingError(), s1, and s2.

Referenced by token_command().

bool TextRenderer::eventKeyDown const SDL_KeyboardEvent *  key  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_KeyboardEvent message.

This handler is called when a key changed it's state from unpressed to pressed. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
key SDL_KeyboardEvent message
Returns:
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

Reimplemented from PG_MessageObject.

Definition at line 470 of file textrenderer.cpp.

References PG_ScrollWidget::GetScrollPosX(), PG_ScrollWidget::GetScrollPosY(), PG_Rect::Height(), saveText(), and PG_ScrollWidget::ScrollTo().

bool TextRenderer::isBreaker ASCString::charT  character  )  [inline, protected]
 

Definition at line 64 of file textrenderer.h.

Referenced by token().

bool TextRenderer::isSpace ASCString::charT  character  )  [inline, protected]
 

Definition at line 59 of file textrenderer.h.

Referenced by parse(), token(), and token_command().

void TextRenderer::layout  )  [protected]
 

this is a hack to get the scrollbars updated

Definition at line 78 of file textrenderer.cpp.

References AreaWidth(), arrangeLine(), PG_Rect::Height(), max(), PG_Rect::PG_Rect(), and PG_Widget::PG_Widget().

void TextRenderer::parse const ASCString text  )  [protected]
 

Definition at line 259 of file textrenderer.cpp.

References PG_Widget::GetFontColor(), PG_Widget::GetFontSize(), isSpace(), token(), and token_command().

PG_Widget * TextRenderer::parsingError const ASCString errorMessage  ) 
 

Definition at line 281 of file textrenderer.cpp.

References PG_Widget::SetFontColor(), PG_Widget::SetSizeByText(), and PG_Widget::SetText().

Referenced by eval_command(), and VehicleTypeRenderer::renderWidget().

bool TextRenderer::registerTagRenderer TagRenderer renderer  )  [static]
 

Definition at line 293 of file textrenderer.cpp.

PG_Widget * TextRenderer::render const ASCString token  )  [protected, virtual]
 

Definition at line 427 of file textrenderer.cpp.

References PG_Widget::SetSizeByText(), PG_Widget::SetText(), PG_Widget::SizeWidget(), and PG_Rect::Width().

Referenced by token().

void TextRenderer::saveText bool  stripFormatting  ) 
 

Definition at line 456 of file textrenderer.cpp.

References selectFile(), tnstream::writeString(), and tnstream::writing.

Referenced by eventKeyDown(), and IngameMessageViewer::eventKeyDown().

void TextRenderer::SetText const std::string &  text  )  [virtual]
 

Sets text.

Parameters:
text Set the widget text and update widget C++ version, handles std::string

Reimplemented from PG_Widget.

Referenced by IngameMessageViewer::IngameMessageViewer(), IngameMessageViewer::SetMessage(), TextRenderer(), and ViewFormattedText::ViewFormattedText().

ASCString TextRenderer::substr const ASCString text,
ASCString::const_iterator  begin,
ASCString::const_iterator  end
[protected]
 

Definition at line 200 of file textrenderer.cpp.

Referenced by token(), and token_command().

ASCString::const_iterator TextRenderer::token const ASCString text,
ASCString::const_iterator  start
[protected]
 

Definition at line 217 of file textrenderer.cpp.

References addLinebreak(), addSpace(), addWidget(), isBreaker(), isSpace(), render(), and substr().

Referenced by parse().

ASCString::const_iterator TextRenderer::token_command const ASCString text,
ASCString::const_iterator  start
[protected]
 

Definition at line 205 of file textrenderer.cpp.

References addWidget(), eval_command(), isSpace(), and substr().

Referenced by parse().


The documentation for this class was generated from the following files:
Generated on Tue Jun 24 02:21:28 2008 for Advanced Strategic Command by  doxygen 1.4.2