]> git.saurik.com Git - wxWidgets.git/blame - interface/radiobox.h
Replaced @returns with @return for more standard command use and compatibility.
[wxWidgets.git] / interface / radiobox.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: radiobox.h
e54c96f1 3// Purpose: interface of wxRadioBox
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxRadioBox
11 @wxheader{radiobox.h}
7c913512 12
23324ae1
FM
13 A radio box item is used to select one of number of mutually exclusive
14 choices. It is displayed as a vertical column or horizontal row of
15 labelled buttons.
7c913512 16
23324ae1 17 @beginStyleTable
8c6791e4 18 @style{wxRA_SPECIFY_ROWS}
23324ae1 19 The major dimension parameter refers to the maximum number of rows.
8c6791e4 20 @style{wxRA_SPECIFY_COLS}
23324ae1
FM
21 The major dimension parameter refers to the maximum number of
22 columns.
8c6791e4 23 @style{wxRA_USE_CHECKBOX}
23324ae1
FM
24 Use of the checkbox controls instead of radio buttons (currently
25 supported only on PalmOS)
26 @endStyleTable
7c913512 27
1f1d2182 28 @beginEventTable{wxCommandEvent}
8c6791e4 29 @event{EVT_RADIOBOX(id, func)}
3ed3a1c8 30 Process a @c wxEVT_COMMAND_RADIOBOX_SELECTED event, when a radiobutton
23324ae1
FM
31 is clicked.
32 @endEventTable
7c913512 33
23324ae1
FM
34 @library{wxcore}
35 @category{ctrl}
0c7fe6f2 36 <!-- @appearance{radiobox.png} -->
7c913512 37
1f1d2182 38 @see @ref overview_eventhandling, wxRadioButton, wxCheckBox
23324ae1 39*/
bf84f3e2 40class wxRadioBox : public wxControl, wxItemContainerImmutable
23324ae1
FM
41{
42public:
3ed3a1c8
BP
43
44 /**
45 Default constructor.
46
47 @see Create(), wxValidator
48 */
49 wxRadioBox();
50
23324ae1
FM
51 /**
52 Constructor, creating and showing a radiobox.
3c4f71cc 53
7c913512 54 @param parent
4cc4bfaf 55 Parent window. Must not be @NULL.
7c913512 56 @param id
3ed3a1c8 57 Window identifier. The value @c wxID_ANY indicates a default value.
7c913512 58 @param label
4cc4bfaf 59 Label for the static box surrounding the radio buttons.
7c913512 60 @param pos
3ed3a1c8
BP
61 Window position. If @c wxDefaultPosition is specified then a
62 default position is chosen.
7c913512 63 @param size
3ed3a1c8
BP
64 Window size. If @c wxDefaultSize is specified then a default size
65 is chosen.
7c913512 66 @param n
4cc4bfaf 67 Number of choices with which to initialize the radiobox.
7c913512 68 @param choices
4cc4bfaf 69 An array of choices with which to initialize the radiobox.
7c913512 70 @param majorDimension
3ed3a1c8
BP
71 Specifies the maximum number of rows (if style contains
72 @c wxRA_SPECIFY_ROWS) or columns (if style contains
73 @c wxRA_SPECIFY_COLS) for a two-dimensional radiobox.
7c913512 74 @param style
4cc4bfaf 75 Window style. See wxRadioBox.
7c913512 76 @param validator
4cc4bfaf 77 Window validator.
7c913512 78 @param name
4cc4bfaf 79 Window name.
3c4f71cc 80
4cc4bfaf 81 @see Create(), wxValidator
23324ae1 82 */
7c913512
FM
83 wxRadioBox(wxWindow* parent, wxWindowID id,
84 const wxString& label,
3ed3a1c8 85 const wxPoint& pos = wxDefaultPosition,
7c913512
FM
86 const wxSize& size = wxDefaultSize,
87 int n = 0,
4cc4bfaf 88 const wxString choices[] = NULL,
7c913512
FM
89 int majorDimension = 0,
90 long style = wxRA_SPECIFY_COLS,
91 const wxValidator& validator = wxDefaultValidator,
92 const wxString& name = "radioBox");
3ed3a1c8
BP
93
94 /**
95 Constructor, creating and showing a radiobox.
96
97 @param parent
98 Parent window. Must not be @NULL.
99 @param id
100 Window identifier. The value @c wxID_ANY indicates a default value.
101 @param label
102 Label for the static box surrounding the radio buttons.
103 @param pos
104 Window position. If @c wxDefaultPosition is specified then a
105 default position is chosen.
106 @param size
107 Window size. If @c wxDefaultSize is specified then a default size
108 is chosen.
109 @param choices
110 An array of choices with which to initialize the radiobox.
111 @param majorDimension
112 Specifies the maximum number of rows (if style contains
113 @c wxRA_SPECIFY_ROWS) or columns (if style contains
114 @c wxRA_SPECIFY_COLS) for a two-dimensional radiobox.
115 @param style
116 Window style. See wxRadioBox.
117 @param validator
118 Window validator.
119 @param name
120 Window name.
121
122 @see Create(), wxValidator
123 */
7c913512
FM
124 wxRadioBox(wxWindow* parent, wxWindowID id,
125 const wxString& label,
3ed3a1c8 126 const wxPoint& pos,
7c913512
FM
127 const wxSize& size,
128 const wxArrayString& choices,
129 int majorDimension = 0,
130 long style = wxRA_SPECIFY_COLS,
131 const wxValidator& validator = wxDefaultValidator,
132 const wxString& name = "radioBox");
23324ae1
FM
133
134 /**
135 Destructor, destroying the radiobox item.
136 */
137 ~wxRadioBox();
138
23324ae1
FM
139 /**
140 Creates the radiobox for two-step construction. See wxRadioBox()
141 for further details.
142 */
143 bool Create(wxWindow* parent, wxWindowID id,
144 const wxString& label,
3ed3a1c8 145 const wxPoint& pos = wxDefaultPosition,
23324ae1
FM
146 const wxSize& size = wxDefaultSize,
147 int n = 0,
4cc4bfaf 148 const wxString choices[] = NULL,
23324ae1
FM
149 int majorDimension = 0,
150 long style = wxRA_SPECIFY_COLS,
151 const wxValidator& validator = wxDefaultValidator,
152 const wxString& name = "radioBox");
3ed3a1c8
BP
153
154 /**
155 Creates the radiobox for two-step construction. See wxRadioBox()
156 for further details.
157 */
7c913512
FM
158 bool Create(wxWindow* parent, wxWindowID id,
159 const wxString& label,
3ed3a1c8 160 const wxPoint& pos,
7c913512
FM
161 const wxSize& size,
162 const wxArrayString& choices,
163 int majorDimension = 0,
164 long style = wxRA_SPECIFY_COLS,
165 const wxValidator& validator = wxDefaultValidator,
166 const wxString& name = "radioBox");
23324ae1 167
23324ae1
FM
168 /**
169 Enables or disables an individual button in the radiobox.
3c4f71cc 170
7c913512 171 @param enable
4cc4bfaf 172 @true to enable, @false to disable.
7c913512 173 @param n
4cc4bfaf 174 The zero-based button to enable or disable.
3c4f71cc 175
3ed3a1c8
BP
176 @see wxWindow::Enable()
177
178 @beginWxPythonOnly
179 In place of a single overloaded method name, wxPython implements the following methods:
180
181 @beginTable
182 @row2col{Enable(flag), Enables or disables the entire radiobox.}
183 @row2col{EnableItem(n\, flag), Enables or disables an individual button in the radiobox.}
184 @endTable
185
186 @endWxPythonOnly
23324ae1 187 */
4cc4bfaf 188 virtual bool Enable(unsigned int n, bool enable = true);
3ed3a1c8 189
23324ae1
FM
190
191 /**
192 Finds a button matching the given string, returning the position if found, or
193 -1 if not found.
3c4f71cc 194
7c913512 195 @param string
4cc4bfaf 196 The string to find.
23324ae1 197 */
328f5751 198 int FindString(const wxString& string) const;
23324ae1
FM
199
200 /**
201 Returns the number of columns in the radiobox.
202 */
328f5751 203 unsigned int GetColumnCount() const;
23324ae1
FM
204
205 /**
206 Returns a radio box item under the point, a zero-based item index, or @c
207 wxNOT_FOUND if no item is under the point.
3c4f71cc 208
7c913512 209 @param pt
4cc4bfaf 210 Point in client coordinates.
23324ae1 211 */
328f5751 212 int GetItemFromPoint(const wxPoint pt) const;
23324ae1
FM
213
214 /**
4cc4bfaf 215 Returns the helptext associated with the specified @a item if any or @c
23324ae1 216 wxEmptyString.
3c4f71cc 217
7c913512 218 @param item
4cc4bfaf 219 The zero-based item index.
3c4f71cc 220
4cc4bfaf 221 @see SetItemHelpText()
23324ae1 222 */
328f5751 223 wxString GetItemHelpText(unsigned int item) const;
23324ae1
FM
224
225 /**
4cc4bfaf 226 Returns the tooltip associated with the specified @a item if any or @NULL.
3c4f71cc 227
3ed3a1c8 228 @see SetItemToolTip(), wxWindow::GetToolTip()
23324ae1 229 */
328f5751 230 wxToolTip* GetItemToolTip(unsigned int item) const;
23324ae1 231
23324ae1
FM
232 /**
233 Returns the number of rows in the radiobox.
234 */
328f5751 235 unsigned int GetRowCount() const;
23324ae1 236
23324ae1
FM
237 /**
238 Returns @true if the item is enabled or @false if it was disabled using
3ed3a1c8
BP
239 @ref Enable(unsigned int,bool) "Enable(n, false)".
240
241 This function is currently only implemented in wxMSW, wxGTK and
242 wxUniversal and always returns @true in the other ports.
3c4f71cc 243
7c913512 244 @param n
4cc4bfaf 245 The zero-based button position.
23324ae1 246 */
328f5751 247 bool IsItemEnabled(unsigned int n) const;
23324ae1
FM
248
249 /**
250 Returns @true if the item is currently shown or @false if it was hidden
3ed3a1c8
BP
251 using @ref Show(unsigned int,bool) "Show(n, false)".
252
23324ae1 253 Note that this function returns @true for an item which hadn't been hidden
3ed3a1c8
BP
254 even if the entire radiobox is not currently shown.
255
256 This function is currently only implemented in wxMSW, wxGTK and
257 wxUniversal and always returns @true in the other ports.
3c4f71cc 258
7c913512 259 @param n
4cc4bfaf 260 The zero-based button position.
23324ae1 261 */
328f5751 262 bool IsItemShown(unsigned int n) const;
23324ae1
FM
263
264 /**
265 Sets the helptext for an item. Empty string erases any existing helptext.
3c4f71cc 266
7c913512 267 @param item
4cc4bfaf 268 The zero-based item index.
7c913512 269 @param helptext
4cc4bfaf 270 The help text to set for the item.
3c4f71cc 271
4cc4bfaf 272 @see GetItemHelpText()
23324ae1
FM
273 */
274 void SetItemHelpText(unsigned int item, const wxString& helptext);
275
276 /**
277 Sets the tooltip text for the specified item in the radio group.
3ed3a1c8
BP
278
279 This function is currently only implemented in wxMSW and wxGTK2 and
280 does nothing in the other ports.
3c4f71cc 281
7c913512 282 @param item
4cc4bfaf 283 Index of the item the tooltip will be shown for.
7c913512 284 @param text
4cc4bfaf 285 Tooltip text for the item, the tooltip is removed if empty.
3c4f71cc 286
3ed3a1c8 287 @see GetItemToolTip(), wxWindow::SetToolTip()
23324ae1
FM
288 */
289 void SetItemToolTip(unsigned int item, const wxString& text);
290
291 /**
3ed3a1c8 292 Shows or hides individual buttons.
3c4f71cc 293
3ed3a1c8
BP
294 @param show
295 @true to show, @false to hide.
296 @param item
297 The zero-based position of the button to show or hide.
23324ae1 298
3ed3a1c8
BP
299 @return
300 @true if the item has been shown or hidden or @false if nothing
301 was done because it already was in the requested state.
3c4f71cc 302
3ed3a1c8
BP
303 @see
304 wxWindow::Show()
23324ae1 305
3ed3a1c8
BP
306 @beginWxPythonOnly
307 In place of a single overloaded method name, wxPython implements the following methods:
308
309 @beginTable
310 @row2col{Show(flag), Shows or hides the entire radiobox.}
311 @row2col{ShowItem(n\, flag), Shows or hides individual buttons.}
312 @endTable
313
314 @endWxPythonOnly
3c4f71cc 315
23324ae1 316 */
3ed3a1c8 317 virtual bool Show(unsigned int item, const bool show = true);
23324ae1 318};