#include <button.h>
Inheritance diagram for wftk::Button:

Public Member Functions | |
| Button (const std::string &text, const Font &font=Font::registry.find("button_font")) | |
| Explicit Constructor. | |
| void | press () |
| press the button by calling a function | |
| void | release () |
| release the button by calling a function | |
| void | repeat () |
| repeat the click on the button | |
| void | toggle () |
| toggle the button, i.e. | |
| bool | isPressed () const |
| check if the button is pressed right now | |
| void | setRepeat (unsigned repeat=100) |
| set the repeat interval | |
| void | setRepeat (bool repeat) |
| turn repeating on or off | |
| virtual bool | buttonEvent (Mouse::Button button, bool pressed_val, const Point &pos) |
| triggered when a button event happens | |
| virtual bool | keyEvent (const SDL_keysym &sym, bool pressed_val) |
| triggered when a keyboard event happens | |
| virtual void | lostMouse () |
| called if the user moves the mouse off the button after pressing it | |
| virtual void | lostFocus () |
| called if the window loses focus | |
Public Attributes | |
| ButtonSignal | pressed |
| SigC signal triggered when button is pressed, also plays the named Sample "press". | |
| ButtonSignal | released |
| SigC signal triggered when button is released, also plays the named Sample "release". | |
| ButtonSignal | clicked |
| SigC signal triggered when button is clicked. | |
| wftk::Button::Button | ( | const std::string & | text, | |
| const Font & | font = Font::registry.find("button_font") | |||
| ) | [explicit] |
Explicit Constructor.
This creates a Button type object. It's not really inteded to be used as standalone object, but it's a parent for other buttons, eg. the PushButton class.
| text | the text the button should have, defaults to an empty string | |
| font | the font the button text should have, defaults to button_font |
| void wftk::Button::press | ( | ) |
press the button by calling a function
This is used if the programmer for some reason needs to press a button without the user doing so
| void wftk::Button::release | ( | ) |
release the button by calling a function
This is used to release a key without user input (e.g. for unsetting buttons in a radio-button group)
| void wftk::Button::repeat | ( | ) |
repeat the click on the button
This is called if the the click needs to be repeated.
| void wftk::Button::toggle | ( | ) |
toggle the button, i.e.
set it to pressed if it isn't, and vice versa
| bool wftk::Button::isPressed | ( | ) | const [inline] |
check if the button is pressed right now
| void wftk::Button::setRepeat | ( | unsigned | repeat = 100 |
) |
set the repeat interval
| repeat | new interval in ms, 0 turns of repeating |
| void wftk::Button::setRepeat | ( | bool | repeat | ) |
turn repeating on or off
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| repeat | true to turn on repeating, false to turn it off |
| bool wftk::Button::buttonEvent | ( | Mouse::Button | button, | |
| bool | pressed_val, | |||
| const Point & | pos | |||
| ) | [virtual] |
triggered when a button event happens
| button | which mouse button is producing the event | |
| pressed_val | is the button pressed or released | |
| pos | position of the cursor (I think) |
Reimplemented from wftk::Widget.
Reimplemented in wftk::ToggleButton.
| bool wftk::Button::keyEvent | ( | const SDL_keysym & | sym, | |
| bool | pressed_val | |||
| ) | [virtual] |
triggered when a keyboard event happens
| sym | SDL_keysym type, i.e. the key that triggered the event | |
| pressed_val | is the key pressed or released |
Reimplemented from wftk::Widget.
Reimplemented in wftk::ToggleButton.
| void wftk::Button::lostMouse | ( | ) | [virtual] |
called if the user moves the mouse off the button after pressing it
it unsets the pressed state of the button and triggers a released signal
Reimplemented from wftk::ScreenArea.
Reimplemented in wftk::ToggleButton.
| virtual void wftk::Button::lostFocus | ( | ) | [inline, virtual] |
called if the window loses focus
It unsets the pressed state without triggering a released signal
Reimplemented from wftk::Widget.
Reimplemented in wftk::ToggleButton.
This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.