Use dark theme on checkbox buttons on Windows 11

-  replace style and class strings with macro

Fix #14929, close #14930
pull/14939/head
ozone10 2024-04-02 08:06:57 +02:00 committed by Don Ho
parent a61f3ab13f
commit 6204f00e88
1 changed files with 10 additions and 4 deletions

View File

@ -864,7 +864,7 @@ namespace NppDarkMode
if (!g_menuTheme)
{
g_menuTheme = OpenThemeData(hWnd, L"Menu");
g_menuTheme = OpenThemeData(hWnd, VSCLASS_MENU);
}
switch (iBackgroundStateID)
@ -1017,7 +1017,7 @@ namespace NppDarkMode
{
if (!hTheme)
{
hTheme = OpenThemeData(hwnd, WC_BUTTON);
hTheme = OpenThemeData(hwnd, VSCLASS_BUTTON);
}
return hTheme != nullptr;
}
@ -2290,12 +2290,12 @@ namespace NppDarkMode
return TRUE;
}
if (wcscmp(className, L"Static") == 0)
if (wcscmp(className, WC_STATIC) == 0)
{
return TRUE;
}
if (wcscmp(className, L"msctls_trackbar32") == 0)
if (wcscmp(className, TRACKBAR_CLASS) == 0)
{
return TRUE;
}
@ -2331,6 +2331,12 @@ namespace NppDarkMode
}
break;
}
if (NppDarkMode::isWindows11() && p._theme)
{
SetWindowTheme(hwnd, p._themeClassName, nullptr);
}
if (p._subclass)
{
NppDarkMode::subclassButtonControl(hwnd);