25 #ifndef __I6ENGINE_MODULES_GUIMANAGER_H__
26 #define __I6ENGINE_MODULES_GUIMANAGER_H__
41 #include "boost/function.hpp"
42 #include "boost/thread/mutex.hpp"
67 const std::string
GUIMAN =
"GUIManager";
83 typedef std::map<std::string, boost::function<void(void)>>
GUIFunctions;
85 typedef std::map<std::pair<api::KeyCode, std::string>, boost::function<void(void)>>
GUIKeyFunctions;
119 void setFunction(
const std::string & name,
const boost::function<
void(
void)> & ptrEventMethod);
134 inline void changeEvent(
const std::string & name,
const bool b) { _enabledFunctions[name] = b; }
208 void createGUI(
const std::string & strScheme,
const std::string & strFont,
const std::string & strDefaultFont,
const std::string & strDefaultMouseImageSet,
const std::string & strDefaultMouseImageName);
220 void MouseMove(
const double fltDeltaX,
const double fltDeltaY,
const double fltDeltaZ)
const;
230 void MousePos(
const double fltPosX,
const double fltPosY)
const;
240 void MouseDown(
const api::KeyCode enuButton)
const;
250 void MouseUp(
const api::KeyCode enuButton)
const;
260 void KeyDown(
const api::KeyCode intKeyCode, uint32_t text);
265 void KeyHold(
const api::KeyCode intKeyCode);
275 void KeyUp(
const api::KeyCode intKeyCode);
288 void addChildWindow(
const std::string & parent_widget,
const std::string & child_widget);
323 void subscribeEvent(
const std::string & name,
const std::string & type);
365 inline CEGUI::OgreRenderer *
getRenderer()
const {
return _objRenderer; }
382 bool ClickedEventHandler(
const CEGUI::EventArgs & e);
392 bool PressedEventHandler(
const CEGUI::EventArgs & e);
402 bool ReleasedEventHandler(
const CEGUI::EventArgs & e);
415 std::vector<api::GUIWidget *> getMouseoverWidgets()
const {
417 return _mouseOverWidgets;
420 CEGUI::OgreRenderer * _objRenderer;
421 GUIFunctions _objGUIFunctions;
422 GUIKeyFunctions _objGUIKeyFunctions;
423 CEGUI::Window * _objRoot;
428 std::map<std::string, api::GUIWidget *> _widgets;
429 std::map<std::string, bool> _enabledFunctions;
435 std::list<api::GUIWidget *> _toTick;
437 std::array<api::KeyState, 238> _keyStates;
444 mutable boost::mutex _tickerLock;
448 std::string _lastOnWindow;
450 std::vector<api::GUIWidget *> _mouseOverWidgets;
void KeyUp(const api::KeyCode intKeyCode)
Injects the release of a keyboard key into the gui subsystem.
bool getVisibility(const std::string &windowname)
return visibility of the window
void addTicker(api::GUIWidget *widget)
registers a widget to be ticked
void handleUpdateMessage(uint16_t type, api::gui::GUIUpdateMessageStruct *data)
Handles all update messages, which are for the GUIManager.
Extracts the contents of incoming messages on the "Gui" channel and calls the corresponding methods o...
#define ASSERT_THREAD_SAFETY_FUNCTION
void triggerFunction(const std::string &name)
Triggers the previously subscribed event by clicking the window, with the name "name". Only clicking so far available.
Responsible for initializing and updating the gui.
void subscribeEvent(const std::string &name, const std::string &type)
Calls the CEGUI method subscribeEvent for mouse actions or keystrokes (see CEGUI documentation) ...
void changeEvent(const std::string &name, const bool b)
changes the status of the event
void handleDeleteMessage(uint16_t type, api::gui::GUIUpdateMessageStruct *data)
Handles all delete messages, which are for the GUIManager.
void MouseDown(const api::KeyCode enuButton) const
Injects the press of a mouse button into the gui subsytem.
boost::function< api::GUIWidget *(const std::string &name, const std::string &style)> GUIWidget_factory
void handleCreateMessage(uint16_t type, api::gui::GUIUpdateMessageStruct *data)
Handles all create messages, which are for the GUIManager.
This class provides method to load a canvas file.
void setFunction(const std::string &name, const boost::function< void(void)> &ptrEventMethod)
Adds the given function associated with the window to the GUIFunctions map.
Used to partially unwrap GUI messages.
std::map< std::pair< api::KeyCode, std::string >, boost::function< void(void)> > GUIKeyFunctions
CEGUI::OgreRenderer * getRenderer() const
Returns a pointer to the renderer of the gui subsystem.
CEGUI::Window * getRootWindow() const
Returns a pointer to gui root window.
void removeTicker(api::GUIWidget *widget)
removes a widget from the tick list
#define ASSERT_THREAD_SAFETY_HEADER
i6e::api::gui::GUIUpdateMessageStruct GUIUpdateMessageStruct
void triggerKeyFunction(const uint32_t keyCode, const std::string &type)
Triggers the previously subscribed event for a key "Pressed" or "Released" event. ...
void processDeleteMessage(uint16_t type, api::gui::GUIUpdateMessageStruct *data)
Handles an incoming message to delete a GUI widget.
void addToRootWindow(CEGUI::Window *child)
Calls the CEGUI method addChildWindow with the root window (see CEGUI documentation) ...
~GUIManager()
destructor, cleans up GUI
void registerGUIWidgetTemplate(const std::string &name, GUIWidget_factory createFunc)
registers a widget-template to create new widgets via messages.
GUIManager(GUIController *ctrl)
constructor, registers basic GUI stuff
void addChildWindow(const std::string &parent_widget, const std::string &child_widget)
Calls the CEGUI method addChildWindow (see CEGUI documentation)
void cleanUpAllWindows()
Calls clear on _objGUIWindows.
void setMouseVisibility(const bool visibility)
Calls the CEGUI method setVisible on the mouse cursor (see CEGUI documentation)
void MouseLeaves() const
Notifies the gui subsystem that the cursor has left the game window.
void MouseMove(const double fltDeltaX, const double fltDeltaY, const double fltDeltaZ) const
Injects a mouse movement into the gui subsystem.
void processCreateMessage(uint16_t type, api::gui::GUIUpdateMessageStruct *data)
Handles an incoming message to create a GUI widget.
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.
void Tick()
Tick method of the GUI Subsystem.
friend class GUIController
void KeyHold(const api::KeyCode intKeyCode)
Injects a hold key.
void MouseUp(const api::KeyCode enuButton) const
Injects the release of a mouse button into the gui subsytem.
This class interacts with CEGUI. It's methods are executed in the OGRE / CEGUI thread.
void initializeGUI(Ogre::Root *root)
Automatically sets up all necessary dat structures of the underlying gui library. ...
struct ISIXE_CORE_API i6e::core::MessageStruct MessageStruct
bool allowedEvent(const std::string &name)
returns true, if the event is allowed to be called
void KeyDown(const api::KeyCode intKeyCode, uint32_t text)
Injects the press of a keyboard key into the gui subsystem.
void tickWidgets()
ticks all registered GUIWidgets
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 widg...
void processInputUpdateMessage(uint16_t type, core::MessageStruct *data)
Handles incoming input messages.
void MousePos(const double fltPosX, const double fltPosY) const
Injects a new absolute cursor position into the gui subsystem.
std::map< std::string, boost::function< void(void)> > GUIFunctions