initial commit (#3506)

This commit is contained in:
Arnav Bhatt 2021-03-06 18:13:05 +00:00 committed by GitHub
parent 8c18617fa7
commit 06f57e1696
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 25 deletions

View file

@ -396,12 +396,6 @@ DrawIconOnOwnerDrawnButtons(
}
}
/* If the owner draw button has keyboard focus make it the default button */
if (pdis->itemState & ODS_FOCUS)
{
SendMessageW(GetParent(pdis->hwndItem), DM_SETDEFID, pdis->CtlID, 0);
}
/* Draw it on the required button */
bRet = BitBlt(pdis->hDC,
(rect.right - rect.left - CX_BITMAP) / 2,
@ -502,7 +496,7 @@ LoadShutdownSelState(VOID)
static INT_PTR
CALLBACK
HotButtonSubclass(
OwnerDrawButtonSubclass(
HWND hButton,
UINT uMsg,
WPARAM wParam,
@ -568,6 +562,20 @@ HotButtonSubclass(
InvalidateRect(hButton, NULL, FALSE);
break;
}
/* Whenever one of the buttons gets the keyboard focus, set it as default button */
case WM_SETFOCUS:
{
SendMessageW(GetParent(hButton), DM_SETDEFID, buttonID, 0);
break;
}
/* Otherwise, set IDCANCEL as default button */
case WM_KILLFOCUS:
{
SendMessageW(GetParent(hButton), DM_SETDEFID, IDCANCEL, 0);
break;
}
}
return CallWindowProcW(pContext->OldButtonProc, hButton, uMsg, wParam, lParam);
}
@ -968,7 +976,7 @@ ShutdownOnInit(
for (int i = 0; i < NUMBER_OF_BUTTONS; i++)
{
SetWindowLongPtrW(GetDlgItem(hDlg, IDC_BUTTON_HIBERNATE + i), GWLP_USERDATA, (LONG_PTR)pContext);
SetWindowLongPtrW(GetDlgItem(hDlg, IDC_BUTTON_HIBERNATE + i), GWLP_WNDPROC, (LONG_PTR)HotButtonSubclass);
SetWindowLongPtrW(GetDlgItem(hDlg, IDC_BUTTON_HIBERNATE + i), GWLP_WNDPROC, (LONG_PTR)OwnerDrawButtonSubclass);
}
/* Update the choice description based on the current selection */

View file

@ -1169,12 +1169,6 @@ BOOL DrawIconOnOwnerDrawnButtons(DRAWITEMSTRUCT* pdis, PLOGOFF_DLG_CONTEXT pCont
}
}
/* If the owner draw button has keyboard focus make it the default button */
if (pdis->itemState & ODS_FOCUS)
{
SendMessageW(GetParent(pdis->hwndItem), DM_SETDEFID, pdis->CtlID, 0);
}
/* Draw it on the required button */
bRet = BitBlt(pdis->hDC,
(rect.right - rect.left - CX_BITMAP) / 2,
@ -1187,7 +1181,7 @@ BOOL DrawIconOnOwnerDrawnButtons(DRAWITEMSTRUCT* pdis, PLOGOFF_DLG_CONTEXT pCont
return bRet;
}
INT_PTR CALLBACK HotButtonSubclass(HWND hButton, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK OwnerDrawButtonSubclass(HWND hButton, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
PLOGOFF_DLG_CONTEXT pContext;
pContext = (PLOGOFF_DLG_CONTEXT)GetWindowLongPtrW(hButton, GWLP_USERDATA);
@ -1233,6 +1227,20 @@ INT_PTR CALLBACK HotButtonSubclass(HWND hButton, UINT uMsg, WPARAM wParam, LPARA
InvalidateRect(hButton, NULL, FALSE);
break;
}
/* Whenever one of the buttons gets the keyboard focus, set it as default button */
case WM_SETFOCUS:
{
SendMessageW(GetParent(hButton), DM_SETDEFID, buttonID, 0);
break;
}
/* Otherwise, set IDCANCEL as default button */
case WM_KILLFOCUS:
{
SendMessageW(GetParent(hButton), DM_SETDEFID, IDCANCEL, 0);
break;
}
}
return CallWindowProcW(pContext->OldButtonProc, hButton, uMsg, wParam, lParam);
}
@ -1366,7 +1374,7 @@ static VOID FancyLogoffOnInit(HWND hwnd, PLOGOFF_DLG_CONTEXT pContext)
{
pContext->bIsButtonHot[i] = FALSE;
SetWindowLongPtrW(GetDlgItem(hwnd, IDC_LOG_OFF_BUTTON + i), GWLP_USERDATA, (LONG_PTR)pContext);
SetWindowLongPtrW(GetDlgItem(hwnd, IDC_LOG_OFF_BUTTON + i), GWLP_WNDPROC, (LONG_PTR)HotButtonSubclass);
SetWindowLongPtrW(GetDlgItem(hwnd, IDC_LOG_OFF_BUTTON + i), GWLP_WNDPROC, (LONG_PTR)OwnerDrawButtonSubclass);
}
}

View file

@ -499,18 +499,18 @@ BEGIN
PUSHBUTTON "Anuluj", IDCANCEL, 95, 39, 50, 14
END
IDD_LOG_OFF_FANCY DIALOGEX 0, 0, 208, 122
IDD_LOG_OFF_FANCY DIALOGEX 0, 0, 278, 122
STYLE NOT WS_VISIBLE | DS_CENTER | DS_SHELLFONT | WS_BORDER | WS_POPUP
FONT 8, "MS Shell Dlg"
BEGIN
CONTROL IDB_DLG_BG, IDC_STATIC, "STATIC", SS_BITMAP | SS_REALSIZECONTROL, 0, 0, 208, 122
CONTROL IDB_REACTOS_FLAG, IDC_STATIC, "STATIC", SS_BITMAP, 176, 1, 32, 26
PUSHBUTTON "&Przełącz użytkownika", IDC_SWITCH_USER_BUTTON, 55, 46, 22, 20, BS_OWNERDRAW | WS_DISABLED | WS_GROUP
PUSHBUTTON "&Wyloguj", IDC_LOG_OFF_BUTTON, 132, 46, 22, 20, BS_OWNERDRAW
PUSHBUTTON "Anuluj", IDCANCEL, 162, 103, 40, 12, WS_GROUP | BS_FLAT
LTEXT "Wylogowywanie z systemu ReactOS", IDC_LOG_OFF_TEXT_STATIC, 4, 7, 170, 19
CTEXT "Przełącz użytkownika", IDC_SWITCH_USER_STATIC, 41, 70, 51, 11
CTEXT "Wyloguj", IDC_LOG_OFF_STATIC, 118, 70, 51, 11
CONTROL IDB_DLG_BG, IDC_STATIC, "STATIC", SS_BITMAP | SS_REALSIZECONTROL, 0, 0, 278, 122
CONTROL IDB_REACTOS_FLAG, IDC_STATIC, "STATIC", SS_BITMAP, 245, 1, 32, 26
PUSHBUTTON "&Przełącz użytkownika", IDC_SWITCH_USER_BUTTON, 86, 46, 22, 20, BS_OWNERDRAW | WS_GROUP
PUSHBUTTON "&Wyloguj", IDC_LOG_OFF_BUTTON, 169, 46, 22, 20, BS_OWNERDRAW
PUSHBUTTON "Anuluj", IDCANCEL, 232, 103, 40, 12, WS_GROUP | BS_FLAT
LTEXT "Wylogowywanie z systemu ReactOS", IDC_LOG_OFF_TEXT_STATIC, 4, 7, 232, 19
CTEXT "Przełącz użytkownika", IDC_SWITCH_USER_STATIC, 52, 70, 90, 11
CTEXT "Wyloguj", IDC_LOG_OFF_STATIC, 155, 70, 51, 11
END
IDD_DISCONNECT DIALOGEX 0, 0, 188, 60