]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/choice.h
add alignment flags support to wxSpinCtrl[Double] (closes #10621)
[wxWidgets.git] / interface / wx / choice.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: choice.h
e54c96f1 3// Purpose: interface of wxChoice
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxChoice
7c913512 11
23324ae1 12 A choice item is used to select one of a list of strings. Unlike a
bfac6166 13 wxListBox, only the selection is visible until the user pulls down the
23324ae1 14 menu of choices.
7c913512 15
23324ae1 16 @beginStyleTable
8c6791e4 17 @style{wxCB_SORT}
23324ae1
FM
18 Sorts the entries alphabetically.
19 @endStyleTable
7c913512 20
3051a44a 21 @beginEventEmissionTable{wxCommandEvent}
8c6791e4 22 @event{EVT_CHOICE(id, func)}
23324ae1
FM
23 Process a wxEVT_COMMAND_CHOICE_SELECTED event, when an item on the
24 list is selected.
25 @endEventTable
7c913512 26
23324ae1
FM
27 @library{wxcore}
28 @category{ctrl}
7e59b885 29 @appearance{choice.png}
7c913512 30
e54c96f1 31 @see wxListBox, wxComboBox, wxCommandEvent
23324ae1
FM
32*/
33class wxChoice : public wxControlWithItems
34{
35public:
bfac6166
BP
36 /**
37 Default constructor.
38
39 @see Create(), wxValidator
40 */
41 wxChoice();
42
23324ae1
FM
43 //@{
44 /**
45 Constructor, creating and showing a choice.
3c4f71cc 46
7c913512 47 @param parent
4cc4bfaf 48 Parent window. Must not be @NULL.
7c913512 49 @param id
4cc4bfaf 50 Window identifier. The value wxID_ANY indicates a default value.
7c913512 51 @param pos
4cc4bfaf 52 Window position.
7c913512 53 @param size
bfac6166 54 Window size. If wxDefaultSize is specified then the choice is sized
4cc4bfaf 55 appropriately.
7c913512 56 @param n
4cc4bfaf 57 Number of strings with which to initialise the choice control.
7c913512 58 @param choices
4cc4bfaf 59 An array of strings with which to initialise the choice control.
7c913512 60 @param style
4cc4bfaf 61 Window style. See wxChoice.
7c913512 62 @param validator
4cc4bfaf 63 Window validator.
7c913512 64 @param name
4cc4bfaf 65 Window name.
3c4f71cc 66
4cc4bfaf 67 @see Create(), wxValidator
bfac6166
BP
68
69 @beginWxPythonOnly
70
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.
73
74 @endWxPythonOnly
23324ae1 75 */
882678eb
FM
76 wxChoice( wxWindow *parent, wxWindowID id,
77 const wxPoint& pos = wxDefaultPosition,
78 const wxSize& size = wxDefaultSize,
79 int n = 0, const wxString choices[] = NULL,
80 long style = 0,
81 const wxValidator& validator = wxDefaultValidator,
82 const wxString& name = wxChoiceNameStr );
792255cc
VZ
83
84 /**
85 Constructor, creating and showing a choice.
86
87 @param parent
88 Parent window. Must not be @NULL.
89 @param id
90 Window identifier. The value wxID_ANY indicates a default value.
91 @param pos
92 Window position.
93 @param size
94 Window size. If wxDefaultSize is specified then the choice is sized
95 appropriately.
96 @param choices
97 An array of strings with which to initialise the choice control.
98 @param style
99 Window style. See wxChoice.
100 @param validator
101 Window validator.
102 @param name
103 Window name.
104
105 @see Create(), wxValidator
106
107 @beginWxPythonOnly
108
109 The wxChoice constructor in wxPython reduces the @a n and @a choices
110 arguments to a single argument, which is a list of strings.
111
112 @endWxPythonOnly
113 */
882678eb
FM
114 wxChoice( wxWindow *parent, wxWindowID id,
115 const wxPoint& pos,
116 const wxSize& size,
117 const wxArrayString& choices,
118 long style = 0,
119 const wxValidator& validator = wxDefaultValidator,
120 const wxString& name = wxChoiceNameStr );
23324ae1
FM
121 //@}
122
123 /**
124 Destructor, destroying the choice item.
125 */
b7e94bd7 126 virtual ~wxChoice();
23324ae1
FM
127
128 //@{
129 /**
130 Creates the choice for two-step construction. See wxChoice().
131 */
882678eb
FM
132 bool Create( wxWindow *parent, wxWindowID id,
133 const wxPoint& pos = wxDefaultPosition,
134 const wxSize& size = wxDefaultSize,
135 int n = 0, const wxString choices[] = NULL,
136 long style = 0,
137 const wxValidator& validator = wxDefaultValidator,
138 const wxString& name = wxChoiceNameStr );
139 bool Create( wxWindow *parent, wxWindowID id,
140 const wxPoint& pos,
141 const wxSize& size,
142 const wxArrayString& choices,
143 long style = 0,
144 const wxValidator& validator = wxDefaultValidator,
145 const wxString& name = wxChoiceNameStr );
23324ae1
FM
146 //@}
147
148 /**
149 Gets the number of columns in this choice item.
3c4f71cc 150
882678eb 151 @remarks This is implemented for GTK and Motif only and always
3f16e52c 152 returns 1 for the other platforms.
23324ae1 153 */
b7e94bd7 154 virtual int GetColumns() const;
23324ae1
FM
155
156 /**
bfac6166
BP
157 Unlike wxControlWithItems::GetSelection() which only returns the
158 accepted selection value, i.e. the selection in the control once the
159 user closes the dropdown list, this function returns the current
160 selection. That is, while the dropdown list is shown, it returns the
161 currently selected item in it. When it is not shown, its result is the
162 same as for the other function.
163
1e24c2af
VS
164 @since 2.6.2.
165 In older versions, wxControlWithItems::GetSelection() itself
166 behaved like this.
23324ae1 167 */
b7e94bd7 168 virtual int GetCurrentSelection() const;
23324ae1
FM
169
170 /**
171 Sets the number of columns in this choice item.
3c4f71cc 172
7c913512 173 @param n
4cc4bfaf 174 Number of columns.
bfac6166 175
882678eb 176 @remarks This is implemented for GTK and Motif only and doesn’t do
3f16e52c 177 anything under other platforms.
23324ae1 178 */
b7e94bd7 179 virtual void SetColumns(int n = 1);
23324ae1 180};
e54c96f1 181