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