]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/radiobox.h
Added 'Delimiter' attribute for wxArrayStringProperty. Moved static ArrayStringToStri...
[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$
6// Licence: wxWindows license
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
72 @c wxRA_SPECIFY_COLS) for a two-dimensional radiobox.
7c913512 73 @param style
4cc4bfaf 74 Window style. See wxRadioBox.
7c913512 75 @param validator
4cc4bfaf 76 Window validator.
7c913512 77 @param name
4cc4bfaf 78 Window name.
3c4f71cc 79
1058f652
MB
80 @beginWxPerlOnly
81 Not supported by wxPerl.
82 @endWxPerlOnly
83
4cc4bfaf 84 @see Create(), wxValidator
23324ae1 85 */
7c913512
FM
86 wxRadioBox(wxWindow* parent, wxWindowID id,
87 const wxString& label,
3ed3a1c8 88 const wxPoint& pos = wxDefaultPosition,
7c913512
FM
89 const wxSize& size = wxDefaultSize,
90 int n = 0,
4cc4bfaf 91 const wxString choices[] = NULL,
11e3af6e 92 int majorDimension = 1,
7c913512
FM
93 long style = wxRA_SPECIFY_COLS,
94 const wxValidator& validator = wxDefaultValidator,
11e3af6e 95 const wxString& name = wxRadioBoxNameStr);
3ed3a1c8
BP
96
97 /**
98 Constructor, creating and showing a radiobox.
99
100 @param parent
101 Parent window. Must not be @NULL.
102 @param id
103 Window identifier. The value @c wxID_ANY indicates a default value.
104 @param label
105 Label for the static box surrounding the radio buttons.
106 @param pos
76e2b570 107 Window position. If ::wxDefaultPosition is specified then a
3ed3a1c8
BP
108 default position is chosen.
109 @param size
76e2b570 110 Window size. If ::wxDefaultSize is specified then a default size
3ed3a1c8
BP
111 is chosen.
112 @param choices
113 An array of choices with which to initialize the radiobox.
114 @param majorDimension
115 Specifies the maximum number of rows (if style contains
116 @c wxRA_SPECIFY_ROWS) or columns (if style contains
117 @c wxRA_SPECIFY_COLS) for a two-dimensional radiobox.
118 @param style
119 Window style. See wxRadioBox.
120 @param validator
121 Window validator.
122 @param name
123 Window name.
124
1058f652
MB
125 @beginWxPerlOnly
126 Use an array reference for the @a choices parameter.
127 @endWxPerlOnly
128
3ed3a1c8
BP
129 @see Create(), wxValidator
130 */
7c913512
FM
131 wxRadioBox(wxWindow* parent, wxWindowID id,
132 const wxString& label,
3ed3a1c8 133 const wxPoint& pos,
7c913512
FM
134 const wxSize& size,
135 const wxArrayString& choices,
11e3af6e 136 int majorDimension = 1,
7c913512
FM
137 long style = wxRA_SPECIFY_COLS,
138 const wxValidator& validator = wxDefaultValidator,
11e3af6e 139 const wxString& name = wxRadioBoxNameStr);
23324ae1
FM
140
141 /**
142 Destructor, destroying the radiobox item.
143 */
adaaa686 144 virtual ~wxRadioBox();
23324ae1 145
23324ae1
FM
146 /**
147 Creates the radiobox for two-step construction. See wxRadioBox()
148 for further details.
149 */
150 bool Create(wxWindow* parent, wxWindowID id,
151 const wxString& label,
3ed3a1c8 152 const wxPoint& pos = wxDefaultPosition,
23324ae1
FM
153 const wxSize& size = wxDefaultSize,
154 int n = 0,
4cc4bfaf 155 const wxString choices[] = NULL,
23324ae1
FM
156 int majorDimension = 0,
157 long style = wxRA_SPECIFY_COLS,
158 const wxValidator& validator = wxDefaultValidator,
11e3af6e 159 const wxString& name = wxRadioBoxNameStr);
3ed3a1c8
BP
160
161 /**
162 Creates the radiobox for two-step construction. See wxRadioBox()
163 for further details.
164 */
7c913512
FM
165 bool Create(wxWindow* parent, wxWindowID id,
166 const wxString& label,
3ed3a1c8 167 const wxPoint& pos,
7c913512
FM
168 const wxSize& size,
169 const wxArrayString& choices,
170 int majorDimension = 0,
171 long style = wxRA_SPECIFY_COLS,
172 const wxValidator& validator = wxDefaultValidator,
11e3af6e 173 const wxString& name = wxRadioBoxNameStr);
23324ae1 174
23324ae1
FM
175 /**
176 Enables or disables an individual button in the radiobox.
3c4f71cc 177
7c913512 178 @param enable
4cc4bfaf 179 @true to enable, @false to disable.
7c913512 180 @param n
4cc4bfaf 181 The zero-based button to enable or disable.
3c4f71cc 182
3ed3a1c8
BP
183 @see wxWindow::Enable()
184
185 @beginWxPythonOnly
186 In place of a single overloaded method name, wxPython implements the following methods:
187
188 @beginTable
189 @row2col{Enable(flag), Enables or disables the entire radiobox.}
190 @row2col{EnableItem(n\, flag), Enables or disables an individual button in the radiobox.}
191 @endTable
192
193 @endWxPythonOnly
23324ae1 194 */
4cc4bfaf 195 virtual bool Enable(unsigned int n, bool enable = true);
3ed3a1c8 196
23324ae1 197 /**
f21dd16b
FM
198 Finds a button matching the given string, returning the position if found,
199 or @c wxNOT_FOUND if not found.
3c4f71cc 200
7c913512 201 @param string
4cc4bfaf 202 The string to find.
f21dd16b
FM
203 @param bCase
204 Should the search be case-sensitive?
23324ae1 205 */
f21dd16b 206 virtual int FindString(const wxString& string, bool bCase = false) const;
23324ae1
FM
207
208 /**
209 Returns the number of columns in the radiobox.
210 */
328f5751 211 unsigned int GetColumnCount() const;
23324ae1
FM
212
213 /**
214 Returns a radio box item under the point, a zero-based item index, or @c
215 wxNOT_FOUND if no item is under the point.
3c4f71cc 216
7c913512 217 @param pt
4cc4bfaf 218 Point in client coordinates.
23324ae1 219 */
43c48e1e 220 virtual int GetItemFromPoint(const wxPoint& pt) const;
23324ae1
FM
221
222 /**
4cc4bfaf 223 Returns the helptext associated with the specified @a item if any or @c
23324ae1 224 wxEmptyString.
3c4f71cc 225
7c913512 226 @param item
4cc4bfaf 227 The zero-based item index.
3c4f71cc 228
4cc4bfaf 229 @see SetItemHelpText()
23324ae1 230 */
328f5751 231 wxString GetItemHelpText(unsigned int item) const;
23324ae1
FM
232
233 /**
4cc4bfaf 234 Returns the tooltip associated with the specified @a item if any or @NULL.
3c4f71cc 235
3ed3a1c8 236 @see SetItemToolTip(), wxWindow::GetToolTip()
23324ae1 237 */
328f5751 238 wxToolTip* GetItemToolTip(unsigned int item) const;
23324ae1 239
23324ae1
FM
240 /**
241 Returns the number of rows in the radiobox.
242 */
328f5751 243 unsigned int GetRowCount() const;
23324ae1 244
23324ae1
FM
245 /**
246 Returns @true if the item is enabled or @false if it was disabled using
3ed3a1c8
BP
247 @ref Enable(unsigned int,bool) "Enable(n, false)".
248
249 This function is currently only implemented in wxMSW, wxGTK and
250 wxUniversal and always returns @true in the other ports.
3c4f71cc 251
7c913512 252 @param n
4cc4bfaf 253 The zero-based button position.
23324ae1 254 */
adaaa686 255 virtual bool IsItemEnabled(unsigned int n) const;
23324ae1
FM
256
257 /**
258 Returns @true if the item is currently shown or @false if it was hidden
3ed3a1c8
BP
259 using @ref Show(unsigned int,bool) "Show(n, false)".
260
23324ae1 261 Note that this function returns @true for an item which hadn't been hidden
3ed3a1c8
BP
262 even if the entire radiobox is not currently shown.
263
264 This function is currently only implemented in wxMSW, wxGTK and
265 wxUniversal and always returns @true in the other ports.
3c4f71cc 266
7c913512 267 @param n
4cc4bfaf 268 The zero-based button position.
23324ae1 269 */
adaaa686 270 virtual bool IsItemShown(unsigned int n) const;
23324ae1
FM
271
272 /**
273 Sets the helptext for an item. Empty string erases any existing helptext.
3c4f71cc 274
7c913512 275 @param item
4cc4bfaf 276 The zero-based item index.
7c913512 277 @param helptext
4cc4bfaf 278 The help text to set for the item.
3c4f71cc 279
4cc4bfaf 280 @see GetItemHelpText()
23324ae1
FM
281 */
282 void SetItemHelpText(unsigned int item, const wxString& helptext);
283
284 /**
285 Sets the tooltip text for the specified item in the radio group.
3ed3a1c8
BP
286
287 This function is currently only implemented in wxMSW and wxGTK2 and
288 does nothing in the other ports.
3c4f71cc 289
7c913512 290 @param item
4cc4bfaf 291 Index of the item the tooltip will be shown for.
7c913512 292 @param text
4cc4bfaf 293 Tooltip text for the item, the tooltip is removed if empty.
3c4f71cc 294
3ed3a1c8 295 @see GetItemToolTip(), wxWindow::SetToolTip()
23324ae1
FM
296 */
297 void SetItemToolTip(unsigned int item, const wxString& text);
298
299 /**
3ed3a1c8 300 Shows or hides individual buttons.
3c4f71cc 301
3ed3a1c8
BP
302 @param show
303 @true to show, @false to hide.
304 @param item
305 The zero-based position of the button to show or hide.
23324ae1 306
3ed3a1c8
BP
307 @return
308 @true if the item has been shown or hidden or @false if nothing
309 was done because it already was in the requested state.
3c4f71cc 310
3ed3a1c8
BP
311 @see
312 wxWindow::Show()
23324ae1 313
3ed3a1c8
BP
314 @beginWxPythonOnly
315 In place of a single overloaded method name, wxPython implements the following methods:
316
317 @beginTable
318 @row2col{Show(flag), Shows or hides the entire radiobox.}
319 @row2col{ShowItem(n\, flag), Shows or hides individual buttons.}
320 @endTable
321
322 @endWxPythonOnly
3c4f71cc 323
23324ae1 324 */
11e3af6e 325 virtual bool Show(unsigned int item, bool show = true);
23324ae1 326};