Fix background colour returned by wxTextCtrl::GetStyle() in wxMSW

Don't return the background colour unless it's really set, otherwise we
returned black background even if it was never changed.
This commit is contained in:
Vadim Zeitlin
2016-05-05 03:05:45 +02:00
parent 25520cbb80
commit e2b13a7b8e
2 changed files with 8 additions and 2 deletions

View File

@@ -3054,8 +3054,13 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
#if wxUSE_RICHEDIT2
if ( m_verRichEdit != 1 )
{
// cf.dwMask |= CFM_BACKCOLOR;
style.SetBackgroundColour(wxColour(cf.crBackColor));
// Notice that, surprisingly, CFM_BACKCOLOR is still set in the mask
// even when CFE_AUTOBACKCOLOR is set in the effects, indicating that
// the background colour is not used.
if ( !(cf.dwEffects & CFE_AUTOBACKCOLOR) && (cf.dwMask & CFM_BACKCOLOR) )
{
style.SetBackgroundColour(wxColour(cf.crBackColor));
}
}
#endif // wxUSE_RICHEDIT2