#include <TextBlock.h>

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 | |
| Font & | getFont () |
| 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. | |
| 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
| 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
| 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.
| 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] |
| void TextBlock::selectGl | ( | ) | [virtual] |
| float TextBlock::getLength | ( | const string & | text | ) |
calculates the length of a string (on the screen)
| text | The text whose length should be determined |
| void TextBlock::setText | ( | const string & | text | ) |
setter for text
| text | The text of the textblock |
| void TextBlock::setFont | ( | const Font & | font | ) |
setter for font
| font | The font of the textblock |
| void TextBlock::setSize | ( | const GLfloat & | size | ) |
setter for size
| size | The size of the textblock |
| void TextBlock::setWidth | ( | const GLfloat & | width | ) |
setter for width
| width | The width of the textblock |
| void TextBlock::setHeight | ( | const GLfloat & | height | ) |
setter for heigth
| height | The heigth of the textblock |
| string & TextBlock::getText | ( | ) |
getter for text
| Font & TextBlock::getFont | ( | ) |
getter for font
| GLfloat & TextBlock::getSize | ( | ) |
getter for size
| GLfloat & TextBlock::getWidth | ( | ) |
getter for width
| GLfloat & TextBlock::getHeight | ( | ) |
getter for height
| string TextBlock::toString | ( | ) | const [virtual] |
Returns a textual representation.
Reimplemented from Object2d.
| string TextBlock::className | ( | ) | const [virtual] |
Returns the class name of the object.
Reimplemented from Object2d.
| enum classId TextBlock::classId | ( | ) | const [virtual] |
Returns the class id of the object.
Reimplemented from Object2d.
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.
Color TextBlock::color [private] |
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.
1.5.6