]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/button.h
5bb2bff16e31d11aa527d3b233729a129bdf4f5d
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxButton
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 A button is a control that contains a text string, and is one of the most
13 common elements of a GUI.
15 It may be placed on a @ref wxDialog "dialog box" or on a @ref wxPanel panel,
16 or indeed on almost any other window.
20 Left-justifies the label. Windows and GTK+ only.
22 Aligns the label to the top of the button. Windows and GTK+ only.
24 Right-justifies the bitmap label. Windows and GTK+ only.
26 Aligns the label to the bottom of the button. Windows and GTK+ only.
28 Creates the button as small as possible instead of making it of the
29 standard size (which is the default behaviour ).
31 Creates a flat button. Windows and GTK+ only.
34 @beginEventEmissionTable{wxCommandEvent}
35 @event{EVT_BUTTON(id, func)}
36 Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.
41 @appearance{button.png}
45 class wxButton
: public wxControl
54 Constructor, creating and showing a button.
56 The preferred way to create standard buttons is to use default value of
57 @a label. If no label is supplied and @a id is one of standard IDs from
58 @ref page_stockitems "this list", a standard label will be used.
60 In addition to that, the button will be decorated with stock icons under GTK+ 2.
63 Parent window. Must not be @NULL.
65 Button identifier. A value of wxID_ANY indicates a default value.
67 Text to be displayed on the button.
71 Button size. If the default size is specified then the button is sized
72 appropriately for the text.
74 Window style. See wxButton class description.
80 @see Create(), wxValidator
82 wxButton(wxWindow
* parent
, wxWindowID id
,
83 const wxString
& label
= wxEmptyString
,
84 const wxPoint
& pos
= wxDefaultPosition
,
85 const wxSize
& size
= wxDefaultSize
,
87 const wxValidator
& validator
= wxDefaultValidator
,
88 const wxString
& name
= wxButtonNameStr
);
91 Destructor, destroying the button.
96 Button creation function for two-step creation.
97 For more details, see wxButton().
99 bool Create(wxWindow
* parent
, wxWindowID id
,
100 const wxString
& label
= wxEmptyString
,
101 const wxPoint
& pos
= wxDefaultPosition
,
102 const wxSize
& size
= wxDefaultSize
,
104 const wxValidator
& validator
= wxDefaultValidator
,
105 const wxString
& name
= wxButtonNameStr
);
108 Returns the default size for the buttons. It is advised to make all the dialog
109 buttons of the same size and this function allows to retrieve the (platform and
110 current font dependent size) which should be the best suited for this.
112 static wxSize
GetDefaultSize();
115 Returns the string label for the button.
119 wxString
GetLabel() const;
122 This sets the button to be the default item in its top-level window
123 (e.g. the panel or the dialog box containing it).
125 As normal, pressing return causes the default button to be depressed when
126 the return key is pressed.
128 See also wxWindow::SetFocus() which sets the keyboard focus for windows
129 and text panel items, and wxTopLevelWindow::SetDefaultItem().
131 @remarks Under Windows, only dialog box buttons respond to this function.
133 @return the old default item (possibly NULL)
135 virtual wxWindow
* SetDefault();
138 Sets the string label for the button.
143 void SetLabel(const wxString
& label
);