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

Public Member Functions | |
| virtual | ~WAbstractToggleButton () |
| Destructor. | |
| void | setText (const WString &text) |
| Sets the label text. | |
| const WString | text () const |
| Returns the label text. | |
| bool | setTextFormat (TextFormat format) |
| Sets the text format. | |
| TextFormat | textFormat () const |
| Returns the text format. | |
| 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. | |
| virtual void | refresh () |
| Refresh the widget. | |
| void | setWordWrap (bool wordWrap) |
| Configures word wrapping. | |
| bool | wordWrap () const |
| Returns whether word wrapping is on. | |
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. | |
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.
| 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.
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::WWebWidget.
| bool Wt::WAbstractToggleButton::isChecked | ( | ) | const |
Returns the button state.
| void Wt::WAbstractToggleButton::refresh | ( | ) | [virtual] |
Refresh the widget.
The refresh method is invoked when the locale is changed using WApplication::setLocale() or when the user hit the refresh button.
The widget must actualize its contents in response.
Reimplemented from Wt::WFormWidget.
| void Wt::WAbstractToggleButton::setChecked | ( | bool | checked | ) |
Sets the button state.
This method does not emit one of the checked() or unChecked() signals.
| void Wt::WAbstractToggleButton::setChecked | ( | ) | [virtual] |
| void Wt::WAbstractToggleButton::setText | ( | const WString & | text | ) |
Sets the label text.
The label is rendered to the right of the button.
| bool Wt::WAbstractToggleButton::setTextFormat | ( | TextFormat | format | ) |
Sets the text format.
The textFormat controls how the string should be interpreted: either as plain text, which is displayed literally, or as XHTML-markup.
When changing the textFormat to Wt::XHTMLText, and the current text is literal (not created using WString::tr()), the current text is parsed using an XML parser which discards malicious tags and attributes silently. When the parser encounters an XML parse error, the textFormat is left unchanged, and this method returns false.
Returns whether the textFormat could be set for the current text.
The default format is Wt::PlainText.
| void Wt::WAbstractToggleButton::setUnChecked | ( | ) | [virtual] |
| void Wt::WAbstractToggleButton::setValueText | ( | const WString & | text | ) | [virtual] |
Sets the current value.
This interprets text values of "yes", "maybe" or "no".
Implements Wt::WFormWidget.
| void Wt::WAbstractToggleButton::setWordWrap | ( | bool | wordWrap | ) |
Configures word wrapping.
When wordWrap is true, the widget may break lines, creating a multi-line text. When wordWrap is false, the text will displayed on a single line, unless the text contains end-of-lines (for Wt::PlainText) or <br /> tags or other block-level tags (for Wt::XHTMLText).
The default value is false.
| const WString Wt::WAbstractToggleButton::text | ( | ) | const |
Returns the label text.
Returns the text format.
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.
| bool Wt::WAbstractToggleButton::wordWrap | ( | ) | const |
Returns whether word wrapping is on.
1.7.6.1