Make appropriate use of MakeDefaultNSRect and SetInitialFrameRect
[wxWidgets.git] / src / cocoa / combobox.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        cocoa/combobox.mm
3 // Purpose:     wxComboBox
4 // Author:      David Elliott
5 // Modified by:
6 // Created:     2003/07/14
7 // RCS-ID:      $Id$
8 // Copyright:   (c) 2003 David Elliott
9 // Licence:     wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #if wxUSE_COMBOBOX
15
16 #include "wx/app.h"
17 #include "wx/combobox.h"
18 #include "wx/log.h"
19
20 #include "wx/cocoa/autorelease.h"
21 #include "wx/cocoa/string.h"
22
23 #import <AppKit/NSComboBox.h>
24
25 IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxTextCtrl)
26 BEGIN_EVENT_TABLE(wxComboBox, wxTextCtrl)
27 END_EVENT_TABLE()
28 // WX_IMPLEMENT_COCOA_OWNER(wxComboBox,NSComboBox,NSTextField,NSView)
29
30 bool wxComboBox::Create(wxWindow *parent, wxWindowID winid,
31             const wxString& value,
32             const wxPoint& pos,
33             const wxSize& size,
34             int n, const wxString choices[],
35             long style,
36             const wxValidator& validator,
37             const wxString& name)
38 {
39     wxAutoNSAutoreleasePool pool;
40     if(!CreateControl(parent,winid,pos,size,style,validator,name))
41         return false;
42
43     m_cocoaNSView = NULL;
44     SetNSTextField([[NSComboBox alloc] initWithFrame:MakeDefaultNSRect(size)]);
45     [m_cocoaNSView release];
46     [GetNSTextField() setStringValue:wxNSStringWithWxString(value.c_str())];
47     [GetNSControl() sizeToFit];
48     if(m_parent)
49         m_parent->CocoaAddChild(this);
50     SetInitialFrameRect(pos,size);
51
52     return true;
53 }
54
55 wxComboBox::~wxComboBox()
56 {
57 }
58
59 void wxComboBox::SetSelection(int)
60 {
61 }
62
63 wxString wxComboBox::GetStringSelection()
64 {
65     return wxEmptyString;
66 }
67
68 void wxComboBox::SetStringSelection(const wxString& selection)
69 {
70 }
71
72 void wxComboBox::Clear()
73 {
74 }
75
76 void wxComboBox::Delete(int)
77 {
78 }
79
80 int wxComboBox::GetCount() const
81 {
82     return 0;
83 }
84
85 wxString wxComboBox::GetString(int) const
86 {
87     return wxEmptyString;
88 }
89
90 void wxComboBox::SetString(int, const wxString&)
91 {
92 }
93
94 int wxComboBox::FindString(const wxString&) const
95 {
96     return 0;
97 }
98
99 int wxComboBox::GetSelection() const
100 {
101     return 0;
102 }
103
104 int wxComboBox::DoAppend(const wxString&)
105 {
106     return 0;
107 }
108
109 int wxComboBox::DoInsert(const wxString&, int)
110 {
111     return 0;
112 }
113
114 void wxComboBox::DoSetItemClientData(int, void*)
115 {
116 }
117
118 void* wxComboBox::DoGetItemClientData(int) const
119 {
120     return NULL;
121 }
122
123 void wxComboBox::DoSetItemClientObject(int, wxClientData*)
124 {
125 }
126
127 wxClientData* wxComboBox::DoGetItemClientObject(int) const
128 {
129     return NULL;
130 }
131
132 #endif //wxUSE_COMBOBOX