]>
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
)
150 GetTextPeer()->Remove( from
, to
) ;
152 SendTextUpdatedEventIfAllowed();
155 void wxTextEntry::SetSelection(long from
, long to
)
157 GetTextPeer()->SetSelection( from
, to
) ;
160 void wxTextEntry::WriteText(const wxString
& str
)
162 GetTextPeer()->WriteText( str
) ;
164 SendTextUpdatedEventIfAllowed();
167 void wxTextEntry::Clear()
169 GetTextPeer()->Clear() ;
171 SendTextUpdatedEventIfAllowed();
174 bool wxTextEntry::IsEditable() const
179 // ----------------------------------------------------------------------------
181 // ----------------------------------------------------------------------------
183 void wxTextEntry::Undo()
186 GetTextPeer()->Undo() ;
189 void wxTextEntry::Redo()
192 GetTextPeer()->Redo() ;
195 bool wxTextEntry::CanUndo() const
200 return GetTextPeer()->CanUndo() ;
203 bool wxTextEntry::CanRedo() const
208 return GetTextPeer()->CanRedo() ;
211 wxTextWidgetImpl
* wxTextEntry::GetTextPeer() const
213 wxWindow
* const win
= const_cast<wxTextEntry
*>(this)->GetEditableWindow();
215 return win
? dynamic_cast<wxTextWidgetImpl
*>(win
->GetPeer()) : NULL
;
218 #endif // wxUSE_TEXTCTRL