]>
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 @c wxEVT_CHOICE event, when an item on the
31 @see wxListBox, wxComboBox, wxCommandEvent
33 class wxChoice
: public wxControl
,
34 public wxItemContainer
40 @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
71 Not supported by wxPerl.
74 wxChoice( wxWindow
*parent
, wxWindowID id
,
75 const wxPoint
& pos
= wxDefaultPosition
,
76 const wxSize
& size
= wxDefaultSize
,
77 int n
= 0, const wxString choices
[] = NULL
,
79 const wxValidator
& validator
= wxDefaultValidator
,
80 const wxString
& name
= wxChoiceNameStr
);
83 Constructor, creating and showing a choice.
86 Parent window. Must not be @NULL.
88 Window identifier. The value wxID_ANY indicates a default value.
92 Window size. If wxDefaultSize is specified then the choice is sized
95 An array of strings with which to initialise the choice control.
97 Window style. See wxChoice.
103 @see Create(), wxValidator
106 Use an array reference for the @a choices parameter.
109 wxChoice( wxWindow
*parent
, wxWindowID id
,
112 const wxArrayString
& choices
,
114 const wxValidator
& validator
= wxDefaultValidator
,
115 const wxString
& name
= wxChoiceNameStr
);
118 Destructor, destroying the choice item.
124 Creates the choice for two-step construction. See wxChoice().
126 bool Create( wxWindow
*parent
, wxWindowID id
,
127 const wxPoint
& pos
= wxDefaultPosition
,
128 const wxSize
& size
= wxDefaultSize
,
129 int n
= 0, const wxString choices
[] = NULL
,
131 const wxValidator
& validator
= wxDefaultValidator
,
132 const wxString
& name
= wxChoiceNameStr
);
133 bool Create( wxWindow
*parent
, wxWindowID id
,
136 const wxArrayString
& choices
,
138 const wxValidator
& validator
= wxDefaultValidator
,
139 const wxString
& name
= wxChoiceNameStr
);
143 Gets the number of columns in this choice item.
145 @remarks This is implemented for GTK and Motif only and always
146 returns 1 for the other platforms.
148 virtual int GetColumns() const;
151 Unlike wxControlWithItems::GetSelection() which only returns the
152 accepted selection value, i.e. the selection in the control once the
153 user closes the dropdown list, this function returns the current
154 selection. That is, while the dropdown list is shown, it returns the
155 currently selected item in it. When it is not shown, its result is the
156 same as for the other function.
159 In older versions, wxControlWithItems::GetSelection() itself
162 virtual int GetCurrentSelection() const;
165 Sets the number of columns in this choice item.
170 @remarks This is implemented for GTK and Motif only and doesn’t do
171 anything under other platforms.
173 virtual void SetColumns(int n
= 1);
175 virtual bool IsSorted() const;
177 virtual unsigned int GetCount() const ;
178 virtual int GetSelection() const ;
179 virtual void SetSelection(int n
);
181 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
182 virtual wxString
GetString(unsigned int n
) const ;
183 virtual void SetString(unsigned int pos
, const wxString
& s
);