Fix regression: disable Explorer Theme for TreeView

Ref: #10061

Close #10062
This commit is contained in:
ozone10 2021-06-24 10:44:12 +02:00 committed by Don Ho
parent 3347044595
commit 1da707128a
6 changed files with 11 additions and 7 deletions

View File

@ -1104,9 +1104,13 @@ namespace NppDarkMode
::SendMessage(hwnd, TB_SETCOLORSCHEME, 0, reinterpret_cast<LPARAM>(&scheme)); ::SendMessage(hwnd, TB_SETCOLORSCHEME, 0, reinterpret_cast<LPARAM>(&scheme));
} }
void setExplorerTheme(HWND hwnd, bool doEnable) void setExplorerTheme(HWND hwnd, bool doEnable, bool isTreeView)
{ {
if (doEnable) if (isTreeView)
{
SetWindowTheme(hwnd, nullptr, nullptr);
}
else if (doEnable)
{ {
NppDarkMode::allowDarkModeForWindow(hwnd, NppDarkMode::isEnabled() && NppDarkMode::isExperimentalEnabled()); NppDarkMode::allowDarkModeForWindow(hwnd, NppDarkMode::isEnabled() && NppDarkMode::isExperimentalEnabled());
SetWindowTheme(hwnd, L"Explorer", nullptr); SetWindowTheme(hwnd, L"Explorer", nullptr);

View File

@ -87,5 +87,5 @@ namespace NppDarkMode
void setDarkTooltips(HWND hwnd, ToolTipsType type); void setDarkTooltips(HWND hwnd, ToolTipsType type);
void setDarkLineAbovePanelToolbar(HWND hwnd); void setDarkLineAbovePanelToolbar(HWND hwnd);
void setExplorerTheme(HWND hwnd, bool doEnable); void setExplorerTheme(HWND hwnd, bool doEnable, bool isTreeView = false);
} }

View File

@ -174,7 +174,7 @@ INT_PTR CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
NppDarkMode::setDarkTooltips(_hToolbarMenu, NppDarkMode::ToolTipsType::toolbar); NppDarkMode::setDarkTooltips(_hToolbarMenu, NppDarkMode::ToolTipsType::toolbar);
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu); NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
NppDarkMode::setExplorerTheme(_treeView.getHSelf(), true); NppDarkMode::setExplorerTheme(_treeView.getHSelf(), true, true);
NppDarkMode::setDarkTooltips(_treeView.getHSelf(), NppDarkMode::ToolTipsType::treeview); NppDarkMode::setDarkTooltips(_treeView.getHSelf(), NppDarkMode::ToolTipsType::treeview);
return TRUE; return TRUE;
} }

View File

@ -896,7 +896,7 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA
NppDarkMode::setDarkTooltips(_hToolbarMenu, NppDarkMode::ToolTipsType::toolbar); NppDarkMode::setDarkTooltips(_hToolbarMenu, NppDarkMode::ToolTipsType::toolbar);
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu); NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
NppDarkMode::setExplorerTheme(_treeView.getHSelf(), true); NppDarkMode::setExplorerTheme(_treeView.getHSelf(), true, true);
NppDarkMode::setDarkTooltips(_treeView.getHSelf(), NppDarkMode::ToolTipsType::treeview); NppDarkMode::setDarkTooltips(_treeView.getHSelf(), NppDarkMode::ToolTipsType::treeview);
return TRUE; return TRUE;
} }

View File

@ -101,7 +101,7 @@ INT_PTR CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
{ {
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu); NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
NppDarkMode::setExplorerTheme(_treeView.getHSelf(), true); NppDarkMode::setExplorerTheme(_treeView.getHSelf(), true, true);
NppDarkMode::setDarkTooltips(_treeView.getHSelf(), NppDarkMode::ToolTipsType::treeview); NppDarkMode::setDarkTooltips(_treeView.getHSelf(), NppDarkMode::ToolTipsType::treeview);
return TRUE; return TRUE;
} }

View File

@ -43,7 +43,7 @@ void TreeView::init(HINSTANCE hInst, HWND parent, int treeViewID)
_hInst, _hInst,
nullptr); nullptr);
NppDarkMode::setExplorerTheme(_hSelf, true); NppDarkMode::setExplorerTheme(_hSelf, true, true);
NppDarkMode::setDarkTooltips(_hSelf, NppDarkMode::ToolTipsType::treeview); NppDarkMode::setDarkTooltips(_hSelf, NppDarkMode::ToolTipsType::treeview);
int itemHeight = NppParameters::getInstance()._dpiManager.scaleY(CY_ITEMHEIGHT); int itemHeight = NppParameters::getInstance()._dpiManager.scaleY(CY_ITEMHEIGHT);