A widget that represents a push button. More...
#include <Wt/WPushButton>
Inherits Wt::WFormWidget.
Public Member Functions | |
WPushButton (WContainerWidget *parent=0) | |
Creates a push button. | |
WPushButton (const WString &text, WContainerWidget *parent=0) | |
Creates a push button with given label text. | |
void | setText (const WString &text) |
Sets the button text. | |
const WString & | text () const |
Returns the button text. | |
void | setIcon (const std::string &url) |
Sets an icon. | |
const std::string & | icon () const |
Returns the icon. | |
virtual void | refresh () |
Refresh the widget. |
A widget that represents a push button.
To act on a button click, connect a slot to the clicked() signal.
Usage example:
Wt::WPushButton *ok = new Wt::WPushButton("Okay"); ok->clicked().connect(SLOT(ok, Wt::WPushButton::disable)); ok->clicked().connect(SLOT(this, MyClass::processData));
WPushButton is an inline widget.
The widget corresponds to the HTML <button>
tag and has the Wt-btn
style. It may be styled through the current theme, or you can override the style using internal or external CSS as appropriate.
const std::string& Wt::WPushButton::icon | ( | ) | const [inline] |
Returns the icon.
void Wt::WPushButton::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::WPushButton::setIcon | ( | const std::string & | url | ) |
Sets an icon.
The icon is placed to the left of the text.