]> git.saurik.com Git - wxWidgets.git/blame - src/cocoa/textctrl.mm
Improvements to OnIdle processing
[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
12#include "wx/app.h"
13#include "wx/textctrl.h"
14
7d27dcf9
DE
15#include "wx/cocoa/string.h"
16
fb896a32
DE
17#import <Foundation/NSString.h>
18#import <AppKit/NSTextField.h>
19
20IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
21BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
22END_EVENT_TABLE()
23WX_IMPLEMENT_COCOA_OWNER(wxTextCtrl,NSTextField,NSControl,NSView)
24
25bool 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
45wxTextCtrl::~wxTextCtrl()
46{
570aaadf 47 DisassociateNSTextField(m_cocoaNSView);
fb896a32
DE
48}
49
50void wxTextCtrl::Cocoa_didChangeText(void)
51{
52}
53
54void wxTextCtrl::AppendText(wxString const&)
55{
56}
57
58void wxTextCtrl::SetEditable(bool)
59{
60}
61
62void wxTextCtrl::DiscardEdits()
63{
64}
65
66void wxTextCtrl::SetSelection(long, long)
67{
68}
69
70void wxTextCtrl::ShowPosition(long)
71{
72}
73
74void wxTextCtrl::SetInsertionPoint(long)
75{
76}
77
78void wxTextCtrl::SetInsertionPointEnd()
79{
80}
81
82void wxTextCtrl::Cut()
83{
84}
85
86void wxTextCtrl::Copy()
87{
88}
89
90void wxTextCtrl::Redo()
91{
92}
93
94void wxTextCtrl::Undo()
95{
96}
97
98void wxTextCtrl::Clear()
99{
100}
101
102void wxTextCtrl::Paste()
103{
104}
105
106void wxTextCtrl::Remove(long, long)
107{
108}
109
110void wxTextCtrl::Replace(long, long, wxString const&)
111{
112}
113
7d27dcf9 114void wxTextCtrl::SetValue(wxString const& value)
fb896a32 115{
7d27dcf9 116 [GetNSTextField() setStringValue: wxNSStringWithWxString(value)];
fb896a32
DE
117}
118
119void wxTextCtrl::WriteText(wxString const&)
120{
121}
122
123bool wxTextCtrl::IsEditable() const
124{
125 return true;
126}
127
128bool wxTextCtrl::IsModified() const
129{
130 return false;
131}
132
133wxString wxTextCtrl::GetLineText(long) const
134{
135 return wxEmptyString;
136}
137
138void wxTextCtrl::GetSelection(long*, long*) const
139{
140}
141
142bool wxTextCtrl::PositionToXY(long, long*, long*) const
143{
144 return false;
145}
146
147long wxTextCtrl::XYToPosition(long, long) const
148{
149 return 0;
150}
151
152int wxTextCtrl::GetLineLength(long) const
153{
154 return 0;
155}
156
157long wxTextCtrl::GetLastPosition() const
158{
159 return 0;
160}
161
162int wxTextCtrl::GetNumberOfLines() const
163{
164 return 0;
165}
166
167long wxTextCtrl::GetInsertionPoint() const
168{
169 return 0;
170}
171
172bool wxTextCtrl::CanRedo() const
173{
174 return false;
175}
176
177bool wxTextCtrl::CanUndo() const
178{
179 return false;
180}
181
182wxString wxTextCtrl::GetValue() const
183{
7d27dcf9 184 return wxString([[GetNSTextField() stringValue] lossyCString]);
fb896a32
DE
185}
186