]>
git.saurik.com Git - wxWidgets.git/blob - src/osx/textentry_osx.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/textentry_osx.cpp
3 // Purpose: wxTextEntry
4 // Author: Stefan Csomor
5 // Modified by: Kevin Ollivier
7 // RCS-ID: $Id: textctrl.cpp 54820 2008-07-29 20:04:11Z SC $
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
16 #include "wx/textctrl.h"
23 #include "wx/button.h"
25 #include "wx/settings.h"
26 #include "wx/msgdlg.h"
27 #include "wx/toplevel.h"
31 #include <sys/types.h>
37 #if wxUSE_STD_IOSTREAM
45 #include "wx/filefn.h"
46 #include "wx/sysopt.h"
47 #include "wx/thread.h"
49 #include "wx/osx/private.h"
51 wxString
wxTextEntry::DoGetValue() const
53 return GetTextPeer()->GetStringValue() ;
56 void wxTextEntry::GetSelection(long* from
, long* to
) const
58 GetTextPeer()->GetSelection( from
, to
) ;
61 void wxTextEntry::SetMaxLength(unsigned long len
)
66 // Clipboard operations
68 void wxTextEntry::Copy()
71 GetTextPeer()->Copy() ;
74 void wxTextEntry::Cut()
77 GetTextPeer()->Cut() ;
80 void wxTextEntry::Paste()
83 GetTextPeer()->Paste() ;
86 bool wxTextEntry::CanCopy() const
88 // Can copy if there's a selection
90 GetSelection( &from
, &to
);
95 bool wxTextEntry::CanCut() const
100 // Can cut if there's a selection
102 GetSelection( &from
, &to
);
107 bool wxTextEntry::CanPaste() const
112 return GetTextPeer()->CanPaste() ;
115 void wxTextEntry::SetEditable(bool editable
)
117 if ( editable
!= m_editable
)
119 m_editable
= editable
;
120 GetTextPeer()->SetEditable( editable
) ;
124 void wxTextEntry::SetInsertionPoint(long pos
)
126 SetSelection( pos
, pos
) ;
129 void wxTextEntry::SetInsertionPointEnd()
131 long pos
= GetLastPosition();
132 SetInsertionPoint( pos
);
135 long wxTextEntry::GetInsertionPoint() const
138 GetSelection( &begin
, &end
) ;
143 wxTextPos
wxTextEntry::GetLastPosition() const
145 return GetTextPeer()->GetLastPosition() ;
148 void wxTextEntry::Remove(long from
, long to
)
151 EventsSuppressor
noevents(this);
152 GetTextPeer()->Remove( from
, to
);
155 SendTextUpdatedEventIfAllowed();
158 void wxTextEntry::SetSelection(long from
, long to
)
160 GetTextPeer()->SetSelection( from
, to
) ;
163 void wxTextEntry::WriteText(const wxString
& str
)
166 EventsSuppressor
noevents(this);
167 GetTextPeer()->WriteText( str
);
170 SendTextUpdatedEventIfAllowed();
173 void wxTextEntry::Clear()
176 EventsSuppressor
noevents(this);
177 GetTextPeer()->Clear();
180 SendTextUpdatedEventIfAllowed();
183 bool wxTextEntry::IsEditable() const
188 // ----------------------------------------------------------------------------
190 // ----------------------------------------------------------------------------
192 void wxTextEntry::Undo()
195 GetTextPeer()->Undo() ;
198 void wxTextEntry::Redo()
201 GetTextPeer()->Redo() ;
204 bool wxTextEntry::CanUndo() const
209 return GetTextPeer()->CanUndo() ;
212 bool wxTextEntry::CanRedo() const
217 return GetTextPeer()->CanRedo() ;
220 wxTextWidgetImpl
* wxTextEntry::GetTextPeer() const
222 wxWindow
* const win
= const_cast<wxTextEntry
*>(this)->GetEditableWindow();
224 return win
? dynamic_cast<wxTextWidgetImpl
*>(win
->GetPeer()) : NULL
;
227 #endif // wxUSE_TEXTCTRL