Preserve wxNotebook custom colours upon dark mode switch

This commit is contained in:
Steve Cornett
2026-06-15 11:41:53 -07:00
parent 4df35f2418
commit f8363719d4
+11 -10
View File
@@ -271,8 +271,9 @@ void wxNotebook::MSWSetDarkOrLightMode(SetMode setmode)
{
wxNotebookBase::MSWSetDarkOrLightMode(setmode);
// Background must always be set.
SetBackgroundColour(GetDefaultAttributes().colBg);
// Background must always be set, unless there is a custom colour.
if ( !m_hasBgCol )
m_backgroundColour = GetDefaultAttributes().colBg;
}
int wxNotebook::MSWGetToolTipMessage() const
@@ -1344,14 +1345,6 @@ void wxNotebook::MSWNotebookPaint()
void wxNotebook::OnPaint(wxPaintEvent& event)
{
// We can rely on the default implementation if we don't have a custom
// background colour (note that it is always set when using dark mode).
if ( !m_hasBgCol )
{
event.Skip();
return;
}
if ( wxMSWDarkMode::IsActive() )
{
// We can't use default painting in dark mode, it just doesn't work
@@ -1360,6 +1353,14 @@ void wxNotebook::OnPaint(wxPaintEvent& event)
return;
}
// We can rely on the default implementation if we don't have a custom
// background colour.
if ( !m_hasBgCol )
{
event.Skip();
return;
}
wxPaintDC dc(this);
RECT rc;