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

NumericField Class Reference

User interface numeric entry field. More...

#include <NumericField.h>

Inherits TextField.

Inheritance diagram for NumericField:

Inheritance graph
[legend]
Collaboration diagram for NumericField:

Collaboration graph
[legend]
List of all members.

Public Methods

 NumericField (int i=0)
 Default constructor. More...

void setValue (double v)
 Sets the numeric value of the field. More...

double asDouble ()
 Returns the numeric value as double.

float asFloat ()
 Returns the numeric value as float.

int asInt ()
 Returns the numeric value as int.

void setFormat (unsigned short f0, unsigned short f1)
 Set the format of the numeric value.

void checkInput ()
 Checkes the current input. 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

double value
 The current numeric value displayed.

unsigned short format0
 The number of digits displayed before '.'.

unsigned short format1
 The number of digits displayed after '.'.


Detailed Description

User interface numeric entry field.

Used to edit a numeric value. The numeric value is displayed as "%<format0>.<format1>f" where format0 is the number of digits before the '.' and format1 the number of digits after '.'.

Events:

Format: (see TextField)
    PARAM ::= VALUE | NUMERIC_FORMAT
    VALUE :== "value" <double>
    NUMERIC_FORMAT :== "format" <unsigned int> <unsigned int>
    


Constructor & Destructor Documentation

NumericField::NumericField int    i = 0
 

Default constructor.

Constructs a new NumericField with id 'i'. The id must be unique in the current scope.

Parameters:
i  int to be used as id.
Postcondition:
NumericField is initialized.


Member Function Documentation

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

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

void NumericField::setValue double    v
 

Sets the numeric value of the field.

Formats the value v as "%<format0>.<format1>f" and set the text value.

Parameters:
v  the new value to display.
Precondition:
none.
Postcondition:
the value has been formated and stored.
See also:
TextField::setText.

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


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.