Line | |
---|
1 | /*! |
---|
2 | * @file glgui_widget.h |
---|
3 | * The gl_widget of the openglGUI |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _GLGUI_WIDGET_H |
---|
7 | #define _GLGUI_WIDGET_H |
---|
8 | |
---|
9 | #include "element_2d.h" |
---|
10 | #include "glincl.h" |
---|
11 | #include "event.h" |
---|
12 | |
---|
13 | // FORWARD DECLARATION |
---|
14 | class Material; |
---|
15 | class Signal; //!< @todo create this!! |
---|
16 | |
---|
17 | typedef enum |
---|
18 | { |
---|
19 | GLGuiSignal_click = 0, |
---|
20 | GLGuiSignal_release = 1, |
---|
21 | GLGuiSignal_rollOn = 2, |
---|
22 | GLGuiSignal_rollOff = 3, |
---|
23 | GLGuiSignal_open = 4, |
---|
24 | GLGuiSignal_close = 5, |
---|
25 | GLGuiSignal_destroy = 6, |
---|
26 | |
---|
27 | GLGuiSignalCount = 7, |
---|
28 | } GLGuiSignalType; |
---|
29 | |
---|
30 | //! if the Element should be visible by default. |
---|
31 | #define GLGUI_WIDGET_DEFAULT_VISIBLE false |
---|
32 | |
---|
33 | //! This is widget part of the openglGUI class |
---|
34 | /** |
---|
35 | * A widget is the main class of all the elements of th GUI. |
---|
36 | */ |
---|
37 | class GLGuiWidget : public Element2D { |
---|
38 | public: |
---|
39 | GLGuiWidget(); |
---|
40 | virtual ~GLGuiWidget(); |
---|
41 | |
---|
42 | void init(); |
---|
43 | |
---|
44 | void show(); |
---|
45 | void hide(); |
---|
46 | |
---|
47 | void connectSignal(GLGuiSignalType signalType, Signal* signal); |
---|
48 | void disconnectSignal(GLGuiSignalType); |
---|
49 | bool focusOverWidget(float x, float y); |
---|
50 | |
---|
51 | // if something was clickt on the GUI-widget. |
---|
52 | virtual void click(const Event& event) {}; |
---|
53 | virtual void release(const Event& event) {}; |
---|
54 | |
---|
55 | virtual void receiveFocus() {}; |
---|
56 | virtual void removeFocus() {}; |
---|
57 | |
---|
58 | virtual void update() = 0; |
---|
59 | |
---|
60 | protected: |
---|
61 | Material* backMat; |
---|
62 | GLuint backModel; |
---|
63 | |
---|
64 | Material* frontMat; |
---|
65 | GLuint frontModel; |
---|
66 | |
---|
67 | Signal* widgetSignals[GLGuiSignalCount]; |
---|
68 | |
---|
69 | private: |
---|
70 | bool focusable; //!< If this widget can receive focus. |
---|
71 | bool clickable; //!< if this widget can be clicked upon. |
---|
72 | }; |
---|
73 | |
---|
74 | #endif /* _GLGUI_WIDGET_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.