]>
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
24 @beginEventEmissionTable{wxCommandEvent}
25 @event{EVT_RADIOBOX(id, func)}
26 Process a @c wxEVT_COMMAND_RADIOBOX_SELECTED event, when a radiobutton
32 @appearance{radiobox.png}
34 @see @ref overview_events, wxRadioButton, wxCheckBox
36 class wxRadioBox
: public wxControl
, wxItemContainerImmutable
43 @see Create(), wxValidator
48 Constructor, creating and showing a radiobox.
51 Parent window. Must not be @NULL.
53 Window identifier. The value @c wxID_ANY indicates a default value.
55 Label for the static box surrounding the radio buttons.
57 Window position. If ::wxDefaultPosition is specified then a
58 default position is chosen.
60 Window size. If ::wxDefaultSize is specified then a default size
63 Number of choices with which to initialize the radiobox.
65 An array of choices with which to initialize the radiobox.
67 Specifies the maximum number of rows (if style contains
68 @c wxRA_SPECIFY_ROWS) or columns (if style contains
69 @c wxRA_SPECIFY_COLS) for a two-dimensional radiobox. The default
70 value of 0 means to use the number of items, i.e. @a n.
72 Window style. See wxRadioBox.
79 Not supported by wxPerl.
82 @see Create(), wxValidator
84 wxRadioBox(wxWindow
* parent
, wxWindowID id
,
85 const wxString
& label
,
86 const wxPoint
& pos
= wxDefaultPosition
,
87 const wxSize
& size
= wxDefaultSize
,
89 const wxString choices
[] = NULL
,
90 int majorDimension
= 0,
91 long style
= wxRA_SPECIFY_COLS
,
92 const wxValidator
& validator
= wxDefaultValidator
,
93 const wxString
& name
= wxRadioBoxNameStr
);
96 Constructor, creating and showing a radiobox.
99 Parent window. Must not be @NULL.
101 Window identifier. The value @c wxID_ANY indicates a default value.
103 Label for the static box surrounding the radio buttons.
105 Window position. If ::wxDefaultPosition is specified then a
106 default position is chosen.
108 Window size. If ::wxDefaultSize is specified then a default size
111 An array of choices with which to initialize the radiobox.
112 @param majorDimension
113 Specifies the maximum number of rows (if style contains
114 @c wxRA_SPECIFY_ROWS) or columns (if style contains
115 @c wxRA_SPECIFY_COLS) for a two-dimensional radiobox. The default
116 value of 0 means to use the number of items, i.e. number of
117 elements in @a choices.
119 Window style. See wxRadioBox.
126 Use an array reference for the @a choices parameter.
129 @see Create(), wxValidator
131 wxRadioBox(wxWindow
* parent
, wxWindowID id
,
132 const wxString
& label
,
135 const wxArrayString
& choices
,
136 int majorDimension
= 0,
137 long style
= wxRA_SPECIFY_COLS
,
138 const wxValidator
& validator
= wxDefaultValidator
,
139 const wxString
& name
= wxRadioBoxNameStr
);
142 Destructor, destroying the radiobox item.
144 virtual ~wxRadioBox();
147 Creates the radiobox for two-step construction. See wxRadioBox()
150 bool Create(wxWindow
* parent
, wxWindowID id
,
151 const wxString
& label
,
152 const wxPoint
& pos
= wxDefaultPosition
,
153 const wxSize
& size
= wxDefaultSize
,
155 const wxString choices
[] = NULL
,
156 int majorDimension
= 0,
157 long style
= wxRA_SPECIFY_COLS
,
158 const wxValidator
& validator
= wxDefaultValidator
,
159 const wxString
& name
= wxRadioBoxNameStr
);
162 Creates the radiobox for two-step construction. See wxRadioBox()
165 bool Create(wxWindow
* parent
, wxWindowID id
,
166 const wxString
& label
,
169 const wxArrayString
& choices
,
170 int majorDimension
= 0,
171 long style
= wxRA_SPECIFY_COLS
,
172 const wxValidator
& validator
= wxDefaultValidator
,
173 const wxString
& name
= wxRadioBoxNameStr
);
176 Enables or disables an individual button in the radiobox.
179 @true to enable, @false to disable.
181 The zero-based button to enable or disable.
183 @see wxWindow::Enable()
186 In place of a single overloaded method name, wxPython implements the following methods:
189 @row2col{Enable(flag), Enables or disables the entire radiobox.}
190 @row2col{EnableItem(n\, flag), Enables or disables an individual button in the radiobox.}
195 virtual bool Enable(unsigned int n
, bool enable
= true);
198 Finds a button matching the given string, returning the position if found,
199 or @c wxNOT_FOUND if not found.
204 Should the search be case-sensitive?
206 virtual int FindString(const wxString
& string
, bool bCase
= false) const;
209 Returns the number of columns in the radiobox.
211 unsigned int GetColumnCount() const;
214 Returns a radio box item under the point, a zero-based item index, or @c
215 wxNOT_FOUND if no item is under the point.
218 Point in client coordinates.
220 virtual int GetItemFromPoint(const wxPoint
& pt
) const;
223 Returns the helptext associated with the specified @a item if any or @c
227 The zero-based item index.
229 @see SetItemHelpText()
231 wxString
GetItemHelpText(unsigned int item
) const;
234 Returns the tooltip associated with the specified @a item if any or @NULL.
236 @see SetItemToolTip(), wxWindow::GetToolTip()
238 wxToolTip
* GetItemToolTip(unsigned int item
) const;
241 Returns the number of rows in the radiobox.
243 unsigned int GetRowCount() const;
246 Returns @true if the item is enabled or @false if it was disabled using
247 @ref Enable(unsigned int,bool) "Enable(n, false)".
249 This function is currently only implemented in wxMSW, wxGTK and
250 wxUniversal and always returns @true in the other ports.
253 The zero-based button position.
255 virtual bool IsItemEnabled(unsigned int n
) const;
258 Returns @true if the item is currently shown or @false if it was hidden
259 using @ref Show(unsigned int,bool) "Show(n, false)".
261 Note that this function returns @true for an item which hadn't been hidden
262 even if the entire radiobox is not currently shown.
264 This function is currently only implemented in wxMSW, wxGTK and
265 wxUniversal and always returns @true in the other ports.
268 The zero-based button position.
270 virtual bool IsItemShown(unsigned int n
) const;
273 Sets the helptext for an item. Empty string erases any existing helptext.
276 The zero-based item index.
278 The help text to set for the item.
280 @see GetItemHelpText()
282 void SetItemHelpText(unsigned int item
, const wxString
& helptext
);
285 Sets the tooltip text for the specified item in the radio group.
287 This function is currently only implemented in wxMSW and wxGTK2 and
288 does nothing in the other ports.
291 Index of the item the tooltip will be shown for.
293 Tooltip text for the item, the tooltip is removed if empty.
295 @see GetItemToolTip(), wxWindow::SetToolTip()
297 void SetItemToolTip(unsigned int item
, const wxString
& text
);
300 Shows or hides individual buttons.
303 @true to show, @false to hide.
305 The zero-based position of the button to show or hide.
308 @true if the item has been shown or hidden or @false if nothing
309 was done because it already was in the requested state.
315 In place of a single overloaded method name, wxPython implements the following methods:
318 @row2col{Show(flag), Shows or hides the entire radiobox.}
319 @row2col{ShowItem(n\, flag), Shows or hides individual buttons.}
325 virtual bool Show(unsigned int item
, bool show
= true);
328 // pure virtuals that have implementations here
329 virtual unsigned int GetCount() const;
330 virtual wxString
GetString(unsigned int n
) const;
331 virtual void SetString(unsigned int n
, const wxString
& string
);
332 virtual void SetSelection(int n
);
333 virtual int GetSelection() const;