]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/choice.h
add 'redirection page' for wxULongLong
[wxWidgets.git] / interface / wx / choice.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: choice.h
3 // Purpose: interface of wxChoice
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxChoice
11
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
14 menu of choices.
15
16 @beginStyleTable
17 @style{wxCB_SORT}
18 Sorts the entries alphabetically.
19 @endStyleTable
20
21 @beginEventTable{wxCommandEvent}
22 @event{EVT_CHOICE(id, func)}
23 Process a wxEVT_COMMAND_CHOICE_SELECTED event, when an item on the
24 list is selected.
25 @endEventTable
26
27 @library{wxcore}
28 @category{ctrl}
29 @appearance{choice.png}
30
31 @see wxListBox, wxComboBox, wxCommandEvent
32 */
33 class wxChoice : public wxControlWithItems
34 {
35 public:
36 /**
37 Default constructor.
38
39 @see Create(), wxValidator
40 */
41 wxChoice();
42
43 //@{
44 /**
45 Constructor, creating and showing a choice.
46
47 @param parent
48 Parent window. Must not be @NULL.
49 @param id
50 Window identifier. The value wxID_ANY indicates a default value.
51 @param pos
52 Window position.
53 @param size
54 Window size. If wxDefaultSize is specified then the choice is sized
55 appropriately.
56 @param n
57 Number of strings with which to initialise the choice control.
58 @param choices
59 An array of strings with which to initialise the choice control.
60 @param style
61 Window style. See wxChoice.
62 @param validator
63 Window validator.
64 @param name
65 Window name.
66
67 @see Create(), wxValidator
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
75 */
76 wxChoice(wxWindow* parent, wxWindowID id,
77 const wxPoint& pos,
78 const wxSize& size, int n,
79 const wxString choices[],
80 long style = 0,
81 const wxValidator& validator = wxDefaultValidator,
82 const wxString& name = "choice");
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 */
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 = "choice");
121 //@}
122
123 /**
124 Destructor, destroying the choice item.
125 */
126 virtual ~wxChoice();
127
128 //@{
129 /**
130 Creates the choice for two-step construction. See wxChoice().
131 */
132 bool Create(wxWindow* parent, wxWindowID id, const wxPoint& pos,
133 const wxSize& size, int n,
134 const wxString choices[],
135 long style = 0,
136 const wxValidator& validator = wxDefaultValidator,
137 const wxString& name = "choice");
138 bool Create(wxWindow* parent, wxWindowID id,
139 const wxPoint& pos,
140 const wxSize& size,
141 const wxArrayString& choices,
142 long style = 0,
143 const wxValidator& validator = wxDefaultValidator,
144 const wxString& name = "choice");
145 //@}
146
147 /**
148 Gets the number of columns in this choice item.
149
150 @remarks This is implemented for GTK and Motif only and always
151 returns 1 for the other platforms.
152 */
153 virtual int GetColumns() const;
154
155 /**
156 Unlike wxControlWithItems::GetSelection() which only returns the
157 accepted selection value, i.e. the selection in the control once the
158 user closes the dropdown list, this function returns the current
159 selection. That is, while the dropdown list is shown, it returns the
160 currently selected item in it. When it is not shown, its result is the
161 same as for the other function.
162
163 @since 2.6.2.
164 In older versions, wxControlWithItems::GetSelection() itself
165 behaved like this.
166 */
167 virtual int GetCurrentSelection() const;
168
169 /**
170 Sets the number of columns in this choice item.
171
172 @param n
173 Number of columns.
174
175 @remarks This is implemented for GTK and Motif only and doesn’t do
176 anything under other platforms.
177 */
178 virtual void SetColumns(int n = 1);
179 };
180