Fix wxDataViewTreeCtrl expander style switching to light mode

Always apply theme "Explorer" upon switching to light mode, except for
the wxGauge, for which we still need to disable themes.

Closes #26838.
This commit is contained in:
Steve Cornett
2026-08-16 17:17:30 +02:00
committed by Vadim Zeitlin
parent 4b2826661a
commit 828b5f87df
3 changed files with 17 additions and 4 deletions
+4
View File
@@ -627,6 +627,10 @@ protected:
// The theme IDs to use. If neither this field nor the theme name is
// set, no theme is applied to the window.
const wchar_t* themeId = nullptr;
// True if we should apply theme L"Explorer" when switching to light
// mode. Otherwise, nullptr is used.
bool isLightModeThemed = true;
};
virtual void MSWGetDarkModeSupport(MSWDarkModeSupport& support) const;
+1
View File
@@ -102,6 +102,7 @@ void wxGauge::MSWGetDarkModeSupport(MSWDarkModeSupport& support) const
{
support.themeName = L"DarkMode_DarkTheme";
support.themeId = L"Progress";
support.isLightModeThemed = false;
}
else
wxGaugeBase::MSWGetDarkModeSupport(support);
+12 -4
View File
@@ -4158,16 +4158,24 @@ void wxWindowMSW::MSWGetDarkModeSupport(MSWDarkModeSupport& support) const
void wxWindowMSW::MSWSetDarkOrLightMode(SetMode WXUNUSED(setmode))
{
const wchar_t* themeName = nullptr;
const wchar_t* themeId = nullptr;
MSWDarkModeSupport support;
MSWGetDarkModeSupport(support);
if ( wxMSWDarkMode::IsActive() )
{
MSWGetDarkModeSupport(support);
themeName = support.themeName;
themeId = support.themeId;
}
// Else to restore light mode, use support.themeName == nullptr and
// support.themeId == nullptr.
else if ( support.isLightModeThemed )
{
themeName = L"Explorer";
}
//else: Disable themes.
// This updates scroll bars, if there are any.
wxMSWDarkMode::AllowForWindow(m_hWnd, support.themeName, support.themeId);
wxMSWDarkMode::AllowForWindow(m_hWnd, themeName, themeId);
// If the window class has a background brush, update it.
// This is the value in WNDCLASS::hbrBackground.