#include <Region.h>
Inherits DynamicObject.
Inherited by Frame, FrameCounter, Label, and Widget.
Inheritance diagram for Region:


Public Methods | |
| Region (int i=0) | |
| Default constructor. More... | |
| void | setId (int i) |
| Sets the id of the Region. | |
| short | getX () |
| Returns the x position. | |
| short | getY () |
| Returns the y position. | |
| short | centerX () |
| Returns the center x position. | |
| short | centerY () |
| Returns the center y position. | |
| short | getWidth () |
| Returns the Region width. | |
| short | getHeight () |
| Returns the Region height. | |
| void | setParent (Region *p) |
| Sets the parent (owner) of the region. | |
| bool | isParentOf (Region *p) |
| Returns true iff 'this' is owned by p. More... | |
| void | setPosition (short w, short h) |
| Set the Region position relative to parent. More... | |
| void | setSize (short w, short h) |
| Sets the Region size. | |
| void | center () |
| Center the Region within parent. More... | |
| void | open (const string &name) |
| Opens and reads a ObjectFile. More... | |
| Region * | getFocus () |
| Grabs the keyboard focus. | |
| Region * | grabMouse () |
| Grabs the mouse focus. | |
| void | releaseMouse () |
| Releases the mouse focus. | |
| void | drawCross () |
| Draws a cross within the region. More... | |
| virtual bool | accepts (Event &event) |
| Returns true iff region will accept the event. More... | |
| virtual Region * | find (int id) |
| Finds and returns the region with id. More... | |
| virtual void | refresh () |
| Repaints the region. More... | |
| virtual void | move (short dx, short dy) |
| Move the region. More... | |
| virtual void | resize (unsigned short w, unsigned short h) |
| Resizes the region. More... | |
| virtual bool | event (int regionId, int evnt) |
| Handle events from child Regions. More... | |
| virtual 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... | |
Static Public Attributes | |
| Region * | focusWindow = 0 |
| Pointer to the Region with keyboard focus or NULL. | |
| Region * | grabWindow = 0 |
| Pointer to the Region with mouse focus or NULL. | |
Protected Methods | |
| void | foreGround () |
| Renders the foreground color. | |
| void | backGround () |
| Renders the background color. | |
| void | darkBorder () |
| Renders the dark border color. | |
| void | lightBorder () |
| Renders the light border color. | |
| void | entryBackGround () |
| Renders the entry background color. | |
| void | drawBorder (short x, short y, short w, short h, bool sunken=true) |
| Draws a border inside the region. More... | |
| void | createSymbols () |
| Creates all parameter symbols that are used within the body of the object description. | |
Protected Attributes | |
| Region * | parent |
| Parent region. | |
| int | id |
| Region id. | |
| short | x |
| X position. | |
| short | y |
| Y position. | |
| short | width |
| Region Width. | |
| short | height |
| Region Height. | |
Static Protected Attributes | |
| const int | lineWidth = 4 |
| Default line width. | |
The Region is a rectangular region on the screen. Its main purpose is to handle keyboard and mouse inputs (Event). The Region class hierarchy implements an OpenGL widget set.
Format: (see DynamicObject)
PARAM ::= ID | SIZE | POSITION | CENTER
ID ::= "id" <int>
SIZE ::= "size" <width> <height>
POSITION ::= "position" <x position> <y position>
CENTER ::= "center"
Example:
Region {
id 5;
size 640 480;
position 10 5;
center;
}
|
|
Default constructor. Constructs a new Region with id 'i'. The id must be unique in the current scope.
|
|
|
Returns true iff region will accept the event. Region::accepts implementation checks if the events falls within the region boundary.
Reimplemented in Dialog. |
|
|
Center the Region within parent. This method calculated the center position of its parent and positions itself in the middle of its parent.
|
|
||||||||||||||||||||||||
|
Draws a border inside the region. This method draws a rectangle within the region. The rectangle is defined by its top left position and its width and height. The rectangle is drawn in dark and light colors so that it appears to be higher or lower than its surroundings. The standard way of doing this is to assume that light comes from the top left of the screen.
|
|
|
Draws a cross within the region. Renders a cross or 'X' inside the region. The cross is made to fit the region.
|
|
||||||||||||
|
Handle events from child Regions. The event method is used as a simple notification method to signal activations and state changes of regions. These event are handled bottom up until they are consumed (used). Events that are not accepted by this region are passed to the parent region. If no parent exists the event remains unconsumed.
Reimplemented in ColorPick. |
|
|
Finds and returns the region with id. This method searches the underlying region hierarchy to find a region with id 'i'.
Reimplemented in Frame. |
|
|
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.
Reimplemented in Button. |
|
|
Returns true iff 'this' is owned by p. This function walks though the list of parents of p, starting with p. It returns true if 'this' is a parent. By definition 'this' is a parent of 'this'.
|
|
||||||||||||
|
Move the region. Moved the region by (dx, dy) including all child regions.
Reimplemented in Frame. |
|
|
Opens and reads a ObjectFile. Reads a Region definition from ObjectFile. In DynamicObject terms it read the PARAM_LIST. This function first checks if name is a proper file name that can be accessed, if not it tries to access (EXPORT_PATH)/ui/name.
|
|
||||||||||||
|
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.
Reimplemented from DynamicObject. Reimplemented in Button. |
|
|
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.
Reimplemented in Button. |
|
||||||||||||
|
Resizes the region. Virtual method to change the size of the Region.
Reimplemented in ColorPick. |
|
||||||||||||
|
Set the Region position relative to parent.
If there s a parent the (xx, yy) position is added to the position of the parent otherwise the position is just set. Child windows are not moved.
|
|
|
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().
Reimplemented from DynamicObject. Reimplemented in Button. |