m_maxLength = 0;
m_privateContextMenu = NULL;
- m_triggerOnSetValue = true ;
+ m_triggerUpdateEvents = true ;
}
wxTextCtrl::~wxTextCtrl()
GetTextPeer()->CheckSpelling(check);
}
-wxString wxTextCtrl::GetValue() const
+wxString wxTextCtrl::DoGetValue() const
{
return GetTextPeer()->GetStringValue() ;
}
GetTextPeer()->GetSelection( from , to ) ;
}
-void wxTextCtrl::DoSetValue(const wxString& str, int flags)
-{
- // optimize redraws
- if ( GetValue() == str )
- return;
-
- GetTextPeer()->SetStringValue( str ) ;
-
- if ( (flags & SetValue_SendEvent) && m_triggerOnSetValue )
- {
- SendTextUpdatedEvent();
- }
-}
-
void wxTextCtrl::SetMaxLength(unsigned long len)
{
m_maxLength = len ;
{
GetTextPeer()->Cut() ;
- wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, m_windowId );
- event.SetEventObject( this );
- HandleWindowEvent( event );
- }
+ SendTextUpdatedEvent();
+ }
}
void wxTextCtrl::Paste()
GetTextPeer()->Paste() ;
// TODO: eventually we should add setting the default style again
-
- wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, m_windowId );
- event.SetEventObject( this );
- HandleWindowEvent( event );
+ SendTextUpdatedEvent();
}
}
void wxTextCtrl::SetInsertionPointEnd()
{
- wxTextPos pos = GetLastPosition();
+ long pos = GetLastPosition();
SetInsertionPoint( pos );
}
return GetTextPeer()->GetLastPosition() ;
}
-void wxTextCtrl::Replace(long from, long to, const wxString& str)
-{
- GetTextPeer()->Replace( from , to , str ) ;
-}
-
void wxTextCtrl::Remove(long from, long to)
{
GetTextPeer()->Remove( from , to ) ;
+ if ( m_triggerUpdateEvents )
+ SendTextUpdatedEvent();
}
void wxTextCtrl::SetSelection(long from, long to)
void wxTextCtrl::WriteText(const wxString& str)
{
GetTextPeer()->WriteText( str ) ;
-}
-
-void wxTextCtrl::AppendText(const wxString& text)
-{
- SetInsertionPointEnd();
- WriteText( text );
+ if ( m_triggerUpdateEvents )
+ SendTextUpdatedEvent();
}
void wxTextCtrl::Clear()
{
GetTextPeer()->Clear() ;
+ SendTextUpdatedEvent();
}
bool wxTextCtrl::IsModified() const
{
}
-wxTextPos wxTextWidgetImpl::GetLastPosition() const
+long wxTextWidgetImpl::GetLastPosition() const
{
return GetStringValue().length() ;
}