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