]> git.saurik.com Git - wxWidgets.git/blob - src/cocoa/combobox.mm
fix CFDictionary/Number/String combo memory leak in wxChoice - also gets rid of all...
[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: wxWidgets 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 const wxArrayString& choices,
35 long style,
36 const wxValidator& validator,
37 const wxString& name)
38 {
39 wxCArrayString chs(choices);
40
41 return Create(parent, winid, value, pos, size, chs.GetCount(),
42 chs.GetStrings(), style, validator, name);
43 }
44
45 bool wxComboBox::Create(wxWindow *parent, wxWindowID winid,
46 const wxString& value,
47 const wxPoint& pos,
48 const wxSize& size,
49 int n, const wxString choices[],
50 long style,
51 const wxValidator& validator,
52 const wxString& name)
53 {
54 wxAutoNSAutoreleasePool pool;
55 if(!CreateControl(parent,winid,pos,size,style,validator,name))
56 return false;
57
58 m_cocoaNSView = NULL;
59 SetNSTextField([[NSComboBox alloc] initWithFrame:MakeDefaultNSRect(size)]);
60 [m_cocoaNSView release];
61 [GetNSTextField() setStringValue:wxNSStringWithWxString(value.c_str())];
62 [GetNSControl() sizeToFit];
63 if(m_parent)
64 m_parent->CocoaAddChild(this);
65 SetInitialFrameRect(pos,size);
66
67 return true;
68 }
69
70 wxComboBox::~wxComboBox()
71 {
72 }
73
74 void wxComboBox::SetSelection(int)
75 {
76 }
77
78 wxString wxComboBox::GetStringSelection()
79 {
80 return wxEmptyString;
81 }
82
83 void wxComboBox::Clear()
84 {
85 }
86
87 void wxComboBox::Delete(int)
88 {
89 }
90
91 int wxComboBox::GetCount() const
92 {
93 return 0;
94 }
95
96 wxString wxComboBox::GetString(int) const
97 {
98 return wxEmptyString;
99 }
100
101 void wxComboBox::SetString(int, const wxString&)
102 {
103 }
104
105 int wxComboBox::FindString(const wxString&) const
106 {
107 return wxNOT_FOUND;
108 }
109
110 int wxComboBox::GetSelection() const
111 {
112 return 0;
113 }
114
115 int wxComboBox::DoAppend(const wxString&)
116 {
117 return 0;
118 }
119
120 int wxComboBox::DoInsert(const wxString&, int)
121 {
122 return 0;
123 }
124
125 void wxComboBox::DoSetItemClientData(int, void*)
126 {
127 }
128
129 void* wxComboBox::DoGetItemClientData(int) const
130 {
131 return NULL;
132 }
133
134 void wxComboBox::DoSetItemClientObject(int, wxClientData*)
135 {
136 }
137
138 wxClientData* wxComboBox::DoGetItemClientObject(int) const
139 {
140 return NULL;
141 }
142
143 #endif //wxUSE_COMBOBOX