Skip to content

Commit

Permalink
Use dark theme on checkbox buttons on Windows 11
Browse files Browse the repository at this point in the history
-  replace style and class strings with macro

Fix notepad-plus-plus#14929, close notepad-plus-plus#14930
  • Loading branch information
ozone10 authored and donho committed Apr 3, 2024
1 parent a61f3ab commit 6204f00
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions PowerEditor/src/NppDarkMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ namespace NppDarkMode

if (!g_menuTheme)
{
g_menuTheme = OpenThemeData(hWnd, L"Menu");
g_menuTheme = OpenThemeData(hWnd, VSCLASS_MENU);
}

switch (iBackgroundStateID)
Expand Down Expand Up @@ -1017,7 +1017,7 @@ namespace NppDarkMode
{
if (!hTheme)
{
hTheme = OpenThemeData(hwnd, WC_BUTTON);
hTheme = OpenThemeData(hwnd, VSCLASS_BUTTON);
}
return hTheme != nullptr;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -2331,6 +2331,12 @@ namespace NppDarkMode
}
break;
}

if (NppDarkMode::isWindows11() && p._theme)
{
SetWindowTheme(hwnd, p._themeClassName, nullptr);
}

if (p._subclass)
{
NppDarkMode::subclassButtonControl(hwnd);
Expand Down

0 comments on commit 6204f00

Please sign in to comment.