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

Label Class Reference

User interface static text widget. More...

#include <Label.h>

Inherits Region.

Inheritance diagram for Label:

Inheritance graph
[legend]
Collaboration diagram for Label:

Collaboration graph
[legend]
List of all members.

Public Methods

 Label (const string t="")
 Default constructor. More...

void setText (const string &t)
 Sets the value of the static text. More...

void refresh ()
 Repaints the region. More...

void parseSymbol (Token &t, ObjectFile &file)
 Reads a single parameter sections inside the body of the object description. More...

void writeParams (ostream &stream)
 Writes all parameter sections inside the body of the object description. More...


Protected Methods

void createSymbols ()
 Creates all parameter symbols that are used within the body of the object description.


Protected Attributes

string text
 The actual text to display.


Detailed Description

User interface static text widget.

The Label class is used to display static text on the user interface. It uses the Font class to render the static text.

Format: (see Region)

    PARAM ::= TEXT
    TEXT ::= "text" <string>

    Example:
    Label {
      id 5;
      position 5 5;
      text "Some static text";
    }
    


Constructor & Destructor Documentation

Label::Label const string    t = ""
 

Default constructor.

Constructs a new Label with text 't'.

Parameters:
t  text to display.
Postcondition:
Label is initialized.


Member Function Documentation

void Label::parseSymbol Token   t,
ObjectFile   file
[virtual]
 

Reads a single parameter sections inside the body of the object description.

Each object has a set of parameter names associated with it, called symbols. Symbols are declared inside the createSymbols method. The method parseSymbol expects the Token t to be such a symbol and reads the corresponding parameters. Unknown symbols are passed to its super class.

Parameters:
t  Token that is the current parameter symbol.
file  ObjectFile from which to read.
Precondition:
The file is opened for reading and is positioned just after the parameter name.
Postcondition:
The parameter section is read including the terminating semicolon (';').

Reimplemented from Region.

void Label::refresh   [virtual]
 

Repaints the region.

This method is called whenever the screen is repainted. The repaint method uses OpenGL calls to render the region. Currently it is assumed that regions are refreshed automatically so that no refresh notification has to be done when the region changes state i.e. no refresh has to be forced by the region. Region rendering is done back to front.

Precondition:
An OpenGL context has been created and activated to render in.
Postcondition:
The region is redrawn.

Reimplemented from Region.

void Label::setText const string &    t
 

Sets the value of the static text.

Parameters:
t  New text string to display.
Postcondition:
The new text is displayed and the width of the label is adjusted to fit the text.

void Label::writeParams ostream &    stream [virtual]
 

Writes all parameter sections inside the body of the object description.

This method writes all object parameters to ostream. Inhereting classes will always call super::writeParams().

Parameters:
stream  ostream to which to write.
Precondition:
stream is opened for writing.
Postcondition:
All object parameters are written.

Reimplemented from Region.


The documentation for this class was generated from the following files:
This documentation was generated using doxygen. If you have any comments or additions please mail me.