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