]>
git.saurik.com Git - wxWidgets.git/blob - interface/radiobox.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxRadioBox
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
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
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
23 @style{wxRA_USE_CHECKBOX}:
24 Use of the checkbox controls instead of radio buttons (currently
25 supported only on PalmOS)
29 @event{EVT_RADIOBOX(id, func)}:
30 Process a wxEVT_COMMAND_RADIOBOX_SELECTED event, when a radiobutton
36 @appearance{radiobox.png}
38 @see @ref overview_eventhandlingoverview, wxRadioButton, wxCheckBox
40 class wxRadioBox
: public wxControlWithItems
45 Constructor, creating and showing a radiobox.
48 Parent window. Must not be @NULL.
50 Window identifier. The value wxID_ANY indicates a default value.
52 Label for the static box surrounding the radio buttons.
54 Window position. If wxDefaultPosition is specified then a default
57 Window size. If wxDefaultSize is specified then a default size
60 Number of choices with which to initialize the radiobox.
62 An array of choices with which to initialize the radiobox.
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
68 Window style. See wxRadioBox.
74 @see Create(), wxValidator
77 wxRadioBox(wxWindow
* parent
, wxWindowID id
,
78 const wxString
& label
,
79 const wxPoint
& point
= wxDefaultPosition
,
80 const wxSize
& size
= wxDefaultSize
,
82 const wxString choices
[] = NULL
,
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
,
91 const wxArrayString
& choices
,
92 int majorDimension
= 0,
93 long style
= wxRA_SPECIFY_COLS
,
94 const wxValidator
& validator
= wxDefaultValidator
,
95 const wxString
& name
= "radioBox");
99 Destructor, destroying the radiobox item.
105 Creates the radiobox for two-step construction. See wxRadioBox()
108 bool Create(wxWindow
* parent
, wxWindowID id
,
109 const wxString
& label
,
110 const wxPoint
& point
= wxDefaultPosition
,
111 const wxSize
& size
= wxDefaultSize
,
113 const wxString choices
[] = NULL
,
114 int majorDimension
= 0,
115 long style
= wxRA_SPECIFY_COLS
,
116 const wxValidator
& validator
= wxDefaultValidator
,
117 const wxString
& name
= "radioBox");
118 bool Create(wxWindow
* parent
, wxWindowID id
,
119 const wxString
& label
,
120 const wxPoint
& point
,
122 const wxArrayString
& choices
,
123 int majorDimension
= 0,
124 long style
= wxRA_SPECIFY_COLS
,
125 const wxValidator
& validator
= wxDefaultValidator
,
126 const wxString
& name
= "radioBox");
131 Enables or disables an individual button in the radiobox.
134 @true to enable, @false to disable.
136 The zero-based button to enable or disable.
138 @see wxWindow::Enable
140 virtual bool Enable(bool enable
= true);
141 virtual bool Enable(unsigned int n
, bool enable
= true);
145 Finds a button matching the given string, returning the position if found, or
151 int FindString(const wxString
& string
) const;
154 Returns the number of columns in the radiobox.
156 unsigned int GetColumnCount() const;
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.
163 Point in client coordinates.
165 int GetItemFromPoint(const wxPoint pt
) const;
168 Returns the helptext associated with the specified @a item if any or @c
172 The zero-based item index.
174 @see SetItemHelpText()
176 wxString
GetItemHelpText(unsigned int item
) const;
179 Returns the tooltip associated with the specified @a item if any or @NULL.
181 @see SetItemToolTip(), wxWindow::GetToolTip
183 wxToolTip
* GetItemToolTip(unsigned int item
) const;
186 Returns the radiobox label.
189 The zero-based button index.
193 wxString
GetLabel() const;
196 Returns the number of rows in the radiobox.
198 unsigned int GetRowCount() const;
201 Returns the zero-based position of the selected button.
203 int GetSelection() const;
206 Returns the label for the button at the given position.
209 The zero-based button position.
211 wxString
GetString(unsigned int n
) const;
214 Returns the selected string.
216 wxString
GetStringSelection() const;
219 Returns @true if the item is enabled or @false if it was disabled using
220 @ref enable() "Enable(n, @false)".
221 @b Platform note: Currently only implemented in wxMSW, wxGTK and wxUniversal
222 and always returns @true in the other ports.
225 The zero-based button position.
227 bool IsItemEnabled(unsigned int n
) const;
230 Returns @true if the item is currently shown or @false if it was hidden
232 @ref show() "Show(n, @false)".
233 Note that this function returns @true for an item which hadn't been hidden
235 if the entire radiobox is not currently shown.
236 @b Platform note: Currently only implemented in wxMSW, wxGTK and wxUniversal
237 and always returns @true in the other ports.
240 The zero-based button position.
242 bool IsItemShown(unsigned int n
) const;
245 Sets the helptext for an item. Empty string erases any existing helptext.
248 The zero-based item index.
250 The help text to set for the item.
252 @see GetItemHelpText()
254 void SetItemHelpText(unsigned int item
, const wxString
& helptext
);
257 Sets the tooltip text for the specified item in the radio group.
258 @b Platform note: Currently only implemented in wxMSW and wxGTK2 and does
259 nothing in the other ports.
262 Index of the item the tooltip will be shown for.
264 Tooltip text for the item, the tooltip is removed if empty.
266 @see GetItemToolTip(), wxWindow::SetToolTip
268 void SetItemToolTip(unsigned int item
, const wxString
& text
);
271 Sets the radiobox label.
276 The zero-based button index.
278 void SetLabel(const wxString
& label
);
281 Sets a button by passing the desired string position. This does not cause
282 a wxEVT_COMMAND_RADIOBOX_SELECTED event to get emitted.
285 The zero-based button position.
287 void SetSelection(int n
);
290 Sets the selection to a button by passing the desired string. This does not
292 a wxEVT_COMMAND_RADIOBOX_SELECTED event to get emitted.
295 The label of the button to select.
297 void SetStringSelection(const wxString
& string
);