]> git.saurik.com Git - wxWidgets.git/blame - interface/button.h
further prototype revisions; rename interface/aui.h to interface/framemanager.h since...
[wxWidgets.git] / interface / button.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: button.h
e54c96f1 3// Purpose: interface of wxButton
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxButton
11 @wxheader{button.h}
7c913512 12
8024723d
FM
13 A button is a control that contains a text string, and is one of the most
14 common elements of a GUI.
15
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.
7c913512 18
23324ae1
FM
19 @beginStyleTable
20 @style{wxBU_LEFT}:
21 Left-justifies the label. Windows and GTK+ only.
22 @style{wxBU_TOP}:
23 Aligns the label to the top of the button. Windows and GTK+ only.
24 @style{wxBU_RIGHT}:
25 Right-justifies the bitmap label. Windows and GTK+ only.
26 @style{wxBU_BOTTOM}:
27 Aligns the label to the bottom of the button. Windows and GTK+ only.
28 @style{wxBU_EXACTFIT}:
29 Creates the button as small as possible instead of making it of the
30 standard size (which is the default behaviour ).
31 @style{wxBORDER_NONE}:
32 Creates a flat button. Windows and GTK+ only.
33 @endStyleTable
7c913512 34
23324ae1 35 @beginEventTable
4cc4bfaf 36 @event{EVT_BUTTON(id, func)}:
8024723d 37 Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.
23324ae1 38 @endEventTable
7c913512 39
23324ae1
FM
40 @library{wxcore}
41 @category{ctrl}
42 @appearance{button.png}
7c913512 43
e54c96f1 44 @see wxBitmapButton
23324ae1
FM
45*/
46class wxButton : public wxControl
47{
48public:
8024723d
FM
49 /**
50 Default ctor.
51 */
52 wxButton();
53
23324ae1
FM
54 /**
55 Constructor, creating and showing a button.
8024723d 56
23324ae1 57 The preferred way to create standard buttons is to use default value of
8024723d
FM
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.
60
61 In addition to that, the button will be decorated with stock icons under GTK+ 2.
62
7c913512 63 @param parent
4cc4bfaf 64 Parent window. Must not be @NULL.
7c913512 65 @param id
4cc4bfaf 66 Button identifier. A value of wxID_ANY indicates a default value.
7c913512 67 @param label
4cc4bfaf 68 Text to be displayed on the button.
7c913512 69 @param pos
4cc4bfaf 70 Button position.
7c913512 71 @param size
4cc4bfaf
FM
72 Button size. If the default size is specified then the button is sized
73 appropriately for the text.
7c913512 74 @param style
8024723d 75 Window style. See wxButton class description.
7c913512 76 @param validator
4cc4bfaf 77 Window validator.
7c913512 78 @param name
4cc4bfaf 79 Window name.
8024723d 80
4cc4bfaf 81 @see Create(), wxValidator
23324ae1 82 */
7c913512
FM
83 wxButton(wxWindow* parent, wxWindowID id,
84 const wxString& label = wxEmptyString,
85 const wxPoint& pos = wxDefaultPosition,
86 const wxSize& size = wxDefaultSize,
87 long style = 0,
88 const wxValidator& validator = wxDefaultValidator,
89 const wxString& name = "button");
23324ae1
FM
90
91 /**
92 Destructor, destroying the button.
93 */
94 ~wxButton();
95
96 /**
8024723d
FM
97 Button creation function for two-step creation.
98 For more details, see wxButton().
23324ae1
FM
99 */
100 bool Create(wxWindow* parent, wxWindowID id,
101 const wxString& label = wxEmptyString,
102 const wxPoint& pos = wxDefaultPosition,
103 const wxSize& size = wxDefaultSize,
104 long style = 0,
105 const wxValidator& validator,
106 const wxString& name = "button");
107
108 /**
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.
112 */
113 wxSize GetDefaultSize();
114
115 /**
116 Returns the string label for the button.
8024723d 117
4cc4bfaf 118 @see SetLabel()
23324ae1 119 */
328f5751 120 wxString GetLabel() const;
23324ae1
FM
121
122 /**
8024723d
FM
123 This sets the button to be the default item for the panel or dialog box.
124
125 As normal, pressing return causes the default button to be depressed when
126 the return key is pressed.
127
128 See also wxWindow::SetFocus() which sets the keyboard focus for windows
129 and text panel items, and wxTopLevelWindow::SetDefaultItem().
130
23324ae1 131 @remarks Under Windows, only dialog box buttons respond to this function.
23324ae1
FM
132 */
133 void SetDefault();
134
135 /**
136 Sets the string label for the button.
8024723d 137
7c913512 138 @param label
4cc4bfaf 139 The label to set.
23324ae1
FM
140 */
141 void SetLabel(const wxString& label);
142};
e54c96f1 143