#include <wx/button.h>
It may be placed on a dialog box or on a wxPanel panel, or indeed on almost any other window.
This class supports the following styles:
The following event handler macros redirect the events to member function handlers 'func' with prototypes like:
![]() | ![]() | ![]() |
wxMSW appearance | wxGTK appearance | wxMac appearance |
Public Member Functions | |
wxButton () | |
Default ctor. | |
wxButton (wxWindow *parent, wxWindowID id, const wxString &label=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxButtonNameStr) | |
Constructor, creating and showing a button. | |
virtual | ~wxButton () |
Destructor, destroying the button. | |
bool | Create (wxWindow *parent, wxWindowID id, const wxString &label=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxButtonNameStr) |
Button creation function for two-step creation. | |
wxString | GetLabel () const |
Returns the string label for the button. | |
virtual wxWindow * | SetDefault () |
This sets the button to be the default item in its top-level window (e.g. | |
void | SetLabel (const wxString &label) |
Sets the string label for the button. | |
Static Public Member Functions | |
static wxSize | GetDefaultSize () |
Returns the default size for the buttons. |
wxButton::wxButton | ( | ) |
Default ctor.
wxButton::wxButton | ( | wxWindow * | parent, | |
wxWindowID | id, | |||
const wxString & | label = wxEmptyString , |
|||
const wxPoint & | pos = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
long | style = 0 , |
|||
const wxValidator & | validator = wxDefaultValidator , |
|||
const wxString & | name = wxButtonNameStr | |||
) |
Constructor, creating and showing a button.
The preferred way to create standard buttons is to use default value of label. If no label is supplied and id is one of standard IDs from this list, a standard label will be used.
In addition to that, the button will be decorated with stock icons under GTK+ 2.
parent | Parent window. Must not be NULL. | |
id | Button identifier. A value of wxID_ANY indicates a default value. | |
label | Text to be displayed on the button. | |
pos | Button position. | |
size | Button size. If the default size is specified then the button is sized appropriately for the text. | |
style | Window style. See wxButton class description. | |
validator | Window validator. | |
name | Window name. |
virtual wxButton::~wxButton | ( | ) | [virtual] |
Destructor, destroying the button.
bool wxButton::Create | ( | wxWindow * | parent, | |
wxWindowID | id, | |||
const wxString & | label = wxEmptyString , |
|||
const wxPoint & | pos = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
long | style = 0 , |
|||
const wxValidator & | validator = wxDefaultValidator , |
|||
const wxString & | name = wxButtonNameStr | |||
) |
Button creation function for two-step creation.
For more details, see wxButton().
static wxSize wxButton::GetDefaultSize | ( | ) | [static] |
Returns the default size for the buttons.
It is advised to make all the dialog buttons of the same size and this function allows to retrieve the (platform and current font dependent size) which should be the best suited for this.
wxString wxButton::GetLabel | ( | ) | const [virtual] |
virtual wxWindow* wxButton::SetDefault | ( | ) | [virtual] |
This sets the button to be the default item in its top-level window (e.g.
the panel or the dialog box containing it).
As normal, pressing return causes the default button to be depressed when the return key is pressed.
See also wxWindow::SetFocus() which sets the keyboard focus for windows and text panel items, and wxTopLevelWindow::SetDefaultItem().
void wxButton::SetLabel | ( | const wxString & | label | ) | [virtual] |
Sets the string label for the button.
label | The label to set. |
Reimplemented from wxControl.
![]() |
[ top ] |