]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/radiobox.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxRadioBox
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
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
17 @style{wxRA_SPECIFY_ROWS}
18 The major dimension parameter refers to the maximum number of rows.
19 @style{wxRA_SPECIFY_COLS}
20 The major dimension parameter refers to the maximum number of
22 @style{wxRA_USE_CHECKBOX}
23 Use of the checkbox controls instead of radio buttons (currently
24 supported only on PalmOS)
27 @beginEventEmissionTable{wxCommandEvent}
28 @event{EVT_RADIOBOX(id, func)}
29 Process a @c wxEVT_COMMAND_RADIOBOX_SELECTED event, when a radiobutton
35 @appearance{radiobox.png}
37 @see @ref overview_events, wxRadioButton, wxCheckBox
39 class wxRadioBox
: public wxControl
, wxItemContainerImmutable
46 @see Create(), wxValidator
51 Constructor, creating and showing a radiobox.
54 Parent window. Must not be @NULL.
56 Window identifier. The value @c wxID_ANY indicates a default value.
58 Label for the static box surrounding the radio buttons.
60 Window position. If ::wxDefaultPosition is specified then a
61 default position is chosen.
63 Window size. If ::wxDefaultSize is specified then a default size
66 Number of choices with which to initialize the radiobox.
68 An array of choices with which to initialize the radiobox.
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. The default
73 value of 0 means to use the number of items, i.e. @a n.
75 Window style. See wxRadioBox.
82 Not supported by wxPerl.
85 @see Create(), wxValidator
87 wxRadioBox(wxWindow
* parent
, wxWindowID id
,
88 const wxString
& label
,
89 const wxPoint
& pos
= wxDefaultPosition
,
90 const wxSize
& size
= wxDefaultSize
,
92 const wxString choices
[] = NULL
,
93 int majorDimension
= 0,
94 long style
= wxRA_SPECIFY_COLS
,
95 const wxValidator
& validator
= wxDefaultValidator
,
96 const wxString
& name
= wxRadioBoxNameStr
);
99 Constructor, creating and showing a radiobox.
102 Parent window. Must not be @NULL.
104 Window identifier. The value @c wxID_ANY indicates a default value.
106 Label for the static box surrounding the radio buttons.
108 Window position. If ::wxDefaultPosition is specified then a
109 default position is chosen.
111 Window size. If ::wxDefaultSize is specified then a default size
114 An array of choices with which to initialize the radiobox.
115 @param majorDimension
116 Specifies the maximum number of rows (if style contains
117 @c wxRA_SPECIFY_ROWS) or columns (if style contains
118 @c wxRA_SPECIFY_COLS) for a two-dimensional radiobox. The default
119 value of 0 means to use the number of items, i.e. number of
120 elements in @a choices.
122 Window style. See wxRadioBox.
129 Use an array reference for the @a choices parameter.
132 @see Create(), wxValidator
134 wxRadioBox(wxWindow
* parent
, wxWindowID id
,
135 const wxString
& label
,
138 const wxArrayString
& choices
,
139 int majorDimension
= 0,
140 long style
= wxRA_SPECIFY_COLS
,
141 const wxValidator
& validator
= wxDefaultValidator
,
142 const wxString
& name
= wxRadioBoxNameStr
);
145 Destructor, destroying the radiobox item.
147 virtual ~wxRadioBox();
150 Creates the radiobox for two-step construction. See wxRadioBox()
153 bool Create(wxWindow
* parent
, wxWindowID id
,
154 const wxString
& label
,
155 const wxPoint
& pos
= wxDefaultPosition
,
156 const wxSize
& size
= wxDefaultSize
,
158 const wxString choices
[] = NULL
,
159 int majorDimension
= 0,
160 long style
= wxRA_SPECIFY_COLS
,
161 const wxValidator
& validator
= wxDefaultValidator
,
162 const wxString
& name
= wxRadioBoxNameStr
);
165 Creates the radiobox for two-step construction. See wxRadioBox()
168 bool Create(wxWindow
* parent
, wxWindowID id
,
169 const wxString
& label
,
172 const wxArrayString
& choices
,
173 int majorDimension
= 0,
174 long style
= wxRA_SPECIFY_COLS
,
175 const wxValidator
& validator
= wxDefaultValidator
,
176 const wxString
& name
= wxRadioBoxNameStr
);
179 Enables or disables an individual button in the radiobox.
182 @true to enable, @false to disable.
184 The zero-based button to enable or disable.
186 @see wxWindow::Enable()
189 In place of a single overloaded method name, wxPython implements the following methods:
192 @row2col{Enable(flag), Enables or disables the entire radiobox.}
193 @row2col{EnableItem(n\, flag), Enables or disables an individual button in the radiobox.}
198 virtual bool Enable(unsigned int n
, bool enable
= true);
201 Finds a button matching the given string, returning the position if found,
202 or @c wxNOT_FOUND if not found.
207 Should the search be case-sensitive?
209 virtual int FindString(const wxString
& string
, bool bCase
= false) const;
212 Returns the number of columns in the radiobox.
214 unsigned int GetColumnCount() const;
217 Returns a radio box item under the point, a zero-based item index, or @c
218 wxNOT_FOUND if no item is under the point.
221 Point in client coordinates.
223 virtual int GetItemFromPoint(const wxPoint
& pt
) const;
226 Returns the helptext associated with the specified @a item if any or @c
230 The zero-based item index.
232 @see SetItemHelpText()
234 wxString
GetItemHelpText(unsigned int item
) const;
237 Returns the tooltip associated with the specified @a item if any or @NULL.
239 @see SetItemToolTip(), wxWindow::GetToolTip()
241 wxToolTip
* GetItemToolTip(unsigned int item
) const;
244 Returns the number of rows in the radiobox.
246 unsigned int GetRowCount() const;
249 Returns @true if the item is enabled or @false if it was disabled using
250 @ref Enable(unsigned int,bool) "Enable(n, false)".
252 This function is currently only implemented in wxMSW, wxGTK and
253 wxUniversal and always returns @true in the other ports.
256 The zero-based button position.
258 virtual bool IsItemEnabled(unsigned int n
) const;
261 Returns @true if the item is currently shown or @false if it was hidden
262 using @ref Show(unsigned int,bool) "Show(n, false)".
264 Note that this function returns @true for an item which hadn't been hidden
265 even if the entire radiobox is not currently shown.
267 This function is currently only implemented in wxMSW, wxGTK and
268 wxUniversal and always returns @true in the other ports.
271 The zero-based button position.
273 virtual bool IsItemShown(unsigned int n
) const;
276 Sets the helptext for an item. Empty string erases any existing helptext.
279 The zero-based item index.
281 The help text to set for the item.
283 @see GetItemHelpText()
285 void SetItemHelpText(unsigned int item
, const wxString
& helptext
);
288 Sets the tooltip text for the specified item in the radio group.
290 This function is currently only implemented in wxMSW and wxGTK2 and
291 does nothing in the other ports.
294 Index of the item the tooltip will be shown for.
296 Tooltip text for the item, the tooltip is removed if empty.
298 @see GetItemToolTip(), wxWindow::SetToolTip()
300 void SetItemToolTip(unsigned int item
, const wxString
& text
);
303 Shows or hides individual buttons.
306 @true to show, @false to hide.
308 The zero-based position of the button to show or hide.
311 @true if the item has been shown or hidden or @false if nothing
312 was done because it already was in the requested state.
318 In place of a single overloaded method name, wxPython implements the following methods:
321 @row2col{Show(flag), Shows or hides the entire radiobox.}
322 @row2col{ShowItem(n\, flag), Shows or hides individual buttons.}
328 virtual bool Show(unsigned int item
, bool show
= true);