]> git.saurik.com Git - wxWidgets.git/commitdiff
default style now applies to the text entered by the user as well (patch 574789)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 21 Jul 2002 18:49:10 +0000 (18:49 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 21 Jul 2002 18:49:10 +0000 (18:49 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16241 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/textctrl.h
src/msw/textctrl.cpp

index c5e03295f3b52f537e4ab90dbfa8df53babd7f16..b852df9a84b985e2907636e84284f11d67e4bc13 100644 (file)
@@ -90,6 +90,7 @@ public:
     // apply text attribute to the range of text (only works with richedit
     // controls)
     virtual bool SetStyle(long start, long end, const wxTextAttr& style);
+    virtual bool SetDefaultStyle(const wxTextAttr& style);
 #endif // wxUSE_RICHEDIT
 
     // translate between the position (which is just an index in the text ctrl
index 3824a797f4c310e5275900de3a40ba85556efe40..14801b5eace3cd6e5d5fb2fa3646eca434452b4e 100644 (file)
@@ -1788,6 +1788,19 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
     return ok;
 }
 
+bool wxTextCtrl::SetDefaultStyle(const wxTextAttr& style)
+{
+    if ( !wxTextCtrlBase::SetDefaultStyle(style) )
+        return FALSE;
+
+    // we have to do this or the style wouldn't apply for the text typed by the
+    // user
+    long posLast = GetLastPosition();
+    SetStyle(posLast, posLast, m_defaultStyle);
+
+    return TRUE;
+}
+
 // ----------------------------------------------------------------------------
 // wxRichEditModule
 // ----------------------------------------------------------------------------