]>
git.saurik.com Git - wxWidgets.git/blob - src/osx/textentry_osx.cpp
3e2ca4f22dffc6933924ee23b79551a2f808c72b
   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 
) ; 
 153 void wxTextEntry::SetSelection(long from
, long to
) 
 155     GetTextPeer()->SetSelection( from 
, to 
) ; 
 158 void wxTextEntry::WriteText(const wxString
& str
) 
 160     GetTextPeer()->WriteText( str 
) ; 
 163 void wxTextEntry::Clear() 
 165     GetTextPeer()->Clear() ; 
 168 bool wxTextEntry::IsEditable() const 
 173 // ---------------------------------------------------------------------------- 
 175 // ---------------------------------------------------------------------------- 
 177 void wxTextEntry::Undo() 
 180         GetTextPeer()->Undo() ; 
 183 void wxTextEntry::Redo() 
 186         GetTextPeer()->Redo() ; 
 189 bool wxTextEntry::CanUndo() const 
 194     return GetTextPeer()->CanUndo() ; 
 197 bool wxTextEntry::CanRedo() const 
 202     return GetTextPeer()->CanRedo() ; 
 205 wxTextWidgetImpl 
* wxTextEntry::GetTextPeer() const 
 207     wxWindow 
* const win 
= const_cast<wxTextEntry 
*>(this)->GetEditableWindow(); 
 209     return win 
? dynamic_cast<wxTextWidgetImpl 
*>(win
->GetPeer()) : NULL
; 
 212 #endif // wxUSE_TEXTCTRL