1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cocoa/textctrl.mm
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #include "wx/textctrl.h"
15 #import <Foundation/NSString.h>
16 #import <AppKit/NSTextField.h>
18 IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
19 BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
21 WX_IMPLEMENT_COCOA_OWNER(wxTextCtrl,NSTextField,NSControl,NSView)
23 bool wxTextCtrl::Create(wxWindow *parent, wxWindowID winid,
24 const wxString& value,
28 const wxValidator& validator,
31 if(!CreateControl(parent,winid,pos,size,style,validator,name))
34 SetNSTextField([[NSTextField alloc] initWithFrame:NSMakeRect(0,0,30,30)]);
35 [m_cocoaNSView release];
36 [GetNSTextField() setStringValue:[NSString stringWithCString:value.c_str()]];
37 [GetNSControl() sizeToFit];
39 m_parent->CocoaAddChild(this);
43 wxTextCtrl::~wxTextCtrl()
45 CocoaRemoveFromParent();
49 void wxTextCtrl::Cocoa_didChangeText(void)
53 void wxTextCtrl::AppendText(wxString const&)
57 void wxTextCtrl::SetEditable(bool)
61 void wxTextCtrl::DiscardEdits()
65 void wxTextCtrl::SetSelection(long, long)
69 void wxTextCtrl::ShowPosition(long)
73 void wxTextCtrl::SetInsertionPoint(long)
77 void wxTextCtrl::SetInsertionPointEnd()
81 void wxTextCtrl::Cut()
85 void wxTextCtrl::Copy()
89 void wxTextCtrl::Redo()
93 void wxTextCtrl::Undo()
97 void wxTextCtrl::Clear()
101 void wxTextCtrl::Paste()
105 void wxTextCtrl::Remove(long, long)
109 void wxTextCtrl::Replace(long, long, wxString const&)
113 void wxTextCtrl::SetValue(wxString const&)
117 void wxTextCtrl::WriteText(wxString const&)
121 bool wxTextCtrl::IsEditable() const
126 bool wxTextCtrl::IsModified() const
131 wxString wxTextCtrl::GetLineText(long) const
133 return wxEmptyString;
136 void wxTextCtrl::GetSelection(long*, long*) const
140 bool wxTextCtrl::PositionToXY(long, long*, long*) const
145 long wxTextCtrl::XYToPosition(long, long) const
150 int wxTextCtrl::GetLineLength(long) const
155 long wxTextCtrl::GetLastPosition() const
160 int wxTextCtrl::GetNumberOfLines() const
165 long wxTextCtrl::GetInsertionPoint() const
170 bool wxTextCtrl::CanRedo() const
175 bool wxTextCtrl::CanUndo() const
180 wxString wxTextCtrl::GetValue() const
182 return wxEmptyString;