Make DarkMode title bar to apply on all dialog on dark mode

Also remove border from clipboard history panel.

Close  #10023
This commit is contained in:
ozone10 2021-06-17 16:02:14 +02:00 committed by Don Ho
parent bef4da61be
commit ffbf3af029
7 changed files with 36 additions and 16 deletions

View File

@ -7512,11 +7512,18 @@ void Notepad_plus::refreshDarkMode()
if (NppDarkMode::isExperimentalEnabled()) if (NppDarkMode::isExperimentalEnabled())
{ {
NppDarkMode::allowDarkModeForApp(NppDarkMode::isEnabled()); NppDarkMode::allowDarkModeForApp(NppDarkMode::isEnabled());
NppDarkMode::allowDarkModeForWindow(_pPublicInterface->getHSelf(), NppDarkMode::isEnabled());
NppDarkMode::allowDarkModeForWindow(_findReplaceDlg.getHSelf(), NppDarkMode::isEnabled());
NppDarkMode::setTitleBarThemeColor(_pPublicInterface->getHSelf(), NppDarkMode::isEnabled());
NppDarkMode::setTitleBarThemeColor(_findReplaceDlg.getHSelf(), NppDarkMode::isEnabled());
} }
NppDarkMode::setDarkTitleBar(_pPublicInterface->getHSelf());
for (auto &hwndDlg : _hModelessDlgs)
{
NppDarkMode::setDarkTitleBar(hwndDlg);
}
for (auto &docCont : _dockingManager.getContainerInfo())
{
NppDarkMode::setDarkTitleBar(docCont->getCaptionWnd());
}
SendMessage(_findReplaceDlg.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0); SendMessage(_findReplaceDlg.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
SendMessage(_incrementFindDlg.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0); SendMessage(_incrementFindDlg.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
RedrawWindow(_pPublicInterface->getHSelf(), nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN); RedrawWindow(_pPublicInterface->getHSelf(), nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN);

View File

@ -94,11 +94,7 @@ LRESULT Notepad_plus_Window::runProc(HWND hwnd, UINT message, WPARAM wParam, LPA
{ {
try try
{ {
if (NppDarkMode::isExperimentalEnabled()) NppDarkMode::setDarkTitleBar(hwnd);
{
NppDarkMode::allowDarkModeForWindow(hwnd, NppDarkMode::isEnabled());
NppDarkMode::setTitleBarThemeColor(hwnd, NppDarkMode::isEnabled());
}
_notepad_plus_plus_core._pPublicInterface = this; _notepad_plus_plus_core._pPublicInterface = this;
LRESULT lRet = _notepad_plus_plus_core.init(hwnd); LRESULT lRet = _notepad_plus_plus_core.init(hwnd);

View File

@ -1039,6 +1039,23 @@ namespace NppDarkMode
autoSubclassAndThemeChildControls(hwndParent, false, true); autoSubclassAndThemeChildControls(hwndParent, false, true);
} }
void setDarkTitleBar(HWND hwnd)
{
bool useDark = NppDarkMode::isExperimentalEnabled() && NppDarkMode::isEnabled();
NppDarkMode::allowDarkModeForWindow(hwnd, useDark);
NppDarkMode::setTitleBarThemeColor(hwnd, useDark);
if (useDark)
{
SetWindowTheme(hwnd, L"Explorer", nullptr);
}
else
{
SetWindowTheme(hwnd, nullptr, nullptr);
}
}
void setDarkTooltips(HWND hwnd, ToolTipsType type) void setDarkTooltips(HWND hwnd, ToolTipsType type)
{ {
if (NppDarkMode::isEnabled()) if (NppDarkMode::isEnabled())

View File

@ -82,5 +82,6 @@ namespace NppDarkMode
void autoSubclassAndThemeChildControls(HWND hwndParent, bool subclass = true, bool theme = true); void autoSubclassAndThemeChildControls(HWND hwndParent, bool subclass = true, bool theme = true);
void autoThemeChildControls(HWND hwndParent); void autoThemeChildControls(HWND hwndParent);
void setDarkTitleBar(HWND hwnd);
void setDarkTooltips(HWND hwnd, ToolTipsType type); void setDarkTooltips(HWND hwnd, ToolTipsType type);
} }

View File

@ -884,12 +884,6 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case WM_INITDIALOG : case WM_INITDIALOG :
{ {
if (NppDarkMode::isExperimentalEnabled())
{
NppDarkMode::allowDarkModeForWindow(_hSelf, NppDarkMode::isEnabled());
NppDarkMode::setTitleBarThemeColor(_hSelf, NppDarkMode::isEnabled());
}
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf); NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT); HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);

View File

@ -24,5 +24,5 @@ EXSTYLE WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE
CAPTION "Clipboard History" CAPTION "Clipboard History"
FONT 8, "MS Sans Serif", 0, 0, 0x0 FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN BEGIN
LISTBOX IDC_LIST_CLIPBOARD,50,44,78,120,LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP LISTBOX IDC_LIST_CLIPBOARD,50,44,78,120,LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP | NOT WS_BORDER
END END

View File

@ -18,6 +18,7 @@
#include <windows.h> #include <windows.h>
#include "StaticDialog.h" #include "StaticDialog.h"
#include "Common.h" #include "Common.h"
#include "NppDarkMode.h"
StaticDialog::~StaticDialog() StaticDialog::~StaticDialog()
{ {
@ -222,6 +223,8 @@ void StaticDialog::create(int dialogID, bool isRTL, bool msgDestParent)
return; return;
} }
NppDarkMode::setDarkTitleBar(_hSelf);
// if the destination of message NPPM_MODELESSDIALOG is not its parent, then it's the grand-parent // if the destination of message NPPM_MODELESSDIALOG is not its parent, then it's the grand-parent
::SendMessage(msgDestParent ? _hParent : (::GetParent(_hParent)), NPPM_MODELESSDIALOG, MODELESSDIALOGADD, reinterpret_cast<WPARAM>(_hSelf)); ::SendMessage(msgDestParent ? _hParent : (::GetParent(_hParent)), NPPM_MODELESSDIALOG, MODELESSDIALOGADD, reinterpret_cast<WPARAM>(_hSelf));
} }
@ -232,6 +235,8 @@ INT_PTR CALLBACK StaticDialog::dlgProc(HWND hwnd, UINT message, WPARAM wParam, L
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
NppDarkMode::setDarkTitleBar(hwnd);
StaticDialog *pStaticDlg = reinterpret_cast<StaticDialog *>(lParam); StaticDialog *pStaticDlg = reinterpret_cast<StaticDialog *>(lParam);
pStaticDlg->_hSelf = hwnd; pStaticDlg->_hSelf = hwnd;
::SetWindowLongPtr(hwnd, GWLP_USERDATA, static_cast<LONG_PTR>(lParam)); ::SetWindowLongPtr(hwnd, GWLP_USERDATA, static_cast<LONG_PTR>(lParam));