]> git.saurik.com Git - wxWidgets.git/blob - src/cocoa/textctrl.mm
In the object destructor, Disassociate the object from its Cocoa counterpart
[wxWidgets.git] / src / cocoa / textctrl.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cocoa/textctrl.mm
3 // Purpose: wxTextCtrl
4 // Author: David Elliott
5 // Modified by:
6 // Created: 2003/03/16
7 // RCS-ID: $Id:
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/app.h"
13 #include "wx/textctrl.h"
14
15 #include "wx/cocoa/string.h"
16
17 #import <Foundation/NSString.h>
18 #import <AppKit/NSTextField.h>
19
20 IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
21 BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
22 END_EVENT_TABLE()
23 WX_IMPLEMENT_COCOA_OWNER(wxTextCtrl,NSTextField,NSControl,NSView)
24
25 bool wxTextCtrl::Create(wxWindow *parent, wxWindowID winid,
26 const wxString& value,
27 const wxPoint& pos,
28 const wxSize& size,
29 long style,
30 const wxValidator& validator,
31 const wxString& name)
32 {
33 if(!CreateControl(parent,winid,pos,size,style,validator,name))
34 return false;
35 m_cocoaNSView = NULL;
36 SetNSTextField([[NSTextField alloc] initWithFrame:NSMakeRect(0,0,30,30)]);
37 [m_cocoaNSView release];
38 [GetNSTextField() setStringValue:[NSString stringWithCString:value.c_str()]];
39 [GetNSControl() sizeToFit];
40 if(m_parent)
41 m_parent->CocoaAddChild(this);
42 return true;
43 }
44
45 wxTextCtrl::~wxTextCtrl()
46 {
47 DisassociateNSTextField(m_cocoaNSView);
48 }
49
50 void wxTextCtrl::Cocoa_didChangeText(void)
51 {
52 }
53
54 void wxTextCtrl::AppendText(wxString const&)
55 {
56 }
57
58 void wxTextCtrl::SetEditable(bool)
59 {
60 }
61
62 void wxTextCtrl::DiscardEdits()
63 {
64 }
65
66 void wxTextCtrl::SetSelection(long, long)
67 {
68 }
69
70 void wxTextCtrl::ShowPosition(long)
71 {
72 }
73
74 void wxTextCtrl::SetInsertionPoint(long)
75 {
76 }
77
78 void wxTextCtrl::SetInsertionPointEnd()
79 {
80 }
81
82 void wxTextCtrl::Cut()
83 {
84 }
85
86 void wxTextCtrl::Copy()
87 {
88 }
89
90 void wxTextCtrl::Redo()
91 {
92 }
93
94 void wxTextCtrl::Undo()
95 {
96 }
97
98 void wxTextCtrl::Clear()
99 {
100 }
101
102 void wxTextCtrl::Paste()
103 {
104 }
105
106 void wxTextCtrl::Remove(long, long)
107 {
108 }
109
110 void wxTextCtrl::Replace(long, long, wxString const&)
111 {
112 }
113
114 void wxTextCtrl::SetValue(wxString const& value)
115 {
116 [GetNSTextField() setStringValue: wxNSStringWithWxString(value)];
117 }
118
119 void wxTextCtrl::WriteText(wxString const&)
120 {
121 }
122
123 bool wxTextCtrl::IsEditable() const
124 {
125 return true;
126 }
127
128 bool wxTextCtrl::IsModified() const
129 {
130 return false;
131 }
132
133 wxString wxTextCtrl::GetLineText(long) const
134 {
135 return wxEmptyString;
136 }
137
138 void wxTextCtrl::GetSelection(long*, long*) const
139 {
140 }
141
142 bool wxTextCtrl::PositionToXY(long, long*, long*) const
143 {
144 return false;
145 }
146
147 long wxTextCtrl::XYToPosition(long, long) const
148 {
149 return 0;
150 }
151
152 int wxTextCtrl::GetLineLength(long) const
153 {
154 return 0;
155 }
156
157 long wxTextCtrl::GetLastPosition() const
158 {
159 return 0;
160 }
161
162 int wxTextCtrl::GetNumberOfLines() const
163 {
164 return 0;
165 }
166
167 long wxTextCtrl::GetInsertionPoint() const
168 {
169 return 0;
170 }
171
172 bool wxTextCtrl::CanRedo() const
173 {
174 return false;
175 }
176
177 bool wxTextCtrl::CanUndo() const
178 {
179 return false;
180 }
181
182 wxString wxTextCtrl::GetValue() const
183 {
184 return wxString([[GetNSTextField() stringValue] lossyCString]);
185 }
186