mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
+ try: No DarkMode for ComboBoxEx32 control (no owner-drawn hook)?
This commit is contained in:
parent
54b6acb9be
commit
17ddff1e11
@ -187,7 +187,8 @@ CAPTION "Encoding"
|
||||
FONT 9, "Segoe UI", 400, 0, 0x1
|
||||
BEGIN
|
||||
GROUPBOX "Default Encoding (new file):",IDC_STATIC,7,7,183,48,0,WS_EX_TRANSPARENT
|
||||
CONTROL "",IDC_ENCODINGLIST,"ComboBoxEx32",CBS_DROPDOWNLIST | WS_CLIPSIBLINGS | WS_VSCROLL | WS_TABSTOP,14,19,167,128
|
||||
CONTROL "", IDC_ENCODINGLIST,"ComboBoxEx32", CBS_DROPDOWNLIST | WS_CLIPSIBLINGS | WS_VSCROLL | WS_TABSTOP,14,19,167,128
|
||||
//COMBOBOX IDC_ENCODINGLIST, 14, 19, 167, 128, CBS_OWNERDRAWFIXED | CBS_DROPDOWNLIST | WS_CLIPSIBLINGS | WS_VSCROLL | WS_TABSTOP,
|
||||
CONTROL "Use as &fallback on detection failure.",IDC_USEASREADINGFALLBACK,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,38,155,10
|
||||
GROUPBOX "Encoding Detection: ",IDC_STATIC,7,58,183,88,0,WS_EX_TRANSPARENT
|
||||
|
||||
@ -3372,18 +3372,18 @@ static INT_PTR CALLBACK SelectDefEncodingDlgProc(HWND hwnd, UINT umsg, WPARAM wP
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)lParam);
|
||||
|
||||
SetDialogIconNP3(hwnd);
|
||||
|
||||
InitWindowCommon(hwnd, true);
|
||||
|
||||
#ifdef D_NP3_WIN10_DARK_MODE
|
||||
if (UseDarkMode()) {
|
||||
SetExplorerTheme(GetDlgItem(hwnd, IDOK));
|
||||
SetExplorerTheme(GetDlgItem(hwnd, IDCANCEL));
|
||||
SetExplorerTheme(GetDlgItem(hwnd, IDC_ENCODINGLIST));
|
||||
//~SetExplorerTheme(GetDlgItem(hwnd, IDC_ENCODINGLIST)); ~ OWNERDRAWN -> WM_DRAWITEM
|
||||
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
|
||||
int const ctl[] = { IDC_USEASREADINGFALLBACK, IDC_ASCIIASUTF8, IDC_RELIABLE_DETECTION_RES, IDC_NFOASOEM,
|
||||
IDC_ENCODINGFROMFILEVARS, IDC_NOUNICODEDETECTION, IDC_NOANSICPDETECTION, IDC_STATIC };
|
||||
int const ctl[] = { IDC_ENCODINGLIST, IDC_USEASREADINGFALLBACK, IDC_ASCIIASUTF8, IDC_RELIABLE_DETECTION_RES,
|
||||
IDC_NFOASOEM, IDC_ENCODINGFROMFILEVARS, IDC_NOUNICODEDETECTION, IDC_NOANSICPDETECTION, IDC_STATIC };
|
||||
for (int i = 0; i < COUNTOF(ctl); ++i) {
|
||||
SetWindowTheme(GetDlgItem(hwnd, ctl[i]), L"", L""); // remove theme for BS_AUTORADIOBUTTON
|
||||
}
|
||||
@ -3399,6 +3399,7 @@ static INT_PTR CALLBACK SelectDefEncodingDlgProc(HWND hwnd, UINT umsg, WPARAM wP
|
||||
DeleteObject(hbmp);
|
||||
SendDlgItemMessage(hwnd, IDC_ENCODINGLIST, CBEM_SETIMAGELIST, 0, (LPARAM)himl);
|
||||
SendDlgItemMessage(hwnd, IDC_ENCODINGLIST, CB_SETEXTENDEDUI, true, 0);
|
||||
//SendDlgItemMessage(hwnd, IDC_ENCODINGLIST, CBEM_SETEXTENDEDSTYLE, 0, CBES_EX_TEXTENDELLIPSIS);
|
||||
|
||||
Encoding_AddToComboboxEx(GetDlgItem(hwnd, IDC_ENCODINGLIST), pdd->idEncoding, 0);
|
||||
|
||||
@ -3449,7 +3450,7 @@ static INT_PTR CALLBACK SelectDefEncodingDlgProc(HWND hwnd, UINT umsg, WPARAM wP
|
||||
AllowDarkModeForWindow(hwnd, darkModeEnabled);
|
||||
RefreshTitleBarThemeColor(hwnd);
|
||||
|
||||
int const buttons[] = { IDOK, IDCANCEL, IDC_ENCODINGLIST };
|
||||
int const buttons[] = { IDOK, IDCANCEL };
|
||||
for (int id = 0; id < COUNTOF(buttons); ++id) {
|
||||
HWND const hBtn = GetDlgItem(hwnd, buttons[id]);
|
||||
AllowDarkModeForWindow(hBtn, darkModeEnabled);
|
||||
@ -3459,6 +3460,28 @@ static INT_PTR CALLBACK SelectDefEncodingDlgProc(HWND hwnd, UINT umsg, WPARAM wP
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_DRAWITEM:
|
||||
{
|
||||
/// TODO: migrate: currently "ComboBoxEx32" control is used, instead of COMBOBOX control
|
||||
/// "ComboBoxEx32" does not support WM_DRAWITEM (OwnerDrawn)
|
||||
/// see https://docs.microsoft.com/en-us/windows/win32/controls/comboboxex-control-reference
|
||||
/// vs
|
||||
/// https://docs.microsoft.com/en-us/windows/win32/controls/create-an-owner-drawn-combo-box
|
||||
///
|
||||
if (LOWORD(wParam) == IDC_ENCODINGLIST)
|
||||
{
|
||||
const DRAWITEMSTRUCT *const pDIS = (const DRAWITEMSTRUCT *const)lParam;
|
||||
|
||||
//HWND const hWndItem = pDIS->hwndItem;
|
||||
HDC const hdc = pDIS->hDC;
|
||||
//RECT const rc = pDIS->rcItem;
|
||||
|
||||
SetBkColor(hdc, UseDarkMode() ? g_rgbDarkBkgColor : GetSysColor(COLOR_BTNFACE));
|
||||
SetTextColor(hdc, UseDarkMode() ? g_rgbDarkTextColor : GetSysColor(COLOR_BTNTEXT));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -3497,7 +3520,8 @@ static INT_PTR CALLBACK SelectDefEncodingDlgProc(HWND hwnd, UINT umsg, WPARAM wP
|
||||
}
|
||||
break;
|
||||
|
||||
case IDOK: {
|
||||
case IDOK:
|
||||
{
|
||||
PENCODEDLG pdd = (PENCODEDLG)GetWindowLongPtr(hwnd, DWLP_USER);
|
||||
if (Encoding_GetFromComboboxEx(GetDlgItem(hwnd, IDC_ENCODINGLIST), &pdd->idEncoding)) {
|
||||
if (pdd->idEncoding < 0) {
|
||||
@ -3519,7 +3543,7 @@ static INT_PTR CALLBACK SelectDefEncodingDlgProc(HWND hwnd, UINT umsg, WPARAM wP
|
||||
PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_ENCODINGLIST)), 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hwnd, IDCANCEL);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user