]>
git.saurik.com Git - wxWidgets.git/blob - interface/choice.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxChoice
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 A choice item is used to select one of a list of strings. Unlike a
14 listbox, only the selection is visible until the user pulls down the
19 Sorts the entries alphabetically.
23 @event{EVT_CHOICE(id, func)}:
24 Process a wxEVT_COMMAND_CHOICE_SELECTED event, when an item on the
30 @appearance{choice.png}
32 @see wxListBox, wxComboBox, wxCommandEvent
34 class wxChoice
: public wxControlWithItems
39 Constructor, creating and showing a choice.
42 Parent window. Must not be @NULL.
44 Window identifier. The value wxID_ANY indicates a default value.
48 Window size. If wxDefaultSize is specified then the choice is
52 Number of strings with which to initialise the choice control.
54 An array of strings with which to initialise the choice control.
56 Window style. See wxChoice.
62 @see Create(), wxValidator
65 wxChoice(wxWindow
* parent
, wxWindowID id
,
67 const wxSize
& size
, int n
,
68 const wxString choices
[],
70 const wxValidator
& validator
= wxDefaultValidator
,
71 const wxString
& name
= "choice");
72 wxChoice(wxWindow
* parent
, wxWindowID id
,
75 const wxArrayString
& choices
,
77 const wxValidator
& validator
= wxDefaultValidator
,
78 const wxString
& name
= "choice");
82 Destructor, destroying the choice item.
88 Creates the choice for two-step construction. See wxChoice().
90 bool Create(wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
,
91 const wxSize
& size
, int n
,
92 const wxString choices
[],
94 const wxValidator
& validator
= wxDefaultValidator
,
95 const wxString
& name
= "choice");
96 bool Create(wxWindow
* parent
, wxWindowID id
,
99 const wxArrayString
& choices
,
101 const wxValidator
& validator
= wxDefaultValidator
,
102 const wxString
& name
= "choice");
106 Gets the number of columns in this choice item.
108 @remarks This is implemented for Motif only and always returns 1 for the
111 int GetColumns() const;
114 Unlike wxControlWithItems::GetSelection which only
115 returns the accepted selection value, i.e. the selection in the control once
116 the user closes the dropdown list, this function returns the current selection.
117 That is, while the dropdown list is shown, it returns the currently selected
118 item in it. When it is not shown, its result is the same as for the other
121 @wxsince{2.6.2} (before this version
122 wxControlWithItems::GetSelection itself behaved like
125 int GetCurrentSelection() const;
128 Sets the number of columns in this choice item.
133 void SetColumns(int n
= 1);