Rev | Line | |
---|
[4838] | 1 | /*! |
---|
| 2 | * @file proto_singleton.h |
---|
[5405] | 3 | * @brief Definition of the GLGuiHandler singleton Class |
---|
[3655] | 4 | */ |
---|
| 5 | |
---|
[5366] | 6 | #ifndef _GLGUI_HANDLER_H |
---|
| 7 | #define _GLGUI_HANDLER_H |
---|
[3655] | 8 | |
---|
[5388] | 9 | #include "event_listener.h" |
---|
[7919] | 10 | #include "glgui_widget.h" |
---|
[3655] | 11 | |
---|
[7779] | 12 | namespace OrxGui |
---|
| 13 | { |
---|
[9656] | 14 | // FORWARD DECLARATION |
---|
[7919] | 15 | class GLGuiCursor; |
---|
| 16 | |
---|
[3655] | 17 | |
---|
[7779] | 18 | //! A singleton class for the GLGui-Handler |
---|
| 19 | class GLGuiHandler : public EventListener |
---|
| 20 | { |
---|
[9869] | 21 | ObjectListDeclaration(GLGuiHandler); |
---|
[7779] | 22 | public: |
---|
| 23 | /** @returns a Pointer to the only object of this Class */ |
---|
| 24 | inline static GLGuiHandler* getInstance(void) { if (!GLGuiHandler::singletonRef) GLGuiHandler::singletonRef = new GLGuiHandler(); return GLGuiHandler::singletonRef; }; |
---|
[9656] | 25 | /** @brief deletes the instance if it exists */ |
---|
| 26 | inline static void deleteInstance() { if (GLGuiHandler::singletonRef) delete GLGuiHandler::singletonRef; }; |
---|
[3655] | 27 | |
---|
[7919] | 28 | void activateCursor(); |
---|
| 29 | void deactivateCursor(/** ignore param */ bool deleteCursor = true); |
---|
[8324] | 30 | GLGuiCursor* cursor() const { return this->_cursor; } |
---|
[7919] | 31 | |
---|
[9240] | 32 | const Vector2D& cursorPositionOverFocusedWidget() const; |
---|
[8035] | 33 | const Vector2D& cursorPositionAbs() const; |
---|
| 34 | Vector2D cursorPositionRel(const GLGuiWidget* const widget) const; |
---|
| 35 | |
---|
[9656] | 36 | const Vector2D& resolution(); |
---|
| 37 | |
---|
[8717] | 38 | void selectNext(); |
---|
| 39 | void selectPrevious(); |
---|
| 40 | |
---|
[7779] | 41 | void activate(); |
---|
| 42 | void deactivate(); |
---|
[5388] | 43 | |
---|
[8717] | 44 | void checkFocus(); |
---|
[5388] | 45 | |
---|
[7779] | 46 | virtual void process(const Event &event); |
---|
| 47 | void draw(); |
---|
| 48 | void tick(float dt); |
---|
[5388] | 49 | |
---|
[7779] | 50 | private: |
---|
| 51 | GLGuiHandler(void); |
---|
[9656] | 52 | virtual ~GLGuiHandler(void); |
---|
[7779] | 53 | static GLGuiHandler* singletonRef; |
---|
[5388] | 54 | |
---|
| 55 | |
---|
[7779] | 56 | bool isActive; |
---|
[8324] | 57 | GLGuiCursor* _cursor; |
---|
[9656] | 58 | Vector2D _resolution; |
---|
[7919] | 59 | |
---|
[7779] | 60 | }; |
---|
| 61 | } |
---|
[3655] | 62 | |
---|
[5366] | 63 | #endif /* _GLGUI_HANDLER_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.