Wt: Wt::WAbstractToggleButton Class Reference

Wt 3.3.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions
Wt::WAbstractToggleButton Class Reference

An abstract base class for radio buttons and check boxes. More...

Inheritance diagram for Wt::WAbstractToggleButton:
[legend]

List of all members.

## Public Member Functions
virtual | ~WAbstractToggleButton ()
| Destructor.
void | setText (const WString &text)
| Sets the label text.
const WString | text () const
| Returns the label text.
bool | isChecked () const
| Returns the button state.
void | setChecked (bool checked)
| Sets the button state.
virtual void | setChecked ()
| Checks the button.
virtual void | setUnChecked ()
| Unchecks the button.
virtual WString | valueText () const
| Returns the current value.
virtual void | setValueText (const WString &text)
| Sets the current value.
EventSignal & | checked ()
| Signal emitted when the button gets checked.
EventSignal & | unChecked ()
| Signal emitted when the button gets un-checked.
## Protected Member Functions
| WAbstractToggleButton (WContainerWidget *parent=0)
| Creates an unchecked toggle button without label.
| WAbstractToggleButton (const WString &text, WContainerWidget *parent=0)
| Creates an unchecked toggle button with given text label.
virtual WStatelessSlot * | getStateless (Method method)
| On-demand stateless slot implementation.

## Detailed Description

An abstract base class for radio buttons and check boxes.

A toggle button provides a button with a boolean state (checked or unchecked), and a text label.

To act on a change of the state, either connect a slot to the changed() signal, or connect a slot to the checked() or unChecked() signals.

The current state (checked or unchecked) may be inspected using the isChecked() method.

## Constructor & Destructor Documentation

Wt::WAbstractToggleButton::WAbstractToggleButton | ( | const WString & | text,
|  | WContainerWidget * | parent = `0`
| ) |  | `[protected]`

Creates an unchecked toggle button with given text label.

The text label is rendered to the right side of the button.

## Member Function Documentation

EventSignal & Wt::WAbstractToggleButton::checked | ( |  | ) |

Signal emitted when the button gets checked.

This signal is emitted when the user checks the button.

You can use the changed() signal to react to any change of the button state.

WStatelessSlot * Wt::WAbstractToggleButton::getStateless | ( | Method | method | ) | `[protected, virtual]`

On-demand stateless slot implementation.

This method returns a stateless slot implementation for the given `method`. To avoid the cost of declaring methods to be stateless when they are not used, you may reimplement this method to provide a stateless implementation for a method only when the method is involved in a slot connection.

Use implementStateless() to provide a stateless implementation of the given `method`, or return the base class implementation otherwise.

Reimplemented from Wt::WFormWidget.

bool Wt::WAbstractToggleButton::isChecked | ( |  | ) | const

Returns the button state.

See also:
  setChecked()

void Wt::WAbstractToggleButton::setChecked | ( | bool | checked | ) |

Sets the button state.

This method does not emit one of the checked() or unChecked() signals.

See also:
  setChecked(), setUnChecked()

void Wt::WAbstractToggleButton::setChecked | ( |  | ) | `[virtual]`

Checks the button.

Does not emit the checked() signal.

See also:
  setChecked(bool)

void Wt::WAbstractToggleButton::setText | ( | const WString & | text | ) |

Sets the label text.

The label is rendered to the right of the button.

void Wt::WAbstractToggleButton::setUnChecked | ( |  | ) | `[virtual]`

Unchecks the button.

Does not emit the unChecked() signal.

See also:
  setChecked(bool)

void Wt::WAbstractToggleButton::setValueText | ( | const WString & | text | ) | `[virtual]`

Sets the current value.

This interprets text values of "yes", "maybe" or "no".

Implements Wt::WFormWidget.

const WString Wt::WAbstractToggleButton::text | ( |  | ) | const

Returns the label text.

See also:
  setText()

EventSignal & Wt::WAbstractToggleButton::unChecked | ( |  | ) |

Signal emitted when the button gets un-checked.

This signal is emitted when the user unchecks the button.

You can use the changed() signal to react to any change of the button state.

WString Wt::WAbstractToggleButton::valueText | ( |  | ) | const`[virtual]`

Returns the current value.

Returns "yes" when checked, "maybe" when partially checked, and "no" when unchecked.

Implements Wt::WFormWidget.

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator