]>
git.saurik.com Git - wxWidgets.git/blob - interface/button.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxButton
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 A button is a control that contains a text string, and is one of the most
14 common elements of a GUI.
16 It may be placed on a @ref wxDialog "dialog box" or on a @ref wxPanel panel,
17 or indeed on almost any other window.
21 Left-justifies the label. Windows and GTK+ only.
23 Aligns the label to the top of the button. Windows and GTK+ only.
25 Right-justifies the bitmap label. Windows and GTK+ only.
27 Aligns the label to the bottom of the button. Windows and GTK+ only.
29 Creates the button as small as possible instead of making it of the
30 standard size (which is the default behaviour ).
32 Creates a flat button. Windows and GTK+ only.
35 @beginEventTable{wxCommandEvent}
36 @event{EVT_BUTTON(id, func)}
37 Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.
42 <!-- @appearance{button.png} -->
46 class wxButton
: public wxControl
55 Constructor, creating and showing a button.
57 The preferred way to create standard buttons is to use default value of
58 @a label. If no label is supplied and @a id is one of standard IDs from
59 @ref page_stockitems "this list", a standard label will be used.
61 In addition to that, the button will be decorated with stock icons under GTK+ 2.
64 Parent window. Must not be @NULL.
66 Button identifier. A value of wxID_ANY indicates a default value.
68 Text to be displayed on the button.
72 Button size. If the default size is specified then the button is sized
73 appropriately for the text.
75 Window style. See wxButton class description.
81 @see Create(), wxValidator
83 wxButton(wxWindow
* parent
, wxWindowID id
,
84 const wxString
& label
= wxEmptyString
,
85 const wxPoint
& pos
= wxDefaultPosition
,
86 const wxSize
& size
= wxDefaultSize
,
88 const wxValidator
& validator
= wxDefaultValidator
,
89 const wxString
& name
= wxButtonNameStr
);
92 Destructor, destroying the button.
97 Button creation function for two-step creation.
98 For more details, see wxButton().
100 bool Create(wxWindow
* parent
, wxWindowID id
,
101 const wxString
& label
= wxEmptyString
,
102 const wxPoint
& pos
= wxDefaultPosition
,
103 const wxSize
& size
= wxDefaultSize
,
105 const wxValidator
& validator
= wxDefaultValidator
,
106 const wxString
& name
= wxButtonNameStr
);
109 Returns the default size for the buttons. It is advised to make all the dialog
110 buttons of the same size and this function allows to retrieve the (platform and
111 current font dependent size) which should be the best suited for this.
113 static wxSize
GetDefaultSize();
116 Returns the string label for the button.
120 wxString
GetLabel() const;
123 This sets the button to be the default item in its top-level window
124 (e.g. the panel or the dialog box containing it).
126 As normal, pressing return causes the default button to be depressed when
127 the return key is pressed.
129 See also wxWindow::SetFocus() which sets the keyboard focus for windows
130 and text panel items, and wxTopLevelWindow::SetDefaultItem().
132 @remarks Under Windows, only dialog box buttons respond to this function.
134 @return the old default item (possibly NULL)
136 virtual wxWindow
* SetDefault();
139 Sets the string label for the button.
144 void SetLabel(const wxString
& label
);