i6engine  1.0
i6e::modules::GUIManager Class Reference

This class interacts with CEGUI. It's methods are executed in the OGRE / CEGUI thread. More...

#include <D:/Projekte/i6engine/libs/i6engine-modules/include/i6engine/modules/gui/GUIManager.h>

Public Types

typedef std::map< std::string, boost::function< void(void)> > GUIFunctions
 
typedef std::map< std::pair< api::KeyCode, std::string >, boost::function< void(void)> > GUIKeyFunctions
 

Public Member Functions

 GUIManager (GUIController *ctrl)
 constructor, registers basic GUI stuff More...
 
 ~GUIManager ()
 destructor, cleans up GUI More...
 
void initializeGUI (Ogre::Root *root)
 Automatically sets up all necessary dat structures of the underlying gui library. More...
 
CEGUI::Window * getRootWindow () const
 Returns a pointer to gui root window. More...
 
void setFunction (const std::string &name, const boost::function< void(void)> &ptrEventMethod)
 Adds the given function associated with the window to the GUIFunctions map. More...
 
bool allowedEvent (const std::string &name)
 returns true, if the event is allowed to be called More...
 
void changeEvent (const std::string &name, const bool b)
 changes the status of the event More...
 
bool getVisibility (const std::string &windowname)
 return visibility of the window More...
 
void processCreateMessage (uint16_t type, api::gui::GUIUpdateMessageStruct *data)
 Handles an incoming message to create a GUI widget. More...
 
void processUpdateMessage (uint16_t type, api::gui::GUIUpdateMessageStruct *data)
 Handles an incoming message to update a GUI widget This method forwards the message to the right widget. More...
 
void processDeleteMessage (uint16_t type, api::gui::GUIUpdateMessageStruct *data)
 Handles an incoming message to delete a GUI widget. More...
 
void processInputUpdateMessage (uint16_t type, core::MessageStruct *data)
 Handles incoming input messages. More...
 
void addTicker (api::GUIWidget *widget)
 registers a widget to be ticked More...
 
void removeTicker (api::GUIWidget *widget)
 removes a widget from the tick list More...
 
void tickWidgets ()
 ticks all registered GUIWidgets More...
 
void registerGUIWidgetTemplate (const std::string &name, GUIWidget_factory createFunc)
 registers a widget-template to create new widgets via messages. More...
 

Protected Member Functions

void createGUI (const std::string &strScheme, const std::string &strFont, const std::string &strDefaultFont, const std::string &strDefaultMouseImageSet, const std::string &strDefaultMouseImageName)
 Creates the GUI. More...
 
void MouseMove (const double fltDeltaX, const double fltDeltaY, const double fltDeltaZ) const
 Injects a mouse movement into the gui subsystem. More...
 
void MousePos (const double fltPosX, const double fltPosY) const
 Injects a new absolute cursor position into the gui subsystem. More...
 
void MouseDown (const api::KeyCode enuButton) const
 Injects the press of a mouse button into the gui subsytem. More...
 
void MouseUp (const api::KeyCode enuButton) const
 Injects the release of a mouse button into the gui subsytem. More...
 
void KeyDown (const api::KeyCode intKeyCode, uint32_t text)
 Injects the press of a keyboard key into the gui subsystem. More...
 
void KeyHold (const api::KeyCode intKeyCode)
 Injects a hold key. More...
 
void KeyUp (const api::KeyCode intKeyCode)
 Injects the release of a keyboard key into the gui subsystem. More...
 
void MouseLeaves () const
 Notifies the gui subsystem that the cursor has left the game window. More...
 
void addChildWindow (const std::string &parent_widget, const std::string &child_widget)
 Calls the CEGUI method addChildWindow (see CEGUI documentation) More...
 
void addToRootWindow (CEGUI::Window *child)
 Calls the CEGUI method addChildWindow with the root window (see CEGUI documentation) More...
 
void setMouseVisibility (const bool visibility)
 Calls the CEGUI method setVisible on the mouse cursor (see CEGUI documentation) More...
 
void cleanUpAllWindows ()
 Calls clear on _objGUIWindows. More...
 
void subscribeEvent (const std::string &name, const std::string &type)
 Calls the CEGUI method subscribeEvent for mouse actions or keystrokes (see CEGUI documentation) More...
 
void triggerFunction (const std::string &name)
 Triggers the previously subscribed event by clicking the window, with the name "name". Only clicking so far available. More...
 
void triggerKeyFunction (const uint32_t keyCode, const std::string &type)
 Triggers the previously subscribed event for a key "Pressed" or "Released" event. More...
 
void handleCreateMessage (uint16_t type, api::gui::GUIUpdateMessageStruct *data)
 Handles all create messages, which are for the GUIManager. More...
 
void handleUpdateMessage (uint16_t type, api::gui::GUIUpdateMessageStruct *data)
 Handles all update messages, which are for the GUIManager. More...
 
void handleDeleteMessage (uint16_t type, api::gui::GUIUpdateMessageStruct *data)
 Handles all delete messages, which are for the GUIManager. More...
 
CEGUI::OgreRenderer * getRenderer () const
 Returns a pointer to the renderer of the gui subsystem. More...
 
void Tick ()
 Tick method of the GUI Subsystem. More...
 

Friends

class GUICanvas
 
class GUIController
 
class GUIMailbox
 

Detailed Description

This class interacts with CEGUI. It's methods are executed in the OGRE / CEGUI thread.

Definition at line 77 of file GUIManager.h.

Member Typedef Documentation

typedef std::map<std::string, boost::function<void(void)> > i6e::modules::GUIManager::GUIFunctions

Definition at line 83 of file GUIManager.h.

typedef std::map<std::pair<api::KeyCode, std::string>, boost::function<void(void)> > i6e::modules::GUIManager::GUIKeyFunctions

Definition at line 85 of file GUIManager.h.

Constructor & Destructor Documentation

i6e::modules::GUIManager::GUIManager ( GUIController ctrl)

constructor, registers basic GUI stuff

i6e::modules::GUIManager::~GUIManager ( )

destructor, cleans up GUI

Member Function Documentation

void i6e::modules::GUIManager::addChildWindow ( const std::string &  parent_widget,
const std::string &  child_widget 
)
protected

Calls the CEGUI method addChildWindow (see CEGUI documentation)

Parameters
parent_widgetName of the parent widget
child_widgetName of the child widget
void i6e::modules::GUIManager::addTicker ( api::GUIWidget widget)

registers a widget to be ticked

void i6e::modules::GUIManager::addToRootWindow ( CEGUI::Window *  child)
protected

Calls the CEGUI method addChildWindow with the root window (see CEGUI documentation)

adds a given window to root

Parameters
childThe window to add to root
bool i6e::modules::GUIManager::allowedEvent ( const std::string &  name)

returns true, if the event is allowed to be called

returns value depending on whether or not _enabledFunctions count is equal to zero

Parameters
conststd::string & name
Returns
bool true if enabled, false otherwise
void i6e::modules::GUIManager::changeEvent ( const std::string &  name,
const bool  b 
)
inline

changes the status of the event

Definition at line 134 of file GUIManager.h.

void i6e::modules::GUIManager::cleanUpAllWindows ( )
protected

Calls clear on _objGUIWindows.

calls clear on _objGUIWindows

void i6e::modules::GUIManager::createGUI ( const std::string &  strScheme,
const std::string &  strFont,
const std::string &  strDefaultFont,
const std::string &  strDefaultMouseImageSet,
const std::string &  strDefaultMouseImageName 
)
protected

Creates the GUI.

creates new Windows by calling CEGUIs createWindow function thereby setting a default mouse cursor

Parameters
[in]strScheme- the Scheme which should be loaded (.scheme / XML)
[in]strFont- the default font set
[in]strDefaultFont- the default font (out of the set)
[in]strDefaultMouseImageSet- the mouse image set
[in]strDefaultMouseImageName- the name out of the mouseimageset
CEGUI::OgreRenderer* i6e::modules::GUIManager::getRenderer ( ) const
inlineprotected

Returns a pointer to the renderer of the gui subsystem.

Returns
Pointer to the CEGUI renderer for Ogre

Definition at line 365 of file GUIManager.h.

CEGUI::Window* i6e::modules::GUIManager::getRootWindow ( ) const
inline

Returns a pointer to gui root window.

Returns
Pointer to the gui root window

Definition at line 108 of file GUIManager.h.

bool i6e::modules::GUIManager::getVisibility ( const std::string &  windowname)

return visibility of the window

returns boolean whether window specified by name is set to visible or not

Parameters
conststd::string & windowname
Returns
bool - true on visible, false otherwise
void i6e::modules::GUIManager::handleCreateMessage ( uint16_t  type,
api::gui::GUIUpdateMessageStruct data 
)
protected

Handles all create messages, which are for the GUIManager.

void i6e::modules::GUIManager::handleDeleteMessage ( uint16_t  type,
api::gui::GUIUpdateMessageStruct data 
)
protected

Handles all delete messages, which are for the GUIManager.

void i6e::modules::GUIManager::handleUpdateMessage ( uint16_t  type,
api::gui::GUIUpdateMessageStruct data 
)
protected

Handles all update messages, which are for the GUIManager.

void i6e::modules::GUIManager::initializeGUI ( Ogre::Root *  root)

Automatically sets up all necessary dat structures of the underlying gui library.

initializes CEGUI by calling its initialization functions

void i6e::modules::GUIManager::KeyDown ( const api::KeyCode  intKeyCode,
uint32_t  text 
)
protected

Injects the press of a keyboard key into the gui subsystem.

fakes key press by using CEGUI's injectKeyDown and injectChar possibly handler for OIS

Parameters
[in]intapi::KeyCodeKeycode of the keyboard key that was pressed
void i6e::modules::GUIManager::KeyHold ( const api::KeyCode  intKeyCode)
protected

Injects a hold key.

void i6e::modules::GUIManager::KeyUp ( const api::KeyCode  intKeyCode)
protected

Injects the release of a keyboard key into the gui subsystem.

fakes key release by using CEGUI's injectKeyUp possibly handler for OIS

Parameters
[in]intapi::KeyCodeKeycode of the keyboard key that was released
void i6e::modules::GUIManager::MouseDown ( const api::KeyCode  enuButton) const
protected

Injects the press of a mouse button into the gui subsytem.

MouseDown handler for OIS, receives events and invokes CEGUI's injectMouseButtonDown

        Injected mouse buttons: left, right, middle, b3, b4
Parameters
[in]enuButtonButton which was pressed
void i6e::modules::GUIManager::MouseLeaves ( ) const
protected

Notifies the gui subsystem that the cursor has left the game window.

void i6e::modules::GUIManager::MouseMove ( const double  fltDeltaX,
const double  fltDeltaY,
const double  fltDeltaZ 
) const
protected

Injects a mouse movement into the gui subsystem.

fakes mouse movement and mouse wheel change by using CEGUI's injectMouseMove and injectMouseWheelChange possibly handler for OIS

Parameters
[in]fltDelatXChange of the cursors x position \param[in] fltDeltaY Change of the cursors y position
[in]fltDeltaZChange of the mousewheel position
void i6e::modules::GUIManager::MousePos ( const double  fltPosX,
const double  fltPosY 
) const
protected

Injects a new absolute cursor position into the gui subsystem.

fakes mouse movement by using CEGUI's injectMouseMove

Parameters
[in]fltPosXNew absolute x position of the cursor
[in]FltPosYNew absolute y position of the cursor
void i6e::modules::GUIManager::MouseUp ( const api::KeyCode  enuButton) const
protected

Injects the release of a mouse button into the gui subsytem.

MouseUp handler for OIS, receives events and invokes CEGUI's injectMouseButtonUp

        Injected mouse buttons: left, right, middle, b3, b4
Parameters
[in]enuButtonButton which was released
void i6e::modules::GUIManager::processCreateMessage ( uint16_t  type,
api::gui::GUIUpdateMessageStruct data 
)

Handles an incoming message to create a GUI widget.

Parameters
typeThe subtype of the message
dataThe content of the message
void i6e::modules::GUIManager::processDeleteMessage ( uint16_t  type,
api::gui::GUIUpdateMessageStruct data 
)

Handles an incoming message to delete a GUI widget.

Parameters
typeThe subtype of the message
dataThe content of the message
void i6e::modules::GUIManager::processInputUpdateMessage ( uint16_t  type,
core::MessageStruct data 
)

Handles incoming input messages.

void i6e::modules::GUIManager::processUpdateMessage ( uint16_t  type,
api::gui::GUIUpdateMessageStruct data 
)

Handles an incoming message to update a GUI widget This method forwards the message to the right widget.

Parameters
typeThe subtype of the message
dataThe content of the message
void i6e::modules::GUIManager::registerGUIWidgetTemplate ( const std::string &  name,
GUIWidget_factory  createFunc 
)

registers a widget-template to create new widgets via messages.

Parameters
[in]nameName of the widget-type.
[in]createFuncA boost::function which takes a string name and a string style, and returns a GUIWidget * Tip: You can use boost::factory to register the Constructor of a GUIWidget.
void i6e::modules::GUIManager::removeTicker ( api::GUIWidget widget)

removes a widget from the tick list

void i6e::modules::GUIManager::setFunction ( const std::string &  name,
const boost::function< void(void)> &  ptrEventMethod 
)

Adds the given function associated with the window to the GUIFunctions map.

adds a function pointer to _objGUIFunctions by name (function is called on clicks)

Parameters
nameName of the associated window
ptrEventMethodPointer to the designated function
void i6e::modules::GUIManager::setMouseVisibility ( const bool  visibility)
protected

Calls the CEGUI method setVisible on the mouse cursor (see CEGUI documentation)

sets mouse visibility by calling CEGUI's setVisible function

Parameters
visibilityTrue to show, false to hide.
void i6e::modules::GUIManager::subscribeEvent ( const std::string &  name,
const std::string &  type 
)
protected

Calls the CEGUI method subscribeEvent for mouse actions or keystrokes (see CEGUI documentation)

Sets specific EventHandler depending on event type specified by name (i.e. ClickedEventHandler, PressedEventHandler, ReleasedEventHandler)

Parameters
nameThe name of the window OR the OIS::api::KeyCode of the designated key.
typeType of the event, either "Clicked" for mouseklicks on windows OR "Pressed"/"Released" for key actions.
void i6e::modules::GUIManager::Tick ( )
protected

Tick method of the GUI Subsystem.

void i6e::modules::GUIManager::tickWidgets ( )

ticks all registered GUIWidgets

void i6e::modules::GUIManager::triggerFunction ( const std::string &  name)
protected

Triggers the previously subscribed event by clicking the window, with the name "name". Only clicking so far available.

seems to invoke a function call to function in _objGUIFunctions specified by name merely checks existance of name in _objGUIFunctions and calls boost::thread(iter->second) on success

Parameters
name
Returns
bool true if enabled, false otherwise
void i6e::modules::GUIManager::triggerKeyFunction ( const uint32_t  keyCode,
const std::string &  type 
)
protected

Triggers the previously subscribed event for a key "Pressed" or "Released" event.

seems to invoke a function call to function in _objGUIFunctions specified by name and type merely checks existance of name and type value pair in _objGUIFunctions and calls boost::thread(iter->second) on success

Returns
bool true if enabled, false otherwise

Friends And Related Function Documentation

friend class GUICanvas
friend

Definition at line 78 of file GUIManager.h.

friend class GUIController
friend

Definition at line 79 of file GUIManager.h.

friend class GUIMailbox
friend

Definition at line 80 of file GUIManager.h.


The documentation for this class was generated from the following file: