diff options
author | Stijn Buys <ingar@osirion.org> | 2008-10-12 14:55:10 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-10-12 14:55:10 +0000 |
commit | b417df720584c101f3799874a0c836a543a8d0a8 (patch) | |
tree | fb7105ed662f13753a6ab8d3efb047bad04f2316 /src/ui/button.h | |
parent | 18383a5fc596bf9546f14d7393ee66c57720b116 (diff) |
user interface updates, work-in-progress
Diffstat (limited to 'src/ui/button.h')
-rw-r--r-- | src/ui/button.h | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/src/ui/button.h b/src/ui/button.h index c074467..b1bb522 100644 --- a/src/ui/button.h +++ b/src/ui/button.h @@ -10,32 +10,45 @@ #include <string> #include "ui/label.h" -namespace ui { +namespace ui +{ -class Button : public Label { +class Button : public Label +{ public: - Button (Widget *parent, const char *text=0, const char *command=0); + Button(Widget *parent, const char *text=0, const char *command=0); ~Button(); - - void set_command(std::string const &command); + + /// set the command this button will execute + void set_command(const std::string &command); + + /// set the command this button will execute void set_command(const char *command); - - inline std::string const & command() const { return button_command; } - + + /// the command this button executes + inline const std::string & command() const { + return button_command; + } + /// print button description - virtual void print(size_t indent); - - /// handle keyboard events - virtual bool keypress(unsigned int key, unsigned int modifier); - virtual bool keyrelease(unsigned int key, unsigned int modifier); - + virtual void print(const size_t indent) const; + + /// called when the mouse enters the widget + virtual void on_mouseover(const math::Vector2f &cursor); + + /// called when the widget receives a key press + virtual bool on_keypress(const int key, const unsigned int modifier); + + /// called when the widget receives a key release + virtual bool on_keyrelease(const int key, const unsigned int modifier); + protected: /// draw the button border virtual void draw_border(); - + /// draw the button text virtual void draw_text(); - + private: std::string button_command; }; |