Fixed setting colours of wxSlider and wxRadioBox in wxMSW.

Sibling windows (like labels and radio buttons) need to be explicitly
refreshed when foreground or background colour is changed. This is implemented
by invoking newly implemented method wxSubwindows::Refresh every time the
colour of the control is changed.

Note: Setting foreground colour of wxRadioBox still doesn't work correctly
when themes are enabled.

Closes #17142.
This commit is contained in:
Artur Wieczorek
2015-09-11 18:47:49 +02:00
committed by Vadim Zeitlin
parent 7f08dbbf78
commit 865c8565af
4 changed files with 41 additions and 1 deletions

View File

@@ -128,6 +128,18 @@ public:
}
}
// add all windows to update region to force redraw
void Refresh()
{
for ( size_t n = 0; n < m_count; n++ )
{
if ( m_hwnds[n] )
{
::InvalidateRect(m_hwnds[n], NULL, FALSE /* don't erase bg */);
}
}
}
// find the bounding box for all windows
wxRect GetBoundingBox() const
{
@@ -212,7 +224,29 @@ private:
subwins->SetFont(font); \
\
return true; \
}
} \
\
bool cname::SetForegroundColour(const wxColour& colour) \
{ \
if ( !base::SetForegroundColour(colour) ) \
return false; \
\
if ( subwins ) \
subwins->Refresh(); \
\
return true; \
} \
\
bool cname::SetBackgroundColour(const wxColour& colour) \
{ \
if ( !base::SetBackgroundColour(colour) ) \
return false; \
\
if ( subwins ) \
subwins->Refresh(); \
\
return true; \
} \
#endif // _WX_MSW_SUBWIN_H_