1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cocoa/combobox.mm
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWidgets 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::Clear()
87 void wxComboBox::Delete(int)
91 int wxComboBox::GetCount() const
96 wxString wxComboBox::GetString(int) const
101 void wxComboBox::SetString(int, const wxString&)
105 int wxComboBox::FindString(const wxString&) const
110 int wxComboBox::GetSelection() const
115 int wxComboBox::DoAppend(const wxString&)
120 int wxComboBox::DoInsert(const wxString&, int)
125 void wxComboBox::DoSetItemClientData(int, void*)
129 void* wxComboBox::DoGetItemClientData(int) const
134 void wxComboBox::DoSetItemClientObject(int, wxClientData*)
138 wxClientData* wxComboBox::DoGetItemClientObject(int) const
143 #endif //wxUSE_COMBOBOX