]>
Commit | Line | Data |
---|---|---|
421a8431 DE |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: cocoa/combobox.mm | |
3 | // Purpose: wxComboBox | |
4 | // Author: David Elliott | |
5 | // Modified by: | |
a6660cbb DE |
6 | // Created: 2003/07/14 |
7 | // RCS-ID: $Id$ | |
421a8431 | 8 | // Copyright: (c) 2003 David Elliott |
a6660cbb | 9 | // Licence: wxWindows licence |
421a8431 DE |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
2ee09b55 DE |
12 | #include "wx/wxprec.h" |
13 | ||
14 | #if wxUSE_COMBOBOX | |
15 | ||
421a8431 DE |
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 | ||
584ad2a3 MB |
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 | ||
421a8431 DE |
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; | |
8d656ea9 | 59 | SetNSTextField([[NSComboBox alloc] initWithFrame:MakeDefaultNSRect(size)]); |
421a8431 DE |
60 | [m_cocoaNSView release]; |
61 | [GetNSTextField() setStringValue:wxNSStringWithWxString(value.c_str())]; | |
62 | [GetNSControl() sizeToFit]; | |
63 | if(m_parent) | |
64 | m_parent->CocoaAddChild(this); | |
8d656ea9 DE |
65 | SetInitialFrameRect(pos,size); |
66 | ||
421a8431 DE |
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 | ||
e92ea629 | 83 | void wxComboBox::SetStringSelection(const wxString& selection) |
421a8431 DE |
84 | { |
85 | } | |
86 | ||
87 | void wxComboBox::Clear() | |
88 | { | |
89 | } | |
90 | ||
91 | void wxComboBox::Delete(int) | |
92 | { | |
93 | } | |
94 | ||
95 | int wxComboBox::GetCount() const | |
96 | { | |
97 | return 0; | |
98 | } | |
99 | ||
100 | wxString wxComboBox::GetString(int) const | |
101 | { | |
102 | return wxEmptyString; | |
103 | } | |
104 | ||
105 | void wxComboBox::SetString(int, const wxString&) | |
106 | { | |
107 | } | |
108 | ||
109 | int wxComboBox::FindString(const wxString&) const | |
110 | { | |
111 | return 0; | |
112 | } | |
113 | ||
114 | int wxComboBox::GetSelection() const | |
115 | { | |
116 | return 0; | |
117 | } | |
118 | ||
119 | int wxComboBox::DoAppend(const wxString&) | |
120 | { | |
121 | return 0; | |
122 | } | |
123 | ||
124 | int wxComboBox::DoInsert(const wxString&, int) | |
125 | { | |
126 | return 0; | |
127 | } | |
128 | ||
129 | void wxComboBox::DoSetItemClientData(int, void*) | |
130 | { | |
131 | } | |
132 | ||
133 | void* wxComboBox::DoGetItemClientData(int) const | |
134 | { | |
135 | return NULL; | |
136 | } | |
137 | ||
138 | void wxComboBox::DoSetItemClientObject(int, wxClientData*) | |
139 | { | |
140 | } | |
141 | ||
142 | wxClientData* wxComboBox::DoGetItemClientObject(int) const | |
143 | { | |
144 | return NULL; | |
145 | } | |
146 | ||
2ee09b55 | 147 | #endif //wxUSE_COMBOBOX |