]> git.saurik.com Git - wxWidgets.git/blame - interface/radiobox.h
Try out - instead of @li, more backslash escaping
[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 17 @beginStyleTable
8c6791e4 18 @style{wxRA_SPECIFY_ROWS}
23324ae1 19 The major dimension parameter refers to the maximum number of rows.
8c6791e4 20 @style{wxRA_SPECIFY_COLS}
23324ae1
FM
21 The major dimension parameter refers to the maximum number of
22 columns.
8c6791e4 23 @style{wxRA_USE_CHECKBOX}
23324ae1
FM
24 Use of the checkbox controls instead of radio buttons (currently
25 supported only on PalmOS)
26 @endStyleTable
7c913512 27
1f1d2182 28 @beginEventTable{wxCommandEvent}
8c6791e4 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
1f1d2182 38 @see @ref overview_eventhandling, wxRadioButton, wxCheckBox
23324ae1 39*/
bf84f3e2 40class wxRadioBox : public wxControl, wxItemContainerImmutable
23324ae1
FM
41{
42public:
43 //@{
44 /**
45 Constructor, creating and showing a radiobox.
3c4f71cc 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.
3c4f71cc 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.
3c4f71cc 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.
3c4f71cc 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.
3c4f71cc 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.
3c4f71cc 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 169 wxEmptyString.
3c4f71cc 170
7c913512 171 @param item
4cc4bfaf 172 The zero-based item index.
3c4f71cc 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.
3c4f71cc 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.
3c4f71cc 187
7c913512 188 @param n
4cc4bfaf 189 The zero-based button index.
3c4f71cc 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.
3c4f71cc 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.
3c4f71cc 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.
3c4f71cc 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.
3c4f71cc 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.
3c4f71cc 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.
3c4f71cc 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.
3c4f71cc 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.
3c4f71cc 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.
3c4f71cc 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.
3c4f71cc 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