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