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