git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60154
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
virtual void SetClientDataType(wxClientDataType clientDataItemsType);
virtual void SetClientDataType(wxClientDataType clientDataItemsType);
+ virtual void EnableTextChangedEvents(bool enable);
+
// the subcontrols
wxComboBoxText* m_text;
wxComboBoxChoice* m_choice;
// the subcontrols
wxComboBoxText* m_text;
wxComboBoxChoice* m_choice;
// editing
virtual void Clear();
// editing
virtual void Clear();
- virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
// sets/clears the dirty flag
virtual void Remove(long from, long to);
// sets/clears the dirty flag
// writing text inserts it at the current position;
// appending always inserts it at the end
virtual void WriteText(const wxString& text);
// writing text inserts it at the current position;
// appending always inserts it at the end
virtual void WriteText(const wxString& text);
- virtual void AppendText(const wxString& text);
// translate between the position (which is just an index into the textctrl
// considering all its contents as a single strings) and (x, y) coordinates
// translate between the position (which is just an index into the textctrl
// considering all its contents as a single strings) and (x, y) coordinates
virtual wxSize DoGetBestSize() const;
virtual wxSize DoGetBestSize() const;
- virtual void DoSetValue(const wxString& value, int flags = 0);
virtual wxString DoGetValue() const;
bool m_editable;
virtual wxString DoGetValue() const;
bool m_editable;
// need to make this public because of the current implementation via callbacks
unsigned long m_maxLength;
// need to make this public because of the current implementation via callbacks
unsigned long m_maxLength;
- bool GetTriggerOnSetValue() const
- {
- return m_triggerOnSetValue;
+ virtual void EnableTextChangedEvents(bool enable)
+ {
+ m_triggerUpdateEvents = enable;
-
- void SetTriggerOnSetValue(bool trigger)
- {
- m_triggerOnSetValue = trigger;
- }
-
- bool m_triggerOnSetValue ;
+
+ bool m_triggerUpdateEvents ;
private :
wxMenu *m_privateContextMenu;
private :
wxMenu *m_privateContextMenu;
: wxTextCtrl( cb , 1 )
{
m_cb = cb;
: wxTextCtrl( cb , 1 )
{
m_cb = cb;
- SetTriggerOnSetValue( false );
+ void ForwardEnableTextChangedEvents(bool enable)
+ {
+ EnableTextChangedEvents(enable);
+ }
protected:
void OnChar( wxKeyEvent& event )
{
protected:
void OnChar( wxKeyEvent& event )
{
private:
wxComboBox *m_cb;
private:
wxComboBox *m_cb;
+void wxComboBox::EnableTextChangedEvents(bool enable)
+{
+ if ( m_text )
+ m_text->ForwardEnableTextChangedEvents(enable);
+}
+
wxString wxComboBox::DoGetValue() const
{
wxCHECK_MSG( m_text, wxString(), "can't be called for read-only combobox" );
wxString wxComboBox::DoGetValue() const
{
wxCHECK_MSG( m_text, wxString(), "can't be called for read-only combobox" );
m_maxLength = 0;
m_privateContextMenu = NULL;
m_maxLength = 0;
m_privateContextMenu = NULL;
- m_triggerOnSetValue = true ;
+ m_triggerUpdateEvents = true ;
}
wxTextCtrl::~wxTextCtrl()
}
wxTextCtrl::~wxTextCtrl()
GetTextPeer()->GetSelection( from , to ) ;
}
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 ;
void wxTextCtrl::SetMaxLength(unsigned long len)
{
m_maxLength = len ;
- wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, m_windowId );
- event.SetEventObject( this );
- HandleWindowEvent( event );
- }
+ SendTextUpdatedEvent();
+ }
}
void wxTextCtrl::Paste()
}
void wxTextCtrl::Paste()
GetTextPeer()->Paste() ;
// TODO: eventually we should add setting the default style again
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();
return GetTextPeer()->GetLastPosition() ;
}
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 ) ;
void wxTextCtrl::Remove(long from, long to)
{
GetTextPeer()->Remove( from , to ) ;
+ if ( m_triggerUpdateEvents )
+ SendTextUpdatedEvent();
}
void wxTextCtrl::SetSelection(long from, long to)
}
void wxTextCtrl::SetSelection(long from, long to)
void wxTextCtrl::WriteText(const wxString& str)
{
GetTextPeer()->WriteText( str ) ;
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() ;
}
void wxTextCtrl::Clear()
{
GetTextPeer()->Clear() ;
+ SendTextUpdatedEvent();
}
bool wxTextCtrl::IsModified() const
}
bool wxTextCtrl::IsModified() const