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

Frame Class Reference

Group of Region instances. More...

#include <Frame.h>

Inherits Region.

Inherited by ColorPick, Dialog, and GLWindow.

Inheritance diagram for Frame:

Inheritance graph
[legend]
Collaboration diagram for Frame:

Collaboration graph
[legend]
List of all members.

Public Methods

 Frame (int i=0)
 Default contructor. More...

virtual ~Frame ()
 Destructor.

void add (Region *region)
 Add a region to the child collection. More...

Regionremove (Region *region)
 Remove a child region. More...

void enableWidget (int widgetId, bool flag)
 Find and enables a widget. More...

Regionfind (int id)
 Finds and returns the region with id. More...

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

void move (short dx, short dy)
 Move the region. More...

bool handleEvent (Event &event)
 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

bool findRegion (Region *region)
 Non recursive find. More...

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


Protected Attributes

bool bordered
 Specifies whether the frame has a border.

vector< Region * > children
 Array of child Region instances.


Detailed Description

Group of Region instances.

A Frame is a collection class of Region instances. The Frame class is owner of the instances and manages them. Refresh and find calls are passed to all child regions.

Format: (see Region)

    PARAM ::= BORDERED | OBJECT
    BORDERED :== "bordered"
    

Example: Frame { id 5; NumericField { position 0 0; } }


Constructor & Destructor Documentation

Frame::Frame int    i = 0
 

Default contructor.

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

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


Member Function Documentation

void Frame::add Region   region
 

Add a region to the child collection.

Adds a Region to the list of child instances. The new region is placed on top of existing regions.

Note:
The Frame becomes owner of the region.
Parameters:
region  The Region to add.
Precondition:
New region may not be in the list of children.
Postcondition:
The list of children is extended with the new region.

void Frame::enableWidget int    widgetId,
bool    flag
 

Find and enables a widget.

This method finds a Widget class with id 'widgetId'. If a widget with this id is found the Widget::enable is called with parameter 'flag'.

Parameters:
widgetId  The widget to be found.
flag  new Widget enabled state.
Postcondition:
If found the Widget enabled state is set to 'flag'.

Region * Frame::find int    id [virtual]
 

Finds and returns the region with id.

This method searches the underlying region hierarchy to find a region with id 'i'.

Parameters:
i  Id of the region to find.
Returns:
Pointer to the Region found or NULL.

Reimplemented from Region.

bool Frame::findRegion Region   region [protected]
 

Non recursive find.

Non-recusively find a region pointer in the child array.

Parameters:
region  The region to find.
Returns:
True iff the region is found.

bool Frame::handleEvent Event   event [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.

Reimplemented in ColorPick.

void Frame::move short    dx,
short    dy
[virtual]
 

Move the region.

Moved the region by (dx, dy) including all child regions.

Parameters:
dx  the x offset to move.
dy  the y offset to move.
Postcondition:
The region and child regions are moved by (dx, dy).

Reimplemented from Region.

void Frame::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.

Reimplemented in ColorPick.

void Frame::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.

Reimplemented in ColorPick.

Region * Frame::remove Region   region
 

Remove a child region.

Non-recursively find and remove 'region' from the list of child instances.

Note:
Ownership is passed to calling class (region is not deleted!).
Parameters:
region  The Region to remove.
Postcondition:
Iff the region was found it is removed from the frame.
Returns:
  • region if the region was found.
  • NULL if it was not found.

void Frame::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.

Reimplemented in ColorPick.


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.