X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e80591b930c036485dbeb11358f0bce6330bc524..606b005fb2b535b34d1ca45d2d06ee86718e8b1c:/src/msw/textctrl.cpp diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index eb624126c2..13d6e784d3 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -28,6 +28,8 @@ #pragma hdrstop #endif +#if wxUSE_TEXTCTRL + #ifndef WX_PRECOMP #include "wx/textctrl.h" #include "wx/settings.h" @@ -54,13 +56,7 @@ #include #include -#if wxUSE_IOSTREAMH -# include -#else -# include -#endif - -#if wxUSE_RICHEDIT && !defined(__GNUWIN32_OLD__) +#if wxUSE_RICHEDIT && (!defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__)) #include #endif @@ -1233,10 +1229,11 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style) // the rich text control doesn't handle setting background colour, so don't // even try if it's the only thing we want to change - if ( !style.HasFont() && !style.HasTextColour() ) + if ( wxRichEditModule::GetLoadedVersion() < 2 && + !style.HasFont() && !style.HasTextColour() ) { - // nothing to do: return TRUE if there was really nothing to doand - // FALSE fi we failed to set bg colour + // nothing to do: return TRUE if there was really nothing to do and + // FALSE if we failed to set bg colour return !style.HasBackgroundColour(); } @@ -1260,7 +1257,11 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style) SendMessage(GetHwnd(), EM_SETSEL, (WPARAM) start, (LPARAM) end); // initialize CHARFORMAT struct +#if wxUSE_RICHEDIT2 + CHARFORMAT2 cf; +#else CHARFORMAT cf; +#endif wxZeroMemory(cf); cf.cbSize = sizeof(cf); @@ -1307,6 +1308,17 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style) cf.crTextColor = wxColourToRGB(style.GetTextColour()); } +#if wxUSE_RICHEDIT2 +#ifndef CFM_BACKCOLOR +#define CFM_BACKCOLOR 0x04000000 +#endif + + if ( wxRichEditModule::GetLoadedVersion() > 1 && style.HasBackgroundColour() ) + { + cf.dwMask |= CFM_BACKCOLOR; + cf.crBackColor = wxColourToRGB(style.GetBackgroundColour()); + } +#endif // do format the selection bool ok = ::SendMessage(GetHwnd(), EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf) != 0; @@ -1387,3 +1399,4 @@ bool wxRichEditModule::Load(int version) #endif // wxUSE_RICHEDIT +#endif // wxUSE_TEXTCTRL