X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c729f16fa54e8484d8600fcb423c0983d71abab2..1788a5f954afb7934efa2e41ccb776a898533203:/src/osx/textentry_osx.cpp diff --git a/src/osx/textentry_osx.cpp b/src/osx/textentry_osx.cpp index 8061d068e4..8fe74193ea 100644 --- a/src/osx/textentry_osx.cpp +++ b/src/osx/textentry_osx.cpp @@ -63,16 +63,22 @@ wxTextEntry::~wxTextEntry() wxString wxTextEntry::DoGetValue() const { + wxCHECK_MSG( GetTextPeer(), wxString(), "Must create the control first" ); + return GetTextPeer()->GetStringValue() ; } void wxTextEntry::GetSelection(long* from, long* to) const { + wxCHECK_RET( GetTextPeer(), "Must create the control first" ); + GetTextPeer()->GetSelection( from , to ) ; } void wxTextEntry::SetMaxLength(unsigned long len) { + if ( GetTextPeer()->CanClipMaxLength() ) + GetTextPeer()->SetMaxLength(len); m_maxLength = len ; } @@ -80,18 +86,24 @@ void wxTextEntry::SetMaxLength(unsigned long len) void wxTextEntry::Copy() { + wxCHECK_RET( GetTextPeer(), "Must create the control first" ); + if (CanCopy()) GetTextPeer()->Copy() ; } void wxTextEntry::Cut() { + wxCHECK_RET( GetTextPeer(), "Must create the control first" ); + if (CanCut()) GetTextPeer()->Cut() ; } void wxTextEntry::Paste() { + wxCHECK_RET( GetTextPeer(), "Must create the control first" ); + if (CanPaste()) GetTextPeer()->Paste() ; } @@ -122,16 +134,20 @@ bool wxTextEntry::CanPaste() const if (!IsEditable()) return false; + wxCHECK_MSG( GetTextPeer(), false, "Must create the control first" ); + return GetTextPeer()->CanPaste() ; } void wxTextEntry::SetEditable(bool editable) { - if ( editable != m_editable ) - { - m_editable = editable ; - GetTextPeer()->SetEditable( editable ) ; - } + if ( editable == m_editable ) + return; + + m_editable = editable ; + + wxCHECK_RET( GetTextPeer(), "Must create the control first" ); + GetTextPeer()->SetEditable( editable ) ; } void wxTextEntry::SetInsertionPoint(long pos) @@ -155,11 +171,15 @@ long wxTextEntry::GetInsertionPoint() const wxTextPos wxTextEntry::GetLastPosition() const { + wxCHECK_MSG( GetTextPeer(), -1, "Must create the control first" ); + return GetTextPeer()->GetLastPosition() ; } void wxTextEntry::Remove(long from, long to) { + wxCHECK_RET( GetTextPeer(), "Must create the control first" ); + { EventsSuppressor noevents(this); GetTextPeer()->Remove( from , to ); @@ -170,11 +190,15 @@ void wxTextEntry::Remove(long from, long to) void wxTextEntry::SetSelection(long from, long to) { + wxCHECK_RET( GetTextPeer(), "Must create the control first" ); + GetTextPeer()->SetSelection( from , to ) ; } void wxTextEntry::WriteText(const wxString& str) { + wxCHECK_RET( GetTextPeer(), "Must create the control first" ); + { EventsSuppressor noevents(this); GetTextPeer()->WriteText( str ); @@ -185,6 +209,8 @@ void wxTextEntry::WriteText(const wxString& str) void wxTextEntry::Clear() { + wxCHECK_RET( GetTextPeer(), "Must create the control first" ); + { EventsSuppressor noevents(this); GetTextPeer()->Clear(); @@ -204,12 +230,16 @@ bool wxTextEntry::IsEditable() const void wxTextEntry::Undo() { + wxCHECK_RET( GetTextPeer(), "Must create the control first" ); + if (CanUndo()) GetTextPeer()->Undo() ; } void wxTextEntry::Redo() { + wxCHECK_RET( GetTextPeer(), "Must create the control first" ); + if (CanRedo()) GetTextPeer()->Redo() ; } @@ -219,6 +249,8 @@ bool wxTextEntry::CanUndo() const if ( !IsEditable() ) return false ; + wxCHECK_MSG( GetTextPeer(), false, "Must create the control first" ); + return GetTextPeer()->CanUndo() ; } @@ -227,6 +259,8 @@ bool wxTextEntry::CanRedo() const if ( !IsEditable() ) return false ; + wxCHECK_MSG( GetTextPeer(), false, "Must create the control first" ); + return GetTextPeer()->CanRedo() ; }