Wt
3.2.2
|
Abstract base class for a (toolbar) button or menu item. More...
#include <Wt/Ext/AbstractButton>
Public Member Functions | |
void | setText (const WString &text) |
Set the item text. | |
const WString & | text () const |
Get the item text. | |
void | setIcon (const std::string &path) |
Set the item icon path. | |
const std::string & | icon () const |
Get the item icon path. | |
void | setCheckable (bool how) |
Set if the item is checkable. | |
bool | isCheckable () const |
Return if the item is checkable. | |
void | setMenu (Menu *menu) |
Set a menu that popups up when the item is activated. | |
void | setChecked (bool how) |
Change the checked state. | |
bool | isChecked () const |
Get the checked state. | |
void | configureToolTip (ToolTipConfig *config) |
Configure the tool tip associated with this item. | |
JSignal & | activated () |
Signal emitted when a item gets activated. | |
JSignal< bool > & | toggled () |
Signal emitted when a item gets toggled. | |
virtual void | refresh () |
Refresh the widget. |
Abstract base class for a (toolbar) button or menu item.
You may set the button text using setText() and icon use setIcon(), and configure whether the button/menu item can be checked or toggled using setCheckable().
To respond to a click, you can connect to the activated() signal, and for a checkable button/item you may listen to the toggled() signal.
JSignal& Wt::Ext::AbstractButton::activated | ( | ) |
Signal emitted when a item gets activated.
This signal is emitted for non-checkable items (for who isCheckable() == false), when the user activates the item (by clicking it).
void Wt::Ext::AbstractButton::configureToolTip | ( | ToolTipConfig * | config | ) |
Configure the tool tip associated with this item.
If the config has no parent, then ownership is transferred to this widget.
void Wt::Ext::AbstractButton::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::WWebWidget.
void Wt::Ext::AbstractButton::setChecked | ( | bool | how | ) |
Change the checked state.
This is only used when the isCheckable() == true.
JSignal<bool>& Wt::Ext::AbstractButton::toggled | ( | ) |
Signal emitted when a item gets toggled.
This signal is emitted for checkable items (for who isCheckable() == false), when the user changed toggles the item state. The new state is passed as a parameter value.