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