]>
Commit | Line | Data |
---|---|---|
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::SetStringSelection(const wxString& selection) | |
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 | ||
147 | #endif //wxUSE_COMBOBOX |