// Recommended setting: 1, only set it to 0 if your compiler doesn't have
// or can't compile <richedit.h>
#if defined(__WIN95__) && !defined(__TWIN32__) && !defined(__GNUWIN32_OLD__)
-#define wxUSE_RICHEDIT 1
+#define wxUSE_RICHEDIT 1
+
+// TODO: This should be ifdef'ed for any compilers that don't support
+// RichEdit 2.0 but do have RichEdit 1.0...
+#define wxUSE_RICHEDIT2 1
+
#else
-#define wxUSE_RICHEDIT 0
+#define wxUSE_RICHEDIT 0
+#define wxUSE_RICHEDIT2 0
#endif
// Set this to 1 to enable support for the owner-drawn menu and listboxes. This
// 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();
}
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);
cf.crTextColor = wxColourToRGB(style.GetTextColour());
}
+#if wxUSE_RICHEDIT2
+ 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;