]> git.saurik.com Git - wxWidgets.git/commitdiff
Reimplement wxTextEntry::DoSetValue() in wxStyledTextCtrl.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 30 Sep 2012 22:27:44 +0000 (22:27 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 30 Sep 2012 22:27:44 +0000 (22:27 +0000)
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

include/wx/stc/stc.h
src/stc/stc.cpp
src/stc/stc.cpp.in
src/stc/stc.h.in

index d53593a846f8fd7d566ede45ec71d21bf5e76a9c..091c57ced4f14920100ee91ad3a37d25d5b3ebaa 100644 (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; }
 
index 759030263b4dec1020f795e59d8d3c0cc84f5f9f..2d7199ee05fb3a0530c9f466a89304e06886c744 100644 (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)
 {
index b7cfbc8ec1e9929cf12bbb5566bf37cbd2b61dbc..888f75d478581754d39c92a982bb045231a56f7a 100644 (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)
 {
index d18af6b451eea17827da0e57fd264b93cd7532d7..abbfe19b2a21444bf768c499fc3b5eb69fa73e68 100644 (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; }