]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/choice.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxChoice
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
12 A choice item is used to select one of a list of strings. Unlike a
13 wxListBox, only the selection is visible until the user pulls down the
18 Sorts the entries alphabetically.
21 @beginEventEmissionTable{wxCommandEvent}
22 @event{EVT_CHOICE(id, func)}
23 Process a wxEVT_COMMAND_CHOICE_SELECTED event, when an item on the
29 @appearance{choice.png}
31 @see wxListBox, wxComboBox, wxCommandEvent
33 class wxChoice
: public wxControlWithItems
39 @see Create(), wxValidator
44 Constructor, creating and showing a choice.
47 Parent window. Must not be @NULL.
49 Window identifier. The value wxID_ANY indicates a default value.
52 If ::wxDefaultPosition is specified then a default position is chosen.
55 If ::wxDefaultSize is specified then the choice is sized appropriately.
57 Number of strings with which to initialise the choice control.
59 An array of strings with which to initialise the choice control.
61 Window style. See wxChoice.
67 @see Create(), wxValidator
71 The wxChoice constructor in wxPython reduces the @a n and @a choices
72 arguments to a single argument, which is a list of strings.
77 Not supported by wxPerl.
80 wxChoice( wxWindow
*parent
, wxWindowID id
,
81 const wxPoint
& pos
= wxDefaultPosition
,
82 const wxSize
& size
= wxDefaultSize
,
83 int n
= 0, const wxString choices
[] = NULL
,
85 const wxValidator
& validator
= wxDefaultValidator
,
86 const wxString
& name
= wxChoiceNameStr
);
89 Constructor, creating and showing a choice.
92 Parent window. Must not be @NULL.
94 Window identifier. The value wxID_ANY indicates a default value.
98 Window size. If wxDefaultSize is specified then the choice is sized
101 An array of strings with which to initialise the choice control.
103 Window style. See wxChoice.
109 @see Create(), wxValidator
113 The wxChoice constructor in wxPython reduces the @a n and @a choices
114 arguments to a single argument, which is a list of strings.
119 Use an array reference for the @a choices parameter.
122 wxChoice( wxWindow
*parent
, wxWindowID id
,
125 const wxArrayString
& choices
,
127 const wxValidator
& validator
= wxDefaultValidator
,
128 const wxString
& name
= wxChoiceNameStr
);
131 Destructor, destroying the choice item.
137 Creates the choice for two-step construction. See wxChoice().
139 bool Create( wxWindow
*parent
, wxWindowID id
,
140 const wxPoint
& pos
= wxDefaultPosition
,
141 const wxSize
& size
= wxDefaultSize
,
142 int n
= 0, const wxString choices
[] = NULL
,
144 const wxValidator
& validator
= wxDefaultValidator
,
145 const wxString
& name
= wxChoiceNameStr
);
146 bool Create( wxWindow
*parent
, wxWindowID id
,
149 const wxArrayString
& choices
,
151 const wxValidator
& validator
= wxDefaultValidator
,
152 const wxString
& name
= wxChoiceNameStr
);
156 Gets the number of columns in this choice item.
158 @remarks This is implemented for GTK and Motif only and always
159 returns 1 for the other platforms.
161 virtual int GetColumns() const;
164 Unlike wxControlWithItems::GetSelection() which only returns the
165 accepted selection value, i.e. the selection in the control once the
166 user closes the dropdown list, this function returns the current
167 selection. That is, while the dropdown list is shown, it returns the
168 currently selected item in it. When it is not shown, its result is the
169 same as for the other function.
172 In older versions, wxControlWithItems::GetSelection() itself
175 virtual int GetCurrentSelection() const;
178 Sets the number of columns in this choice item.
183 @remarks This is implemented for GTK and Motif only and doesn’t do
184 anything under other platforms.
186 virtual void SetColumns(int n
= 1);