1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cocoa/combobox.mm
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
17 #include "wx/combobox.h"
20 #include "wx/cocoa/autorelease.h"
21 #include "wx/cocoa/string.h"
23 #import <AppKit/NSComboBox.h>
25 IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxTextCtrl)
26 BEGIN_EVENT_TABLE(wxComboBox, wxTextCtrl)
28 // WX_IMPLEMENT_COCOA_OWNER(wxComboBox,NSComboBox,NSTextField,NSView)
30 bool wxComboBox::Create(wxWindow *parent, wxWindowID winid,
31 const wxString& value,
34 const wxArrayString& choices,
36 const wxValidator& validator,
39 wxCArrayString chs(choices);
41 return Create(parent, winid, value, pos, size, chs.GetCount(),
42 chs.GetStrings(), style, validator, name);
45 bool wxComboBox::Create(wxWindow *parent, wxWindowID winid,
46 const wxString& value,
49 int n, const wxString choices[],
51 const wxValidator& validator,
54 wxAutoNSAutoreleasePool pool;
55 if(!CreateControl(parent,winid,pos,size,style,validator,name))
59 SetNSTextField([[NSComboBox alloc] initWithFrame:MakeDefaultNSRect(size)]);
60 [m_cocoaNSView release];
61 [GetNSTextField() setStringValue:wxNSStringWithWxString(value.c_str())];
62 [GetNSControl() sizeToFit];
64 m_parent->CocoaAddChild(this);
65 SetInitialFrameRect(pos,size);
70 wxComboBox::~wxComboBox()
74 void wxComboBox::SetSelection(int)
78 wxString wxComboBox::GetStringSelection()
83 void wxComboBox::SetStringSelection(const wxString& selection)
87 void wxComboBox::Clear()
91 void wxComboBox::Delete(int)
95 int wxComboBox::GetCount() const
100 wxString wxComboBox::GetString(int) const
102 return wxEmptyString;
105 void wxComboBox::SetString(int, const wxString&)
109 int wxComboBox::FindString(const wxString&) const
114 int wxComboBox::GetSelection() const
119 int wxComboBox::DoAppend(const wxString&)
124 int wxComboBox::DoInsert(const wxString&, int)
129 void wxComboBox::DoSetItemClientData(int, void*)
133 void* wxComboBox::DoGetItemClientData(int) const
138 void wxComboBox::DoSetItemClientObject(int, wxClientData*)
142 wxClientData* wxComboBox::DoGetItemClientObject(int) const
147 #endif //wxUSE_COMBOBOX