Apply dark mode on value dialogs

1. Apply dark mode on value dialogs (dialogs created in preference).
2. Change value dialogs border style.
3. Apply dark mode on close button for other views (fullscreen, post-itand distraction free).

Fix #10253, fix #10210, close #10254
pull/10175/head^2
ozone10 3 years ago committed by Don Ho
parent b12c8ea541
commit a9002c81e5

@ -1235,11 +1235,11 @@ END
IDD_VALUE_DLG DIALOGEX 0, 0, 74, 17
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOOLWINDOW
EXSTYLE WS_EX_DLGMODALFRAME
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1
BEGIN
LTEXT "STATIC :",IDC_VALUE_STATIC,6,4,45,8
EDITTEXT IDC_VALUE_EDIT,49,2,18,14,ES_NUMBER,WS_EX_DLGMODALFRAME
EDITTEXT IDC_VALUE_EDIT,49,3,18,11,ES_NUMBER
END
IDD_BUTTON_DLG DIALOGEX 0, 0, 12, 10

@ -15,10 +15,10 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "lesDlgs.h"
#include "resource.h"
#include "menuCmdID.h"
#include "NppDarkMode.h"
void ValueDlg::init(HINSTANCE hInst, HWND parent, int valueToSet, const TCHAR *text)
{
@ -79,6 +79,8 @@ INT_PTR CALLBACK ValueDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
{
case WM_INITDIALOG :
{
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
::SetDlgItemText(_hSelf, IDC_VALUE_STATIC, _name.c_str());
::SetDlgItemInt(_hSelf, IDC_VALUE_EDIT, _defaultValue, FALSE);
@ -90,6 +92,52 @@ INT_PTR CALLBACK ValueDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
return TRUE;
}
case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
}
break;
}
case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
}
break;
}
case WM_PRINTCLIENT:
{
if (NppDarkMode::isEnabled())
{
return TRUE;
}
break;
}
case WM_ERASEBKGND:
{
if (NppDarkMode::isEnabled())
{
RECT rc = { 0 };
getClientRect(rc);
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush());
return TRUE;
}
break;
}
case NPPM_INTERNAL_REFRESHDARKMODE:
{
NppDarkMode::autoThemeChildControls(_hSelf);
return TRUE;
}
case WM_COMMAND :
{
switch (wParam)
@ -112,16 +160,63 @@ INT_PTR CALLBACK ValueDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
default :
return FALSE;
}
return FALSE;
}
INT_PTR CALLBACK ButtonDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
{
switch (Message)
{
case WM_INITDIALOG :
{
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
return TRUE;
}
case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
}
break;
}
case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
}
break;
}
case WM_PRINTCLIENT:
{
if (NppDarkMode::isEnabled())
{
return TRUE;
}
break;
}
case WM_ERASEBKGND:
{
if (NppDarkMode::isEnabled())
{
RECT rc = { 0 };
getClientRect(rc);
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush());
return TRUE;
}
break;
}
case NPPM_INTERNAL_REFRESHDARKMODE:
{
NppDarkMode::autoThemeChildControls(_hSelf);
return TRUE;
}
@ -166,11 +261,9 @@ INT_PTR CALLBACK ButtonDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
default :
return FALSE;
}
return FALSE;
}
void ButtonDlg::doDialog(bool isRTL)
{
if (!isCreated())

Loading…
Cancel
Save