Advanced Strategic Command
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
TextRenderer Class Reference

#include <textrenderer.h>

Inheritance diagram for TextRenderer:
Inheritance graph
[legend]

Classes

class  TagRenderer
 

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)
 
virtual const PG_String & GetText ()
 
void saveText (bool stripFormatting)
 
PG_Widget * parsingError (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_Widget * render (const ASCString &token)
 
virtual Widgets eval_command (const ASCString &token)
 
bool eventKeyDown (const SDL_KeyboardEvent *key)
 
void clear ()
 

Detailed Description

Definition at line 20 of file textrenderer.h.

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().

TextRenderer::TextRenderer ( PG_Widget *  parent,
const PG_Rect &  r = PG_Rect::null 
)

Definition at line 45 of file textrenderer.cpp.

Member Function Documentation

void TextRenderer::addAbsPosition ( int  pos)
protected

Definition at line 190 of file textrenderer.cpp.

References addWidget().

Referenced by eval_command().

void TextRenderer::addIndentation ( int  firstLine,
int  furtherLines 
)
protected

Definition at line 177 of file textrenderer.cpp.

References addWidget().

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 ( PG_Widget *  w)
protected

Definition at line 151 of file textrenderer.cpp.

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

void TextRenderer::addWidget ( Widgets  w)
protected

Definition at line 145 of file textrenderer.cpp.

References addWidget().

int TextRenderer::AreaWidth ( )
protected

Definition at line 73 of file textrenderer.cpp.

References max().

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.

References BulkGraphicUpdates::release().

Referenced by SetText().

TextRenderer::Widgets TextRenderer::eval_command ( const ASCString token)
protectedvirtual
bool TextRenderer::eventKeyDown ( const SDL_KeyboardEvent *  key)
protected

Definition at line 477 of file textrenderer.cpp.

References saveText().

const PG_String & TextRenderer::GetText ( )
virtual

Definition at line 449 of file textrenderer.cpp.

Referenced by MessageDialog::SetText().

bool TextRenderer::isBreaker ( ASCString::charT  character)
inlineprotected

Definition at line 64 of file textrenderer.h.

Referenced by token().

bool TextRenderer::isSpace ( ASCString::charT  character)
inlineprotected

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(), and max().

Referenced by SetText().

void TextRenderer::parse ( const ASCString text)
protected

Definition at line 259 of file textrenderer.cpp.

References isSpace(), token(), and token_command().

Referenced by SetText().

PG_Widget * TextRenderer::parsingError ( const ASCString errorMessage)

Definition at line 281 of file textrenderer.cpp.

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

bool TextRenderer::registerTagRenderer ( TextRenderer::TagRenderer renderer)
static

Definition at line 293 of file textrenderer.cpp.

PG_Widget * TextRenderer::render ( const ASCString token)
protectedvirtual

Definition at line 427 of file textrenderer.cpp.

Referenced by token().

void TextRenderer::saveText ( bool  stripFormatting)
void TextRenderer::SetText ( const std::string &  text)
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: