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

TextField Class Reference

User interface Text field widget. More...

#include <TextField.h>

Inherits Widget.

Inherited by NumericField.

Inheritance diagram for TextField:

Inheritance graph
[legend]
Collaboration diagram for TextField:

Collaboration graph
[legend]
List of all members.

Public Methods

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

const string & getText ()
 Returns the currently displayed text.

void setText (const string &t)
 Set the text value. More...

virtual void checkInput ()
 Checkes the current input. More...

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

bool handleEvent (Event &evnt)
 Handle window-system events. 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 cursorLeft ()
 Moved the cursor to the left.

void cursorRight ()
 Moved the cursor to the right.

int widgetSize ()
 Returns the widget size (in characters).

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


Protected Attributes

string text
 Current string value.

int start
 First character that is displayed.

int cursor
 Cursor position.


Detailed Description

User interface Text field widget.

Used to edit a string value.

Events:

Format: (see Widget)
    PARAM ::= TEXT_VALUE 
    TEXT_VALUE :== "text" <string>
    


Constructor & Destructor Documentation

TextField::TextField const string    t = ""
 

Default constructor.

Constructs a new TextField with text value 't'.

Parameters:
t  Current text value.
Postcondition:
TextField is initialized.


Member Function Documentation

void TextField::checkInput   [virtual]
 

Checkes the current input.

Called when the text value is modified. This method is to be used by sub-classes of TextField to verify the input.

Precondition:
none.
Postcondition:
The input is checked and updated if needed.

Reimplemented in NumericField.

bool TextField::handleEvent Event   evnt [virtual]
 

Handle window-system events.

This method handles keyboard or mouse event from the window system. Window events are handled top down, events that are not consumed are passed to child regions that are willing to accept the event.

See also:
accepts
Parameters:
event  The Event that occured.
Postcondition:
The event is consumed or passed to child regions.
Returns:
true iff the Event is consumed.

Reimplemented from Region.

void TextField::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 Widget.

Reimplemented in NumericField.

void TextField::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 TextField::setText const string &    t
 

Set the text value.

The new text value is stored and the cursor is positioned at the end.

void TextField::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 Widget.

Reimplemented in NumericField.


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.