#include <button.hpp>
Inheritance diagram for gcn::Button:

Add an ActionListener to it to know when it has been clicked.
NOTE: You can only have text (a caption) on the button. If you want it to handle, for instance images, you can implement an ImageButton of your own and overload member functions from Button.
Definition at line 73 of file button.hpp.
Public Member Functions | |
| Button () | |
| Constructor. | |
| Button (const std::string &caption) | |
| Constructor. | |
| virtual void | setCaption (const std::string &caption) |
| Sets the Button caption. | |
| virtual const std::string & | getCaption () const |
| Gets the Button caption. | |
| virtual void | setAlignment (unsigned int alignment) |
| Sets the alignment for the caption. | |
| virtual unsigned int | getAlignment () const |
| Gets the alignment for the caption. | |
| virtual void | adjustSize () |
| Adjusts the buttons size to fit the content. | |
| virtual bool | isPressed () const |
| Checks if the button is pressed down. | |
| virtual void | draw (Graphics *graphics) |
| Draws the Widget. | |
| virtual void | drawBorder (Graphics *graphics) |
| Draws a the Widget border. | |
| virtual void | lostFocus () |
| Called if the Widget looses focus. | |
| virtual void | mouseClick (int x, int y, int button, int count) |
| Called when a mouse button is pressed and released (clicked) when the mouse is in the Widget area or if the Widget has focus. | |
| virtual void | mousePress (int x, int y, int button) |
| Called when a mouse button is pressed when the mouse is in the Widget area or if the Widget has focus. | |
| virtual void | mouseRelease (int x, int y, int button) |
| Called when a mouse button is released when the mouse is in the Widget area or if the Widget has focus. | |
| virtual void | keyPress (const Key &key) |
| Called if a key is pressed when the widget has keyboard focus. | |
| virtual void | keyRelease (const Key &key) |
| Called if a key is released when the widget has keyboard focus. | |
Protected Attributes | |
| std::string | mCaption |
| bool | mMouseDown |
| bool | mKeyDown |
| unsigned int | mAlignment |
|
|
Constructor.
Definition at line 74 of file button.cpp. References gcn::Widget::addKeyListener(), gcn::Widget::addMouseListener(), adjustSize(), gcn::Widget::setBorderSize(), and gcn::Widget::setFocusable(). |
|
|
Draws the Widget. It is called by the parent widget when it is time for the Widget to draw itself. The graphics object is set up so that all drawing is relative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not porelative to the |