Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | Related Pages

wftk::ToggleButton Class Reference

ToggleButton. More...

#include <togglebutton.h>

Inheritance diagram for wftk::ToggleButton:

wftk::PushButton wftk::Button wftk::SingleContainer wftk::Widget wftk::ScreenArea List of all members.

Public Member Functions

 ToggleButton (const std::string &text, const Font &font=Font::registry.find("button_font"))
 Create a ToggleButton with the given text as a label.

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 ()
 as opposed to the Button class, this does nothing

virtual void lostFocus ()
 as opposed to the Button class, this does nothing


Detailed Description

ToggleButton.

This class implements a different behavior to Button. The button stays pressed until it is clicked again. The autorepeat flag is ignored.


Constructor & Destructor Documentation

wftk::ToggleButton::ToggleButton const std::string &  text,
const Font font = Font::registry.find("button_font")
[explicit]
 

Create a ToggleButton with the given text as a label.

Parameters:
text text for the button label, defaults to empty string
font font to use for the text, defaults to "button_font"


Member Function Documentation

bool wftk::ToggleButton::buttonEvent Mouse::Button  button,
bool  pressed_val,
const Point pos
[virtual]
 

triggered when a button event happens

Parameters:
button which mouse button is producing the event
pressed_val is the button pressed or released
pos position of the cursor
Returns:
true on a handled button even, false if it's unhandled, I think

Reimplemented from wftk::Button.

bool wftk::ToggleButton::keyEvent const SDL_keysym &  sym,
bool  pressed_val
[virtual]
 

triggered when a keyboard event happens

Parameters:
sym SDL_keysym type, i.e. the key that triggered the event
pressed_val is the key pressed or released
Returns:
true on handled key even, false otherwise

Reimplemented from wftk::Button.


The documentation for this class was generated from the following files:

Generated Thu Mar 18 20:06:05 2004.
Copyright © 1998-2003 by the respective authors.

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.