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