]>
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 |
065e208e | 9 | // Licence: wxWidgets 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 | ||
421a8431 DE |
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 | { | |
64fa6f16 | 107 | return wxNOT_FOUND; |
421a8431 DE |
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 | ||
2ee09b55 | 143 | #endif //wxUSE_COMBOBOX |