#include <guimanager.h>
Inheritance diagram for GuiManager:
Public Member Functions | |
DECLSPEC | GuiManager (UiManager *parent, const char *name="GuiManager") |
virtual const char * | getClassName () |
DECLSPEC bool | init (TiXmlElement *el=NULL) |
DECLSPEC void | setBaseElements (GuiElement *front, GuiElement *main) |
GuiElement * | getFront () |
| |
GuiElement * | getMain () |
| |
DECLSPEC void | focus (GuiElement *el) |
DECLSPEC bool | release (GuiElement *el) |
GuiElement * | getFocus () |
| |
DECLSPEC void | setCursor (GuiElement *cur) |
GuiElement * | getCursor () |
| |
DECLSPEC void | cleanupElement (GuiElement *ge) |
Static Public Member Functions | |
static DECLSPEC GuiManager * | getThe () |
Static Public Attributes | |
static GuiManager * | the |
Protected Member Functions | |
virtual Uint32 | onKeyDown (SDL_KeyboardEvent *ev) |
virtual Uint32 | onKeyUp (SDL_KeyboardEvent *ev) |
virtual DECLSPEC Uint32 | onMouseDown (SDL_MouseButtonEvent *ev) |
virtual DECLSPEC Uint32 | onMouseUp (SDL_MouseButtonEvent *ev) |
virtual DECLSPEC Uint32 | onMouseMotion (SDL_MouseMotionEvent *ev) |
virtual DECLSPEC Uint32 | onFocus (FocusTypes gained) |
virtual DECLSPEC Uint32 | onRelease (FocusTypes lost) |
virtual DECLSPEC Uint32 | onFrame () |
virtual Uint32 | onThemeChanged (UiTheme *t) |
virtual DECLSPEC void | onDestroy () |
GuiManager::GuiManager | ( | UiManager * | parent, | |
const char * | name = "GuiManager" | |||
) |
virtual const char* GuiManager::getClassName | ( | ) | [inline, virtual] |
This function should be overriden in every sub-class of BasicObject!
Reimplemented from UiObject.
bool GuiManager::init | ( | TiXmlElement * | el = NULL |
) |
Initializes this class and, if el is specified creates elements. The XML data can be structured as follows (for a screen with the size 1024x768):
<GuiManager> <Front> <GuiElement rect="0;0;1024;768" name="front"> [front elements like cursor, hint...] </GuiElement> </Front> <Main> <GuiElement rect="0;0;1024;768" name="main"> [window elements...] </GuiElement> </Main> <GuiFader name="fader" normal="0xFFFF"/> </GuiManager>
el | XML data for the elements to create |
void GuiManager::setBaseElements | ( | GuiElement * | front, | |
GuiElement * | main | |||
) |
Sets the elements that recieve onFrame-events from the GuiManager.
front | the front element (for cursor, hints...) | |
main | the main element (for windows...) |
void GuiManager::focus | ( | GuiElement * | el | ) |
Sets the mouse focus to the specified element. If an element has the focus, its onMouseMove() function is called, when the mouse is moved, but the other element's onMouseMove() function is not called. (If no element has the focus, onMouseMove() of the element is called, over which the cursor is - after the move)
el | the element to focus |
bool GuiManager::release | ( | GuiElement * | el | ) |
Sets the mouse focus to NULL, if the specified element had the focus.
el | the element |
void GuiManager::setCursor | ( | GuiElement * | cur | ) |
Sets the mouse cursor. The cursor recieves all mouse actions.
cur | the cursor |
void GuiManager::cleanupElement | ( | GuiElement * | ge | ) |
Cleans up all associations to the specified element. This is done, when an element is deleted. This method shall not be called from somewhere else but ~GuiElement().
ge | the element to clean up |
GuiManager * GuiManager::getThe | ( | ) | [static] |
virtual Uint32 GuiManager::onKeyDown | ( | SDL_KeyboardEvent * | ev | ) | [inline, protected, virtual] |
This event is called, when the object has the keyboard focus and a key is pressed down.
ev | the key-down event, that occured |
Reimplemented from UiObject.
virtual Uint32 GuiManager::onKeyUp | ( | SDL_KeyboardEvent * | ev | ) | [inline, protected, virtual] |
This event is called, when the object has the keyboard focus and a key is released.
ev | the key-up event, that occured |
Reimplemented from UiObject.
Uint32 GuiManager::onMouseDown | ( | SDL_MouseButtonEvent * | ev | ) | [protected, virtual] |
This event is called, when the object has the mouse focus and a mouse button is pressed down.
ev | the button-down event, that occured |
Reimplemented from UiObject.
Uint32 GuiManager::onMouseUp | ( | SDL_MouseButtonEvent * | ev | ) | [protected, virtual] |
This event is called, when the object has the mouse focus and a mouse button is released.
ev | the button-up event, that occured |
Reimplemented from UiObject.
Uint32 GuiManager::onMouseMotion | ( | SDL_MouseMotionEvent * | ev | ) | [protected, virtual] |
This event is called, when the mouse cursor is moved over the object.
x | the absolute x coordinate of the cursor (distance from left) | |
y | the absolute y coordinate of the cursor (distance from top) |
Reimplemented from UiObject.
Uint32 GuiManager::onFrame | ( | ) | [protected, virtual] |
This event is called when graphics should be updated. It does not call the children's onFrame() function!
Reimplemented from UiObject.
virtual Uint32 GuiManager::onThemeChanged | ( | UiTheme * | t | ) | [inline, protected, virtual] |
This event is called, when the theme changes. Perform here the changes of the object's look and feel.
t | pointer to the new used theme |
Reimplemented from UiObject.
void GuiManager::onDestroy | ( | ) | [protected, virtual] |
May be called to reinitialise this object or stop an initialised module. Calls all children's onDestroy(). Most classes do not use this method. But sometimes it is useful to reset the functionality of an object.
Reimplemented from UiObject.
GuiManager * GuiManager::the [static] |
Not accessible in Windows (dynamic linking), equals the result of getThe()