Wt
3.3.8
|
A class for grouping radio buttons logically together. More...
#include <Wt/WButtonGroup>
Public Member Functions | |
WButtonGroup (WObject *parent=0) | |
Creates a new empty button group. | |
~WButtonGroup () | |
Destructor. More... | |
void | addButton (WRadioButton *button, int id=-1) |
Adds a radio button to the group. More... | |
void | addButton (Ext::RadioButton *button, int id=-1) |
Adds a radio button to the group. More... | |
void | removeButton (WRadioButton *button) |
Removes a radio button from the group. More... | |
void | removeButton (Ext::RadioButton *button) |
Removes a radio button from the group. More... | |
WRadioButton * | button (int id) const |
Returns the button for the given id. More... | |
int | id (WRadioButton *button) const |
Returns the id for the given button. More... | |
virtual const std::string | id () const |
Returns the (unique) identifier for this object. More... | |
std::vector< WRadioButton * > | buttons () const |
Returns the buttons in this group. | |
int | count () const |
Returns the number of radiobuttons in this group. | |
int | checkedId () const |
Returns the id of the checked button. More... | |
void | setCheckedButton (WRadioButton *button) |
Sets the currently checked radiobutton. More... | |
WRadioButton * | checkedButton () const |
Returns the checked radiobutton. More... | |
void | setSelectedButtonIndex (int idx) |
Sets the currently checked radiobutton. More... | |
int | selectedButtonIndex () const |
Returns the index of the checked radiobutton. More... | |
Signal< WRadioButton * > & | checkedChanged () |
Signal emitted when a button was checked. More... | |
Public Member Functions inherited from Wt::WObject | |
WObject (WObject *parent=0) | |
Create a WObject with a given parent object. More... | |
virtual | ~WObject () |
Destructor. More... | |
virtual void | setObjectName (const std::string &name) |
Sets an object name. More... | |
virtual std::string | objectName () const |
Returns the object name. More... | |
void | resetLearnedSlots () |
Resets learned stateless slot implementations. More... | |
template<class T > | |
void | resetLearnedSlot (void(T::*method)()) |
Resets a learned stateless slot implementation. More... | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)()) |
Declares a slot to be stateless and learn client-side behaviour on first invocation. More... | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)(), void(T::*undoMethod)()) |
Declares a slot to be stateless and learn client-side behaviour in advance. More... | |
void | isNotStateless () |
Marks the current function as not stateless. More... | |
template<class T > | |
WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode) |
Provides a JavaScript implementation for a method. More... | |
void | addChild (WObject *child) |
Adds a child object. More... | |
virtual void | removeChild (WObject *child) |
Removes a child object. More... | |
const std::vector< WObject * > & | children () const |
Returns the children. | |
WObject * | parent () const |
Returns the parent object. | |
Additional Inherited Members | |
Public Types inherited from Wt::WObject | |
typedef void(WObject::* | Method) () |
Typedef for a WObject method without arguments. | |
Protected Member Functions inherited from Wt::WObject | |
virtual WStatelessSlot * | getStateless (Method method) |
On-demand stateless slot implementation. More... | |
Static Protected Member Functions inherited from Wt::WObject | |
static WObject * | sender () |
Returns the sender of the current slot call. More... | |
A class for grouping radio buttons logically together.
A button group manages a set of radio buttons, making them exclusive of each other.
It is not a widget, but instead provides only a logical grouping. Radio buttons are aware of the group in which they have been added, see WRadioButton::group(). When a button is deleted, it is automatically removed its button group.
It allows you to associate id's with each button, which you may use to identify a particular button. The special value of -1 is reserved to indicate no button.
Usage example:
Wt::WButtonGroup::~WButtonGroup | ( | ) |
Destructor.
This does not delete the radio buttons, but simply removes them from the group.
void Wt::WButtonGroup::addButton | ( | WRadioButton * | button, |
int | id = -1 |
||
) |
Adds a radio button to the group.
You can assign an id to the button. If id
is -1, then a unique id will be generated.
void Wt::WButtonGroup::addButton | ( | Ext::RadioButton * | button, |
int | id = -1 |
||
) |
Adds a radio button to the group.
You can assign an id to the button. If id
is -1, then a unique id will be generated.
WRadioButton * Wt::WButtonGroup::button | ( | int | id | ) | const |
Returns the button for the given id.
WRadioButton * Wt::WButtonGroup::checkedButton | ( | ) | const |
Returns the checked radiobutton.
If there is no radiobutton currently checked this function returns 0
.
Signal< WRadioButton * > & Wt::WButtonGroup::checkedChanged | ( | ) |
Signal emitted when a button was checked.
The argument passed is the new checkedButton().
int Wt::WButtonGroup::checkedId | ( | ) | const |
Returns the id of the checked button.
Returns the id of the currently checked button, or -1 if no button is currently checked.
int Wt::WButtonGroup::id | ( | WRadioButton * | button | ) | const |
Returns the id for the given button.
|
virtual |
Returns the (unique) identifier for this object.
For a WWidget, this corresponds to the id of the DOM element that represents the widget. This is not entirely unique, since a composite widget shares the same id as its implementation.
By default, the id is auto-generated, unless a custom id is set for a widget using WWidget::setId(). The auto-generated id is created by concatenating objectName() with a unique number.
Reimplemented from Wt::WObject.
void Wt::WButtonGroup::removeButton | ( | WRadioButton * | button | ) |
Removes a radio button from the group.
void Wt::WButtonGroup::removeButton | ( | Ext::RadioButton * | button | ) |
Removes a radio button from the group.
int Wt::WButtonGroup::selectedButtonIndex | ( | ) | const |
Returns the index of the checked radiobutton.
The index reflects the order in which the buttons have been added to the button group. Use checkedId() if you want to know the id of the button that is currently checked. If there is no radiobutton selected this function returns -1.
void Wt::WButtonGroup::setCheckedButton | ( | WRadioButton * | button | ) |
Sets the currently checked radiobutton.
The button button
of this group is checked. A value of 0
will uncheck all radiobuttons.
Initially, no button is checked.
void Wt::WButtonGroup::setSelectedButtonIndex | ( | int | idx | ) |
Sets the currently checked radiobutton.
Sets the idx'th
radiobutton checked. A value of -1 will uncheck all radiobuttons.
Initially, no button is checked.