Improve wxGenericTreeCtrl colours/fonts updating on theme change
Don't override user-specified colours neither, previously we only did it for the font for some reason. Also do override the colours and the font when the theme changes, which didn't happen after the previous commit because calling SetOwnXXX() changes m_hasXXX to true, so we need to explicitly reset it back.
This commit is contained in:
@@ -1007,11 +1007,30 @@ void wxGenericTreeCtrl::EnableBellOnNoMatch( bool on )
|
||||
|
||||
void wxGenericTreeCtrl::InitVisualAttributes()
|
||||
{
|
||||
// We want to use the default system colours/fonts here unless the user
|
||||
// explicitly configured something different. We also need to reset the
|
||||
// various m_hasXXX variables to false to prevent them from being left set
|
||||
// to "true", as otherwise we wouldn't update the colours/fonts the next
|
||||
// time the system colours change.
|
||||
const wxVisualAttributes attr(GetDefaultAttributes());
|
||||
SetOwnForegroundColour(attr.colFg);
|
||||
SetOwnBackgroundColour(attr.colBg);
|
||||
if (!m_hasFont)
|
||||
if ( !m_hasFgCol )
|
||||
{
|
||||
SetOwnForegroundColour(attr.colFg);
|
||||
m_hasFgCol = false;
|
||||
}
|
||||
|
||||
if ( !m_hasBgCol )
|
||||
{
|
||||
SetOwnBackgroundColour(attr.colBg);
|
||||
m_hasBgCol = false;
|
||||
}
|
||||
|
||||
if ( !m_hasFont )
|
||||
{
|
||||
SetOwnFont(attr.font);
|
||||
m_hasFont = false;
|
||||
}
|
||||
|
||||
|
||||
m_hilightBrush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
|
||||
m_hilightUnfocusedBrush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
|
||||
|
Reference in New Issue
Block a user