Changeset 7919 in orxonox.OLD for trunk/src/lib/gui/gl_gui/glgui_widget.h
- Timestamp:
- May 28, 2006, 3:48:13 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/gui/gl_gui/glgui_widget.h
r7868 r7919 8 8 9 9 #include "element_2d.h" 10 #include "event.h" 10 #include "rect2D.h" 11 11 12 #include "material.h" 12 13 14 #include "event.h" 15 #include "signal_connector.h" 16 13 17 #include "glincl.h" 14 #include "signal_connector.h" 18 19 #include <vector> 15 20 16 21 // FORWARD DECLARATION … … 19 24 namespace OrxGui 20 25 { 21 22 26 typedef enum 23 27 { … … 34 38 35 39 40 class GLGuiCursor; 41 36 42 //! if the Element should be visible by default. 37 43 #define GLGUI_WIDGET_DEFAULT_VISIBLE false … … 43 49 class GLGuiWidget : public Element2D 44 50 { 51 45 52 private: 46 53 … … 52 59 void hide(); 53 60 61 /// INTERCONNECTIVITY 54 62 void connectSignal(SignalType signalType, BaseObject* obj, const Executor* signal); 55 63 void disconnectSignal(SignalType signalType); 56 bool focusOverWidget(float x, float y);57 64 65 66 /// FOCUS 67 /** @brief gives focus to this widget */ 68 void giveFocus(); 69 void breakFocus(); 70 /** @returns true if the widget is focusable */ 71 bool focusable() const { return this->_focusable; }; 72 /** @param focusable sets if the Widget should be focusable */ 73 void setFocusable(bool focusable = true) { this->_focusable = focusable; }; 74 /** @returns true if the position is inside of the Widget. @param position the position to check */ 75 bool focusOverWidget(const Vector2D& position) const; 76 /** @brief overloaded function, that returns true if the cursor is on top of the Widget */ 77 bool focusOverWidget(const OrxGui::GLGuiCursor* const cursor) const; 78 79 /** @returns the currently focused Widget (NULL if none is selected) */ 80 static GLGuiWidget* focused() { return GLGuiWidget::_focused; }; 81 82 83 /// CLICK 84 void click(); 85 void release(); 86 bool clickable() const { return this->_clickable; }; 87 void setClickable(bool clickable = true) { this->_clickable = clickable; }; 58 88 59 89 virtual void update() {}; 60 90 virtual void draw() const; 61 91 92 93 /// MATERIAL (looks) 62 94 Material& backMaterial() { return this->backMat; }; 63 95 const Material& backMaterial() const { return this->backMat; }; … … 66 98 const Material& frontMaterial() const { return this->frontMat; }; 67 99 100 /** @param the Event to process. @returns true if the Event has been consumed*/ 101 virtual bool processEvent(const Event& event) { }; 102 103 104 DeclareSignal(testSignal, ()); 105 68 106 protected: 69 107 // if something was clickt on the GUI-widget. 70 virtual void clicked(const Event& event) {}; 71 virtual void released(const Event& event) {}; 108 virtual void clicked(); 109 virtual void released(); 110 virtual void receivedFocus(); 111 virtual void removedFocus(); 72 112 73 virtual void receivedFocus() {}; 74 virtual void removedFocus() {}; 75 76 virtual void destroyed() {}; 113 virtual void destroyed(); 77 114 78 115 … … 84 121 85 122 123 private: 124 /// LOOKS 125 Material backMat; 126 Rect2D backRect; 127 128 Material frontMat; 129 Rect2D frontRect; 86 130 87 131 88 protected: 89 Material backMat; 90 GLuint backModel; 132 /// SIGNALS 133 std::vector<SignalConnector> widgetSignals; 91 134 92 Material frontMat; 93 GLuint frontModel; 135 /// EVENTS 136 bool _focusable; //!< If this widget can receive focus. 137 bool _clickable; //!< if this widget can be clicked upon. 94 138 95 private: 96 std::vector<SignalConnector> widgetSignals; 139 bool _pushed; 97 140 98 bool focusable; //!< If this widget can receive focus.99 bool clickable; //!< if this widget can be clicked upon.141 static GLGuiWidget* _focused; 142 static GLGuiWidget* _inputGrabber; 100 143 }; 101 144 }
Note: See TracChangeset
for help on using the changeset viewer.