source:
orxonox.OLD/trunk/src/lib/gui/gl/glgui_button.h
@
8452
Last change on this file since 8452 was 8448, checked in by bensch, 18 years ago | |
---|---|
File size: 1.4 KB |
Rev | Line | |
---|---|---|
[4838] | 1 | /*! |
[5363] | 2 | * @file glgui_button.h |
3 | * The gl_BUTTON widget of th openglGUI | |
[5360] | 4 | * |
5 | */ | |
[1853] | 6 | |
[5363] | 7 | #ifndef _GLGUI_BUTTON_H |
8 | #define _GLGUI_BUTTON_H | |
[1853] | 9 | |
[5363] | 10 | #include "glgui_widget.h" |
[1853] | 11 | |
[7919] | 12 | #include "text.h" |
[7779] | 13 | |
14 | namespace OrxGui | |
[5363] | 15 | { |
[7779] | 16 | typedef enum |
17 | { | |
18 | Button_Active, | |
19 | Button_Inactive, | |
20 | Button_Pressed, | |
21 | Button_Released, | |
22 | Button_Activating, | |
23 | Button_Deactivating, | |
[5363] | 24 | |
[7779] | 25 | } ButtonState; |
[5363] | 26 | |
[7779] | 27 | //! This is part of the openglGUI class |
28 | /** | |
[7919] | 29 | * The Button is an Abstract class, that can be pushed to Toggle its state. |
[7779] | 30 | */ |
31 | class GLGuiButton : public GLGuiWidget | |
32 | { | |
[3543] | 33 | |
[8035] | 34 | public: |
35 | GLGuiButton(const std::string& label); | |
36 | virtual ~GLGuiButton(); | |
[3543] | 37 | |
[8115] | 38 | const std::string& label() const { return this->_label.getText(); }; |
[8035] | 39 | void setLabel(const std::string& label); |
[2036] | 40 | |
[8035] | 41 | virtual void draw() const; |
[7919] | 42 | |
[8448] | 43 | DeclareSignal0(clicked); |
[8035] | 44 | DeclareSignal0(released); |
[1853] | 45 | |
[8035] | 46 | protected: |
[8448] | 47 | virtual void updateFrontColor(); |
48 | ||
[8035] | 49 | virtual void clicking(const Vector2D& pos); |
50 | virtual void releasing(const Vector2D& pos); | |
[8115] | 51 | virtual void hiding(); |
52 | virtual void showing(); | |
[8035] | 53 | |
[8115] | 54 | /** @returns the Text. (the physical Text) */ |
55 | Text& labelText() { return this->_label; } | |
56 | /** @returns the constant Text. (the physical Text) */ | |
57 | const Text& labelText() const { return this->_label; } | |
58 | ||
[7919] | 59 | private: |
60 | void init(); | |
61 | ||
62 | ||
[8035] | 63 | private: |
[8115] | 64 | Text _label; |
[8035] | 65 | ButtonState state; |
[7779] | 66 | }; |
67 | } | |
[5360] | 68 | #endif /* _GLGUI__H */ |
Note: See TracBrowser
for help on using the repository browser.