]>
Commit | Line | Data |
---|---|---|
4ddfa282 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: src/osx/combobox_osx.cpp | |
3 | // Purpose: wxComboBox class using HIView ComboBox | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id: combobox_osx.cpp 58318 2009-01-23 08:36:16Z RR $ | |
8 | // Copyright: (c) Stefan Csomor | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/wxprec.h" | |
13 | ||
f941a30b | 14 | #if wxUSE_COMBOBOX && defined(wxOSX_USE_NATIVE_COMBOBOX) |
4ddfa282 SC |
15 | |
16 | #include "wx/combobox.h" | |
f941a30b | 17 | #include "wx/osx/private.h" |
4ddfa282 SC |
18 | |
19 | #ifndef WX_PRECOMP | |
20 | #endif | |
21 | ||
22 | // work in progress | |
23 | ||
24 | IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl) | |
25 | ||
26 | wxComboBox::~wxComboBox() | |
27 | { | |
28 | } | |
29 | ||
f941a30b KO |
30 | void wxComboBox::Init() |
31 | { | |
32 | } | |
33 | ||
4ddfa282 SC |
34 | bool wxComboBox::Create(wxWindow *parent, wxWindowID id, |
35 | const wxString& value, | |
36 | const wxPoint& pos, | |
37 | const wxSize& size, | |
38 | const wxArrayString& choices, | |
39 | long style, | |
40 | const wxValidator& validator, | |
41 | const wxString& name) | |
42 | { | |
43 | wxCArrayString chs( choices ); | |
44 | ||
45 | return Create( parent, id, value, pos, size, chs.GetCount(), | |
46 | chs.GetStrings(), style, validator, name ); | |
47 | } | |
48 | ||
49 | bool wxComboBox::Create(wxWindow *parent, wxWindowID id, | |
50 | const wxString& value, | |
51 | const wxPoint& pos, | |
52 | const wxSize& size, | |
53 | int n, const wxString choices[], | |
54 | long style, | |
55 | const wxValidator& validator, | |
56 | const wxString& name) | |
57 | { | |
58 | m_text = NULL; | |
59 | m_choice = NULL; | |
60 | ||
61 | m_macIsUserPane = false; | |
62 | ||
63 | if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) ) | |
64 | return false; | |
65 | ||
f941a30b | 66 | m_peer = wxWidgetImpl::CreateComboBox( this, parent, id, NULL, pos, size, style, GetExtraStyle() ); |
4ddfa282 SC |
67 | |
68 | MacPostControlCreate( pos, size ); | |
69 | ||
4ddfa282 SC |
70 | Append(n, choices); |
71 | ||
72 | // Set the first item as being selected | |
73 | if (n > 0) | |
74 | SetSelection( 0 ); | |
75 | ||
76 | // Needed because it is a wxControlWithItems | |
77 | SetInitialSize( size ); | |
78 | ||
79 | return true; | |
80 | } | |
81 | ||
4ddfa282 SC |
82 | void wxComboBox::DelegateTextChanged( const wxString& value ) |
83 | { | |
84 | SetStringSelection( value ); | |
85 | } | |
86 | ||
4ddfa282 SC |
87 | void wxComboBox::DelegateChoice( const wxString& value ) |
88 | { | |
89 | SetStringSelection( value ); | |
90 | } | |
91 | ||
4ddfa282 SC |
92 | wxString wxComboBox::GetValue() const |
93 | { | |
f941a30b KO |
94 | wxFAIL_MSG("Method Not Implemented."); |
95 | return wxEmptyString; | |
4ddfa282 SC |
96 | } |
97 | ||
98 | void wxComboBox::SetValue(const wxString& value) | |
99 | { | |
f941a30b | 100 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
101 | } |
102 | ||
103 | // Clipboard operations | |
104 | void wxComboBox::Copy() | |
105 | { | |
f941a30b | 106 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
107 | } |
108 | ||
109 | void wxComboBox::Cut() | |
110 | { | |
f941a30b | 111 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
112 | } |
113 | ||
114 | void wxComboBox::Paste() | |
115 | { | |
f941a30b | 116 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
117 | } |
118 | ||
119 | void wxComboBox::SetEditable(bool editable) | |
120 | { | |
f941a30b | 121 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
122 | } |
123 | ||
124 | void wxComboBox::SetInsertionPoint(long pos) | |
125 | { | |
f941a30b | 126 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
127 | } |
128 | ||
129 | void wxComboBox::SetInsertionPointEnd() | |
130 | { | |
f941a30b | 131 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
132 | } |
133 | ||
134 | long wxComboBox::GetInsertionPoint() const | |
135 | { | |
f941a30b | 136 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
137 | return 0; |
138 | } | |
139 | ||
140 | wxTextPos wxComboBox::GetLastPosition() const | |
141 | { | |
f941a30b | 142 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
143 | return 0; |
144 | } | |
145 | ||
146 | void wxComboBox::Replace(long from, long to, const wxString& value) | |
147 | { | |
f941a30b | 148 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
149 | } |
150 | ||
151 | void wxComboBox::Remove(long from, long to) | |
152 | { | |
f941a30b | 153 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
154 | } |
155 | ||
156 | void wxComboBox::SetSelection(long from, long to) | |
157 | { | |
f941a30b | 158 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
159 | } |
160 | ||
161 | int wxComboBox::DoInsertItems(const wxArrayStringsAdapter& items, | |
162 | unsigned int pos, | |
163 | void **clientData, wxClientDataType type) | |
164 | { | |
f941a30b KO |
165 | wxFAIL_MSG("Method Not Implemented."); |
166 | return 0; | |
4ddfa282 SC |
167 | } |
168 | ||
169 | void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData) | |
170 | { | |
f941a30b | 171 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
172 | } |
173 | ||
174 | void* wxComboBox::DoGetItemClientData(unsigned int n) const | |
175 | { | |
f941a30b KO |
176 | wxFAIL_MSG("Method Not Implemented."); |
177 | return NULL; | |
4ddfa282 SC |
178 | } |
179 | ||
f941a30b KO |
180 | unsigned int wxComboBox::GetCount() const |
181 | { | |
182 | wxFAIL_MSG("Method Not Implemented."); | |
183 | return 0; | |
4ddfa282 SC |
184 | } |
185 | ||
186 | void wxComboBox::DoDeleteOneItem(unsigned int n) | |
187 | { | |
f941a30b | 188 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
189 | } |
190 | ||
191 | void wxComboBox::DoClear() | |
192 | { | |
f941a30b | 193 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
194 | } |
195 | ||
196 | int wxComboBox::GetSelection() const | |
197 | { | |
f941a30b KO |
198 | wxFAIL_MSG("Method Not Implemented."); |
199 | return 0; | |
4ddfa282 SC |
200 | } |
201 | ||
f941a30b | 202 | void wxComboBox::GetSelection(long *from, long *to) const |
4ddfa282 | 203 | { |
f941a30b KO |
204 | wxFAIL_MSG("Method Not Implemented."); |
205 | } | |
4ddfa282 | 206 | |
f941a30b KO |
207 | void wxComboBox::SetSelection(int n) |
208 | { | |
209 | wxFAIL_MSG("Method Not Implemented."); | |
4ddfa282 SC |
210 | } |
211 | ||
212 | int wxComboBox::FindString(const wxString& s, bool bCase) const | |
213 | { | |
f941a30b KO |
214 | wxFAIL_MSG("Method Not Implemented."); |
215 | return 0; | |
4ddfa282 SC |
216 | } |
217 | ||
218 | wxString wxComboBox::GetString(unsigned int n) const | |
219 | { | |
f941a30b KO |
220 | wxFAIL_MSG("Method Not Implemented."); |
221 | return wxEmptyString; | |
4ddfa282 SC |
222 | } |
223 | ||
224 | wxString wxComboBox::GetStringSelection() const | |
225 | { | |
f941a30b KO |
226 | wxFAIL_MSG("Method Not Implemented."); |
227 | return wxEmptyString; | |
4ddfa282 SC |
228 | } |
229 | ||
230 | void wxComboBox::SetString(unsigned int n, const wxString& s) | |
231 | { | |
f941a30b | 232 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
233 | } |
234 | ||
235 | bool wxComboBox::IsEditable() const | |
236 | { | |
4ddfa282 | 237 | return !HasFlag(wxCB_READONLY); |
4ddfa282 SC |
238 | } |
239 | ||
240 | void wxComboBox::Undo() | |
241 | { | |
f941a30b | 242 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
243 | } |
244 | ||
245 | void wxComboBox::Redo() | |
246 | { | |
f941a30b | 247 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
248 | } |
249 | ||
250 | void wxComboBox::SelectAll() | |
251 | { | |
f941a30b | 252 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 SC |
253 | } |
254 | ||
255 | bool wxComboBox::CanCopy() const | |
256 | { | |
f941a30b | 257 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 | 258 | return false; |
4ddfa282 SC |
259 | } |
260 | ||
261 | bool wxComboBox::CanCut() const | |
262 | { | |
f941a30b | 263 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 | 264 | return false; |
4ddfa282 SC |
265 | } |
266 | ||
267 | bool wxComboBox::CanPaste() const | |
268 | { | |
f941a30b | 269 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 | 270 | return false; |
4ddfa282 SC |
271 | } |
272 | ||
273 | bool wxComboBox::CanUndo() const | |
274 | { | |
f941a30b | 275 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 | 276 | return false; |
4ddfa282 SC |
277 | } |
278 | ||
279 | bool wxComboBox::CanRedo() const | |
280 | { | |
f941a30b | 281 | wxFAIL_MSG("Method Not Implemented."); |
4ddfa282 | 282 | return false; |
f941a30b KO |
283 | } |
284 | ||
285 | void wxComboBox::EnableTextChangedEvents(bool enable) | |
286 | { | |
287 | wxFAIL_MSG("Method Not Implemented."); | |
288 | } | |
289 | ||
290 | void wxComboBox::WriteText(const wxString& text) | |
291 | { | |
292 | wxFAIL_MSG("Method Not Implemented."); | |
293 | } | |
294 | ||
295 | wxString wxComboBox::DoGetValue() const | |
296 | { | |
297 | wxFAIL_MSG("Method Not Implemented."); | |
298 | return wxEmptyString; | |
299 | } | |
300 | ||
301 | wxClientDataType wxComboBox::GetClientDataType() const | |
302 | { | |
303 | wxFAIL_MSG("Method Not Implemented."); | |
304 | return wxClientData_None; | |
305 | } | |
306 | ||
307 | void wxComboBox::SetClientDataType(wxClientDataType clientDataItemsType) | |
308 | { | |
309 | wxFAIL_MSG("Method Not Implemented."); | |
4ddfa282 SC |
310 | } |
311 | ||
312 | bool wxComboBox::OSXHandleClicked( double timestampsec ) | |
313 | { | |
314 | wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId ); | |
315 | event.SetInt(GetSelection()); | |
316 | event.SetEventObject(this); | |
317 | event.SetString(GetStringSelection()); | |
318 | ProcessCommand(event); | |
319 | return true; | |
320 | } | |
321 | ||
f941a30b | 322 | #endif // wxUSE_COMBOBOX && defined(wxOSX_USE_NATIVE_COMBOBOX) |