]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/choice.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxChoice
4 // Author: wxWidgets team
6 // Licence: wxWindows license
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
45 Constructor, creating and showing a choice.
48 Parent window. Must not be @NULL.
50 Window identifier. The value wxID_ANY indicates a default value.
53 If ::wxDefaultPosition is specified then a default position is chosen.
56 If ::wxDefaultSize is specified then the choice is sized appropriately.
58 Number of strings with which to initialise the choice control.
60 An array of strings with which to initialise the choice control.
62 Window style. See wxChoice.
68 @see Create(), wxValidator
72 The wxChoice constructor in wxPython reduces the @a n and @a choices
73 arguments to a single argument, which is a list of strings.
78 Not supported by wxPerl.
81 wxChoice( wxWindow
*parent
, wxWindowID id
,
82 const wxPoint
& pos
= wxDefaultPosition
,
83 const wxSize
& size
= wxDefaultSize
,
84 int n
= 0, const wxString choices
[] = NULL
,
86 const wxValidator
& validator
= wxDefaultValidator
,
87 const wxString
& name
= wxChoiceNameStr
);
90 Constructor, creating and showing a choice.
93 Parent window. Must not be @NULL.
95 Window identifier. The value wxID_ANY indicates a default value.
99 Window size. If wxDefaultSize is specified then the choice is sized
102 An array of strings with which to initialise the choice control.
104 Window style. See wxChoice.
110 @see Create(), wxValidator
114 The wxChoice constructor in wxPython reduces the @a n and @a choices
115 arguments to a single argument, which is a list of strings.
120 Use an array reference for the @a choices parameter.
123 wxChoice( wxWindow
*parent
, wxWindowID id
,
126 const wxArrayString
& choices
,
128 const wxValidator
& validator
= wxDefaultValidator
,
129 const wxString
& name
= wxChoiceNameStr
);
133 Destructor, destroying the choice item.
139 Creates the choice for two-step construction. See wxChoice().
141 bool Create( wxWindow
*parent
, wxWindowID id
,
142 const wxPoint
& pos
= wxDefaultPosition
,
143 const wxSize
& size
= wxDefaultSize
,
144 int n
= 0, const wxString choices
[] = NULL
,
146 const wxValidator
& validator
= wxDefaultValidator
,
147 const wxString
& name
= wxChoiceNameStr
);
148 bool Create( wxWindow
*parent
, wxWindowID id
,
151 const wxArrayString
& choices
,
153 const wxValidator
& validator
= wxDefaultValidator
,
154 const wxString
& name
= wxChoiceNameStr
);
158 Gets the number of columns in this choice item.
160 @remarks This is implemented for GTK and Motif only and always
161 returns 1 for the other platforms.
163 virtual int GetColumns() const;
166 Unlike wxControlWithItems::GetSelection() which only returns the
167 accepted selection value, i.e. the selection in the control once the
168 user closes the dropdown list, this function returns the current
169 selection. That is, while the dropdown list is shown, it returns the
170 currently selected item in it. When it is not shown, its result is the
171 same as for the other function.
174 In older versions, wxControlWithItems::GetSelection() itself
177 virtual int GetCurrentSelection() const;
180 Sets the number of columns in this choice item.
185 @remarks This is implemented for GTK and Motif only and doesn’t do
186 anything under other platforms.
188 virtual void SetColumns(int n
= 1);