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:NSMakeRect(0,0,30,30)]);
45 [m_cocoaNSView release];
46 [GetNSTextField() setStringValue:wxNSStringWithWxString(value.c_str())];
47 [GetNSControl() sizeToFit];
49 m_parent->CocoaAddChild(this);
53 wxComboBox::~wxComboBox()
57 void wxComboBox::SetSelection(int)
61 wxString wxComboBox::GetStringSelection()
66 void wxComboBox::SetStringSelection(const wxString& selection)
70 void wxComboBox::Clear()
74 void wxComboBox::Delete(int)
78 int wxComboBox::GetCount() const
83 wxString wxComboBox::GetString(int) const
88 void wxComboBox::SetString(int, const wxString&)
92 int wxComboBox::FindString(const wxString&) const
97 int wxComboBox::GetSelection() const
102 int wxComboBox::DoAppend(const wxString&)
107 int wxComboBox::DoInsert(const wxString&, int)
112 void wxComboBox::DoSetItemClientData(int, void*)
116 void* wxComboBox::DoGetItemClientData(int) const
121 void wxComboBox::DoSetItemClientObject(int, wxClientData*)
125 wxClientData* wxComboBox::DoGetItemClientObject(int) const
130 #endif //wxUSE_COMBOBOX