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 int n, const wxString choices[],
36 const wxValidator& validator,
39 wxAutoNSAutoreleasePool pool;
40 if(!CreateControl(parent,winid,pos,size,style,validator,name))
44 SetNSTextField([[NSComboBox alloc] initWithFrame:MakeDefaultNSRect(size)]);
45 [m_cocoaNSView release];
46 [GetNSTextField() setStringValue:wxNSStringWithWxString(value.c_str())];
47 [GetNSControl() sizeToFit];
49 m_parent->CocoaAddChild(this);
50 SetInitialFrameRect(pos,size);
55 wxComboBox::~wxComboBox()
59 void wxComboBox::SetSelection(int)
63 wxString wxComboBox::GetStringSelection()
68 void wxComboBox::SetStringSelection(const wxString& selection)
72 void wxComboBox::Clear()
76 void wxComboBox::Delete(int)
80 int wxComboBox::GetCount() const
85 wxString wxComboBox::GetString(int) const
90 void wxComboBox::SetString(int, const wxString&)
94 int wxComboBox::FindString(const wxString&) const
99 int wxComboBox::GetSelection() const
104 int wxComboBox::DoAppend(const wxString&)
109 int wxComboBox::DoInsert(const wxString&, int)
114 void wxComboBox::DoSetItemClientData(int, void*)
118 void* wxComboBox::DoGetItemClientData(int) const
123 void wxComboBox::DoSetItemClientObject(int, wxClientData*)
127 wxClientData* wxComboBox::DoGetItemClientObject(int) const
132 #endif //wxUSE_COMBOBOX