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