TextBlock Class Reference

#include <TextBlock.h>

Inheritance diagram for TextBlock:

Object2d ViewObject Object

List of all members.

Public Member Functions

 TextBlock ()
 The standard constructor.
 TextBlock (const string &fontname, const string &text, const GLfloat &size, const GLfloat &width, const GLfloat &height, const Color &color)
 Constructor for Initialization by reference.
 ~TextBlock ()
 Destructor.
void renderGl ()
 Renders the textblock.
void selectGl ()
 renders selction pass
float getLength (const string &text)
 calculates the length of a string (on the screen)
void setText (const string &text)
 setter for text
void setFont (const Font &font)
 setter for font
void setSize (const GLfloat &size)
 setter for size
void setWidth (const GLfloat &width)
 setter for width
void setHeight (const GLfloat &height)
 setter for heigth
string & getText ()
 getter for text
FontgetFont ()
 getter for font
GLfloat & getSize ()
 getter for size
GLfloat & getWidth ()
 getter for width
GLfloat & getHeight ()
 getter for height
virtual string toString () const
 Returns a textual representation.
virtual string className () const
 Returns the class name of the object.
virtual enum classId classId () const
 Returns the class id of the object.

Private Member Functions

void getLines ()
 Calculates the strings for the visible lines.
void getWords ()
 Calculates the words of the string text.
void getNewLines (const unsigned int &i, string &tempLine, float &length)
 Handles the first word of a new line.
void fillLines (unsigned int &i, string &tempLine, float &length)
 Handles the following words of a line.

Private Attributes

string text
 The text that should be shown.
Font font
 The selected Font.
GLfloat size
 The size of the letters.
GLfloat width
 The width of the textblock.
GLfloat height
 The height of the textblock.
Color color
 The color of the font.
vector< string > words
 The words the way they occur in text.
vector< string > lines
 The lines that are visible.


Constructor & Destructor Documentation

TextBlock::TextBlock (  ) 

The standard constructor.

The Standard Constructor

TextBlock::TextBlock ( const string &  fontname,
const string &  text,
const GLfloat &  size,
const GLfloat &  width,
const GLfloat &  height,
const Color color 
)

Constructor for Initialization by reference.

The Constructor for Initialization by value

TextBlock::~TextBlock (  ) 

Destructor.

The Destructor


Member Function Documentation

void TextBlock::getLines (  )  [private]

Calculates the strings for the visible lines.

This Method constructs the vector lines

void TextBlock::getWords (  )  [private]

Calculates the words of the string text.

This method creates the vector of all words of the string. The vector does not store the signs " ".

void TextBlock::getNewLines ( const unsigned int &  i,
string &  tempLine,
float &  length 
) [private]

Handles the first word of a new line.

This method puts the first word in a new line. If the word ist bigger than a line, it truncates it

Parameters:
i The index of the word that shall be inserted
tempLine The string with all the words for the current line
length The length of the current string for the line

void TextBlock::fillLines ( unsigned int &  i,
string &  tempLine,
float &  length 
) [private]

Handles the following words of a line.

This method puts words in a line that is partially filled. If the word ist bigger than a line, it begins a new line.

Parameters:
i The index of the word that shall be inserted
tempLine The string with all the words for the current line
length The length of the current string for the line

void TextBlock::renderGl (  )  [virtual]

Renders the textblock.

This method renders a textblock

Implements Object2d.

void TextBlock::selectGl (  )  [virtual]

renders selction pass

render method for object picking

Implements Object2d.

float TextBlock::getLength ( const string &  text  ) 

calculates the length of a string (on the screen)

Parameters:
text The text whose length should be determined

void TextBlock::setText ( const string &  text  ) 

setter for text

Parameters:
text The text of the textblock

void TextBlock::setFont ( const Font font  ) 

setter for font

Parameters:
font The font of the textblock

void TextBlock::setSize ( const GLfloat &  size  ) 

setter for size

Parameters:
size The size of the textblock

void TextBlock::setWidth ( const GLfloat &  width  ) 

setter for width

Parameters:
width The width of the textblock

void TextBlock::setHeight ( const GLfloat &  height  ) 

setter for heigth

Parameters:
height The heigth of the textblock

string & TextBlock::getText (  ) 

getter for text

Returns:
text The text of the textblock

Font & TextBlock::getFont (  ) 

getter for font

Returns:
font The font of the textblock

GLfloat & TextBlock::getSize (  ) 

getter for size

Returns:
size The size of the textblock

GLfloat & TextBlock::getWidth (  ) 

getter for width

Returns:
width The width of the textblock

GLfloat & TextBlock::getHeight (  ) 

getter for height

Returns:
height The height of the textblock

string TextBlock::toString (  )  const [virtual]

Returns a textual representation.

Returns:
a string descriping the run-time object

Reimplemented from Object2d.

string TextBlock::className (  )  const [virtual]

Returns the class name of the object.

Returns:
a string with the name of the object's class

Reimplemented from Object2d.

enum classId TextBlock::classId (  )  const [virtual]

Returns the class id of the object.

Returns:
an id of the object's class

Reimplemented from Object2d.


Member Data Documentation

string TextBlock::text [private]

The text that should be shown.

Font TextBlock::font [private]

The selected Font.

GLfloat TextBlock::size [private]

The size of the letters.

GLfloat TextBlock::width [private]

The width of the textblock.

GLfloat TextBlock::height [private]

The height of the textblock.

The color of the font.

vector<string> TextBlock::words [private]

The words the way they occur in text.

vector<string> TextBlock::lines [private]

The lines that are visible.


The documentation for this class was generated from the following files:

Generated on Mon Jul 7 13:30:35 2008 for Firefly by  doxygen 1.5.6