Fix dark mode switching for wxStatusBar

When switching to light mode, always use the theme name L"Explorer"
rather than using MSWGetDarkModeSupport().

The theme name and id needed for dark mode does not always work for
light mode. For example, for wxStatusBar combination name=nullptr
id=L"ExplorerStatusBar" results in an un-themed status bar with strange
internal borders and missing gripper.

Closes #26608.
This commit is contained in:
Steve Cornett
2026-06-20 03:16:43 +02:00
committed by Vadim Zeitlin
parent 7f582c5730
commit 6254fc30f2
+10 -1
View File
@@ -4105,6 +4105,7 @@ WXHWND wxWindowMSW::MSWCreateWindowAtAnyPosition(WXDWORD exStyle, const wxChar*
void wxWindowMSW::MSWGetDarkModeSupport(MSWDarkModeSupport& support) const
{
// This is the default theme name for dark mode.
// This theme works for a few controls (buttons, texts, comboboxes) and
// doesn't seem to do any harm for those that don't support it, so use it
// by default.
@@ -4114,7 +4115,15 @@ void wxWindowMSW::MSWGetDarkModeSupport(MSWDarkModeSupport& support) const
void wxWindowMSW::MSWSetDarkOrLightMode(SetMode WXUNUSED(setmode))
{
MSWDarkModeSupport support;
MSWGetDarkModeSupport(support);
if ( wxMSWDarkMode::IsActive() )
{
MSWGetDarkModeSupport(support);
}
else
{
// This is the theme name for light mode.
support.themeName = L"Explorer";
}
// This updates scroll bars, if there are any.
wxMSWDarkMode::AllowForWindow(m_hWnd, support.themeName, support.themeId);