]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/radiobox.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxRadioBox
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
11 A radio box item is used to select one of number of mutually exclusive
12 choices. It is displayed as a vertical column or horizontal row of
16 @style{wxRA_SPECIFY_ROWS}
17 The major dimension parameter refers to the maximum number of rows.
18 @style{wxRA_SPECIFY_COLS}
19 The major dimension parameter refers to the maximum number of
23 @beginEventEmissionTable{wxCommandEvent}
24 @event{EVT_RADIOBOX(id, func)}
25 Process a @c wxEVT_RADIOBOX event, when a radiobutton
33 @see @ref overview_events, wxRadioButton, wxCheckBox
35 class wxRadioBox
: public wxControl
, wxItemContainerImmutable
42 @see Create(), wxValidator
47 Constructor, creating and showing a radiobox.
50 Parent window. Must not be @NULL.
52 Window identifier. The value @c wxID_ANY indicates a default value.
54 Label for the static box surrounding the radio buttons.
56 Window position. If ::wxDefaultPosition is specified then a
57 default position is chosen.
59 Window size. If ::wxDefaultSize is specified then a default size
62 Number of choices with which to initialize the radiobox.
64 An array of choices with which to initialize the radiobox.
66 Specifies the maximum number of rows (if style contains
67 @c wxRA_SPECIFY_ROWS) or columns (if style contains
68 @c wxRA_SPECIFY_COLS) for a two-dimensional radiobox. The default
69 value of 0 means to use the number of items, i.e. @a n.
71 Window style. See wxRadioBox.
78 Not supported by wxPerl.
81 @see Create(), wxValidator
83 wxRadioBox(wxWindow
* parent
, wxWindowID id
,
84 const wxString
& label
,
85 const wxPoint
& pos
= wxDefaultPosition
,
86 const wxSize
& size
= wxDefaultSize
,
88 const wxString choices
[] = NULL
,
89 int majorDimension
= 0,
90 long style
= wxRA_SPECIFY_COLS
,
91 const wxValidator
& validator
= wxDefaultValidator
,
92 const wxString
& name
= wxRadioBoxNameStr
);
95 Constructor, creating and showing a radiobox.
98 Parent window. Must not be @NULL.
100 Window identifier. The value @c wxID_ANY indicates a default value.
102 Label for the static box surrounding the radio buttons.
104 Window position. If ::wxDefaultPosition is specified then a
105 default position is chosen.
107 Window size. If ::wxDefaultSize is specified then a default size
110 An array of choices with which to initialize the radiobox.
111 @param majorDimension
112 Specifies the maximum number of rows (if style contains
113 @c wxRA_SPECIFY_ROWS) or columns (if style contains
114 @c wxRA_SPECIFY_COLS) for a two-dimensional radiobox. The default
115 value of 0 means to use the number of items, i.e. number of
116 elements in @a choices.
118 Window style. See wxRadioBox.
125 Use an array reference for the @a choices parameter.
128 @see Create(), wxValidator
130 wxRadioBox(wxWindow
* parent
, wxWindowID id
,
131 const wxString
& label
,
134 const wxArrayString
& choices
,
135 int majorDimension
= 0,
136 long style
= wxRA_SPECIFY_COLS
,
137 const wxValidator
& validator
= wxDefaultValidator
,
138 const wxString
& name
= wxRadioBoxNameStr
);
141 Destructor, destroying the radiobox item.
143 virtual ~wxRadioBox();
146 Creates the radiobox for two-step construction. See wxRadioBox()
149 bool Create(wxWindow
* parent
, wxWindowID id
,
150 const wxString
& label
,
151 const wxPoint
& pos
= wxDefaultPosition
,
152 const wxSize
& size
= wxDefaultSize
,
154 const wxString choices
[] = NULL
,
155 int majorDimension
= 0,
156 long style
= wxRA_SPECIFY_COLS
,
157 const wxValidator
& validator
= wxDefaultValidator
,
158 const wxString
& name
= wxRadioBoxNameStr
);
161 Creates the radiobox for two-step construction. See wxRadioBox()
164 bool Create(wxWindow
* parent
, wxWindowID id
,
165 const wxString
& label
,
168 const wxArrayString
& choices
,
169 int majorDimension
= 0,
170 long style
= wxRA_SPECIFY_COLS
,
171 const wxValidator
& validator
= wxDefaultValidator
,
172 const wxString
& name
= wxRadioBoxNameStr
);
175 Enables or disables an individual button in the radiobox.
178 @true to enable, @false to disable.
180 The zero-based button to enable or disable.
182 @see wxWindow::Enable()
185 virtual bool Enable(unsigned int n
, bool enable
= true);
188 Finds a button matching the given string, returning the position if found,
189 or @c wxNOT_FOUND if not found.
194 Should the search be case-sensitive?
196 virtual int FindString(const wxString
& string
, bool bCase
= false) const;
199 Returns the number of columns in the radiobox.
201 unsigned int GetColumnCount() const;
204 Returns a radio box item under the point, a zero-based item index, or @c
205 wxNOT_FOUND if no item is under the point.
208 Point in client coordinates.
210 virtual int GetItemFromPoint(const wxPoint
& pt
) const;
213 Returns the helptext associated with the specified @a item if any or @c
217 The zero-based item index.
219 @see SetItemHelpText()
221 wxString
GetItemHelpText(unsigned int item
) const;
224 Returns the tooltip associated with the specified @a item if any or @NULL.
226 @see SetItemToolTip(), wxWindow::GetToolTip()
228 wxToolTip
* GetItemToolTip(unsigned int item
) const;
231 Returns the number of rows in the radiobox.
233 unsigned int GetRowCount() const;
236 Returns @true if the item is enabled or @false if it was disabled using
237 @ref Enable(unsigned int,bool) "Enable(n, false)".
239 This function is currently only implemented in wxMSW, wxGTK and
240 wxUniversal and always returns @true in the other ports.
243 The zero-based button position.
245 virtual bool IsItemEnabled(unsigned int n
) const;
248 Returns @true if the item is currently shown or @false if it was hidden
249 using @ref Show(unsigned int,bool) "Show(n, false)".
251 Note that this function returns @true for an item which hadn't been hidden
252 even if the entire radiobox is not currently shown.
254 This function is currently only implemented in wxMSW, wxGTK and
255 wxUniversal and always returns @true in the other ports.
258 The zero-based button position.
260 virtual bool IsItemShown(unsigned int n
) const;
263 Sets the helptext for an item. Empty string erases any existing helptext.
266 The zero-based item index.
268 The help text to set for the item.
270 @see GetItemHelpText()
272 void SetItemHelpText(unsigned int item
, const wxString
& helptext
);
275 Sets the tooltip text for the specified item in the radio group.
277 This function is currently only implemented in wxMSW and wxGTK2 and
278 does nothing in the other ports.
281 Index of the item the tooltip will be shown for.
283 Tooltip text for the item, the tooltip is removed if empty.
285 @see GetItemToolTip(), wxWindow::SetToolTip()
287 void SetItemToolTip(unsigned int item
, const wxString
& text
);
290 Sets the selection to the given item.
292 Notice that a radio box always has selection, so @a n must be valid
293 here and passing @c wxNOT_FOUND is not allowed.
295 virtual void SetSelection(int n
);
298 Shows or hides individual buttons.
301 @true to show, @false to hide.
303 The zero-based position of the button to show or hide.
306 @true if the item has been shown or hidden or @false if nothing
307 was done because it already was in the requested state.
313 virtual bool Show(unsigned int item
, bool show
= true);
316 // pure virtuals that have implementations here
317 virtual unsigned int GetCount() const;
318 virtual wxString
GetString(unsigned int n
) const;
319 virtual void SetString(unsigned int n
, const wxString
& string
);
320 virtual int GetSelection() const;