UiManager Class Reference
[User interfaceSingle inited classes]

Manager of user interface objects. More...

#include <uimanager.h>

Inheritance diagram for UiManager:

Inheritance graph
[legend]
Collaboration diagram for UiManager:

Collaboration graph
[legend]
List of all members.

Public Member Functions

DECLSPEC UiManager (TiXmlElement *el, BasicObject *p)
virtual const char * getClassName ()
DECLSPEC void loop (bool &stop)
DECLSPEC void handleEvents ()
DECLSPEC void drawFrame ()
DECLSPEC void setFocus (UiObject::FocusType f, UiObject *obj)
DECLSPEC UiObjectgetFocus (UiObject::FocusType f)
Uint32 getTimePerFrame () const
Uint32 getFrames () const
DECLSPEC Uint32 getAvgTimePerFrame () const
DECLSPEC void setMaxFramerate (Uint32 n)

Static Public Member Functions

static DECLSPEC UiManagergetThe ()

Static Public Attributes

static UiManagerthe

Protected Member Functions

virtual DECLSPEC void onInit ()

Friends

class ThemeManager

Detailed Description

Manager of user interface objects.

UiManager is neccessary, if you want to use Netrinjo-supported graphical user interaction. It supports also keyboard and mouse input to non-graphical objects. This class recieves events from SDL and calls the corresponding functions of the focused objects and calls a function for display update in each cycle.

There is only one variable of this type allowed at a time. Do not initialize it more than once.


Constructor & Destructor Documentation

UiManager::UiManager ( TiXmlElement el,
BasicObject p 
)

Constructor. The XML data may consist of the children "GuiManager" (to initialize the GuiManager) and "UiKeyCombination" (to set events for pressed key combinations).

Parameters:
el the XML element
p the parent object
See also:
GuiManager::init(), UiKeyCombination::init()


Member Function Documentation

virtual const char* UiManager::getClassName (  )  [inline, virtual]

This function should be overriden in every sub-class of BasicObject!

Returns:
the name of the class.

Reimplemented from BasicObject.

void UiManager::loop ( bool &  stop  ) 

This function does not end, until stop becomes true (stop is set to false directly after the function is called). In the loop handleEvents() and nextFrame() are called.

Parameters:
stop reference to a variable that indicates, when to stop the loop.
Note:
if you use this function, you should not call handleEvents() or nextFrame() parallel from another thread!

void UiManager::handleEvents (  ) 

Handles events concerning the application and user input (mouse / keyboard). This function should be called regularly.

void UiManager::drawFrame (  ) 

Handles drawing of graphical objects... (usually called directly after/before handleEvents() in the main loop)

void UiManager::setFocus ( UiObject::FocusType  f,
UiObject obj 
)

Sets the focus of keyboard, mouse or display to the specified object.

Parameters:
f the kind of focus to set
obj the object that will be focussed (may be NULL)

UiObject * UiManager::getFocus ( UiObject::FocusType  f  ) 

Parameters:
f the kind of focus to get
Returns:
the object that currently has the focus

Uint32 UiManager::getTimePerFrame (  )  const [inline]

Returns:
the duration in msecs of the last frame (equals the time between two drawFrame() calls)

Uint32 UiManager::getFrames (  )  const [inline]

Returns:
the number of frames that have been drawn yet

Uint32 UiManager::getAvgTimePerFrame (  )  const

Returns:
the average duration of one frame since init() has been called

void UiManager::setMaxFramerate ( Uint32  n  ) 

Limits the framerate by waiting, if the minimum time did not elapse. (This has no effect on the vertical or horizontal frequency of the monitor!)

Parameters:
n the maximum number of frames per second allowed

UiManager * UiManager::getThe (  )  [static]

Returns:
a pointer to the UiManager-variable, or NULL if not initialized. (There is only one UiManager-variable allowed in an application)
Every netrinjo-class that can only exist once at a time, has this static function.
See also:
Single inited classes

void UiManager::onInit (  )  [protected, virtual]

Initializes the manager by setting it up, as the XML element says it. The XML data may consist of the children "GuiManager" (to initialize the GuiManager) and "UiKeyCombination" (to set events for pressed key combinations).

Parameters:
el the XML element
See also:
GuiManager::init(), UiKeyCombination::init()

Reimplemented from BasicObject.


Member Data Documentation

UiManager * UiManager::the [static]

only accessible in Linux, and equals the result of getThe()


The documentation for this class was generated from the following files:
Generated on Wed May 9 17:36:36 2007 for netrinjo by  doxygen 1.5.1