Reimplement wxTextEntry::DoSetValue() in wxStyledTextCtrl.

The version inherited from the base class does work already but calling
Scintilla SetText() directly should be more efficient than selecting
everything and then calling ReplaceSelection() as the base class version does,
less code is executed.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72595 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2012-09-30 22:27:44 +00:00
parent 933be2dc39
commit ce364c4ecd
4 changed files with 24 additions and 0 deletions

View File

@ -4710,6 +4710,7 @@ public:
static wxVersionInfo GetLibraryVersionInfo();
protected:
virtual void DoSetValue(const wxString& value, int flags);
virtual wxString DoGetValue() const { return GetText(); }
virtual wxWindow *GetEditableWindow() { return this; }

View File

@ -4372,6 +4372,17 @@ void wxStyledTextCtrl::ScrollToColumn(int column) {
}
void wxStyledTextCtrl::DoSetValue(const wxString& value, int flags)
{
if ( flags & SetValue_SelectionOnly )
ReplaceSelection(value);
else
SetText(value);
// We don't send wxEVT_COMMAND_TEXT_UPDATED anyhow, so ignore the
// SetValue_SendEvent bit of the flags
}
#if wxUSE_TEXTCTRL
bool wxStyledTextCtrl::DoSaveFile(const wxString& filename, int fileType)
{

View File

@ -510,6 +510,17 @@ void wxStyledTextCtrl::ScrollToColumn(int column) {
}
void wxStyledTextCtrl::DoSetValue(const wxString& value, int flags)
{
if ( flags & SetValue_SelectionOnly )
ReplaceSelection(value);
else
SetText(value);
// We don't send wxEVT_COMMAND_TEXT_UPDATED anyhow, so ignore the
// SetValue_SendEvent bit of the flags
}
#if wxUSE_TEXTCTRL
bool wxStyledTextCtrl::DoSaveFile(const wxString& filename, int fileType)
{

View File

@ -452,6 +452,7 @@ public:
static wxVersionInfo GetLibraryVersionInfo();
protected:
virtual void DoSetValue(const wxString& value, int flags);
virtual wxString DoGetValue() const { return GetText(); }
virtual wxWindow *GetEditableWindow() { return this; }