From 95558d0f30e272d278453169f42cadbf6d9a2cf5 Mon Sep 17 00:00:00 2001 From: Ged Murphy Date: Tue, 7 Mar 2006 23:33:19 +0000 Subject: [PATCH] - fix UI state handling - by Thomas Weidenmueller svn path=/trunk/; revision=21246 --- reactos/dll/cpl/timedate/monthcal.c | 33 +++++++----- reactos/dll/win32/aclui/aclui.c | 2 +- reactos/dll/win32/aclui/checklist.c | 75 +++++++++++++++------------ reactos/dll/win32/aclui/precomp.h | 2 +- reactos/dll/win32/syssetup/install.c | 3 ++ reactos/dll/win32/syssetup/resource.h | 1 + 6 files changed, 67 insertions(+), 49 deletions(-) diff --git a/reactos/dll/cpl/timedate/monthcal.c b/reactos/dll/cpl/timedate/monthcal.c index 37828254680..f31ded26849 100644 --- a/reactos/dll/cpl/timedate/monthcal.c +++ b/reactos/dll/cpl/timedate/monthcal.c @@ -46,9 +46,9 @@ typedef struct _MONTHCALWND HBRUSH hbHeader; HBRUSH hbSelection; + DWORD UIState; BOOL Changed : 1; BOOL DayTimerSet : 1; - BOOL HideFocus : 1; BOOL HasFocus : 1; } MONTHCALWND, *PMONTHCALWND; @@ -58,16 +58,16 @@ MonthCalNotifyControlParent(IN PMONTHCALWND infoPtr, IN OUT PVOID data) { LRESULT Ret = 0; - + if (infoPtr->hNotify != NULL) { LPNMHDR pnmh = (LPNMHDR)data; - + pnmh->hwndFrom = infoPtr->hSelf; pnmh->idFrom = GetWindowLongPtr(infoPtr->hSelf, GWLP_ID); pnmh->code = code; - + Ret = SendMessage(infoPtr->hNotify, WM_NOTIFY, (WPARAM)pnmh->idFrom, @@ -239,6 +239,12 @@ MonthCalReload(IN PMONTHCALWND infoPtr) TCHAR szBuf[64]; UINT i; + infoPtr->UIState = SendMessage(GetAncestor(infoPtr->hSelf, + GA_PARENT), + WM_QUERYUISTATE, + 0, + 0); + /* cache the configuration */ infoPtr->FirstDayOfWeek = MonthCalFirstDayOfWeek(); @@ -563,7 +569,7 @@ FailNoHighlight: if (Day == infoPtr->Day && crOldText != CLR_INVALID) { - if (infoPtr->HasFocus && !infoPtr->HideFocus) + if (infoPtr->HasFocus && !(infoPtr->UIState & UISF_HIDEFOCUS)) { COLORREF crOldBk; @@ -751,6 +757,7 @@ MonthCalWndProc(IN HWND hwnd, } break; } + case VK_LEFT: { if (infoPtr->Day > 1) @@ -794,7 +801,7 @@ MonthCalWndProc(IN HWND hwnd, { /* change the UI status */ SendMessage(GetAncestor(hwnd, - GA_ROOT), + GA_PARENT), WM_CHANGEUISTATE, MAKEWPARAM(UIS_INITIALIZE, 0), @@ -825,21 +832,19 @@ MonthCalWndProc(IN HWND hwnd, case WM_UPDATEUISTATE: { - BOOL OldHideFocus = infoPtr->HideFocus; + DWORD OldUIState = infoPtr->UIState; switch (LOWORD(wParam)) { case UIS_SET: - if (HIWORD(wParam) & UISF_HIDEFOCUS) - infoPtr->HideFocus = TRUE; + infoPtr->UIState |= HIWORD(wParam); break; case UIS_CLEAR: - if (HIWORD(wParam) & UISF_HIDEFOCUS) - infoPtr->HideFocus = FALSE; + infoPtr->UIState &= ~HIWORD(wParam); break; } - if (infoPtr->HideFocus != OldHideFocus) + if (infoPtr->UIState != OldUIState) { MonthCalRepaintDay(infoPtr, infoPtr->Day); @@ -1021,7 +1026,7 @@ BOOL RegisterMonthCalControl(IN HINSTANCE hInstance) { WNDCLASS wc = {0}; - + wc.style = CS_DBLCLKS; wc.lpfnWndProc = MonthCalWndProc; wc.cbWndExtra = sizeof(PMONTHCALWND); @@ -1030,7 +1035,7 @@ RegisterMonthCalControl(IN HINSTANCE hInstance) (LPWSTR)IDC_ARROW); wc.hbrBackground = (HBRUSH)(MONTHCAL_CTRLBG + 1); wc.lpszClassName = szMonthCalWndClass; - + return RegisterClass(&wc) != 0; } diff --git a/reactos/dll/win32/aclui/aclui.c b/reactos/dll/win32/aclui/aclui.c index fa5d327aa7a..729ac7ca539 100644 --- a/reactos/dll/win32/aclui/aclui.c +++ b/reactos/dll/win32/aclui/aclui.c @@ -1557,7 +1557,7 @@ DllMain(IN HINSTANCE hinstDLL, break; case DLL_PROCESS_DETACH: - UnregisterCheckListControl(); + UnregisterCheckListControl(hinstDLL); break; } diff --git a/reactos/dll/win32/aclui/checklist.c b/reactos/dll/win32/aclui/checklist.c index 8c8a5c7028c..5756971b878 100644 --- a/reactos/dll/win32/aclui/checklist.c +++ b/reactos/dll/win32/aclui/checklist.c @@ -31,6 +31,8 @@ #define NDEBUG #include +static const WCHAR szCheckListWndClass[] = L"CHECKLIST_ACLUI"; + #define CI_TEXT_MARGIN_WIDTH (8) #define CI_TEXT_MARGIN_HEIGHT (3) #define CI_TEXT_SELECTIONMARGIN (1) @@ -60,23 +62,20 @@ typedef struct _CHECKLISTWND INT ItemHeight; - BOOL HasFocus; PCHECKITEM FocusedCheckItem; UINT FocusedCheckItemBox; - BOOL FocusedPushed; - BOOL FocusVisible; COLORREF TextColor[2]; INT CheckBoxLeft[2]; - BOOL QuickSearchEnabled; PCHECKITEM QuickSearchHitItem; WCHAR QuickSearchText[65]; UINT QuickSearchSetFocusDelay; UINT QuickSearchResetDelay; DWORD CaretWidth; - BOOL ShowingCaret; + + DWORD UIState; #if SUPPORT_UXTHEME PCHECKITEM HoveredCheckItem; @@ -85,6 +84,11 @@ typedef struct _CHECKLISTWND HTHEME ThemeHandle; #endif + + BOOL HasFocus : 1; + BOOL FocusedPushed : 1; + BOOL QuickSearchEnabled : 1; + BOOL ShowingCaret : 1; } CHECKLISTWND, *PCHECKLISTWND; static VOID EscapeQuickSearch(IN PCHECKLISTWND infoPtr); @@ -970,7 +974,7 @@ PaintControl(IN PCHECKLISTWND infoPtr, ((Item->State & CIS_ALLOW) ? DFCS_CHECKED : 0) | (IsPushed ? DFCS_PUSHED : 0)); } - if (Item == infoPtr->FocusedCheckItem && infoPtr->FocusVisible && + if (Item == infoPtr->FocusedCheckItem && !(infoPtr->UIState & UISF_HIDEFOCUS) && infoPtr->HasFocus && infoPtr->FocusedCheckItemBox != CLB_DENY) { @@ -1025,7 +1029,7 @@ PaintControl(IN PCHECKLISTWND infoPtr, ((Item->State & CIS_DENY) ? DFCS_CHECKED : 0) | (IsPushed ? DFCS_PUSHED : 0)); } - if (infoPtr->HasFocus && infoPtr->FocusVisible && + if (infoPtr->HasFocus && !(infoPtr->UIState & UISF_HIDEFOCUS) && Item == infoPtr->FocusedCheckItem && infoPtr->FocusedCheckItemBox == CLB_DENY) { @@ -1865,7 +1869,7 @@ CheckListWndProc(IN HWND hwnd, { Ret = (LRESULT)RetChangeControlFont(infoPtr, (HFONT)wParam, - (BOOL)lParam); + (BOOL)LOWORD(lParam)); break; } @@ -2204,16 +2208,13 @@ CheckListWndProc(IN HWND hwnd, Shift, &NewFocusBox); - if (!infoPtr->FocusVisible) - { - /* change the UI status */ - SendMessage(GetAncestor(hwnd, - GA_ROOT), - WM_CHANGEUISTATE, - MAKEWPARAM(UIS_INITIALIZE, - UISF_HIDEFOCUS), - 0); - } + /* update the UI status */ + SendMessage(GetAncestor(hwnd, + GA_PARENT), + WM_CHANGEUISTATE, + MAKEWPARAM(UIS_INITIALIZE, + 0), + 0); ChangeCheckItemFocus(infoPtr, NewFocus, @@ -2394,14 +2395,22 @@ CheckListWndProc(IN HWND hwnd, case WM_UPDATEUISTATE: { - if (HIWORD(wParam) & UISF_HIDEFOCUS) - { - BOOL OldFocusVisible = infoPtr->FocusVisible; - - infoPtr->FocusVisible = (LOWORD(wParam) == UIS_CLEAR); + DWORD OldUIState = infoPtr->UIState; - if (infoPtr->FocusVisible != OldFocusVisible && - infoPtr->FocusedCheckItem != NULL) + switch (LOWORD(wParam)) + { + case UIS_SET: + infoPtr->UIState |= HIWORD(wParam); + break; + + case UIS_CLEAR: + infoPtr->UIState &= ~(HIWORD(wParam)); + break; + } + + if (OldUIState != infoPtr->UIState) + { + if (infoPtr->FocusedCheckItem != NULL) { UpdateCheckItemBox(infoPtr, infoPtr->FocusedCheckItem, @@ -2525,10 +2534,10 @@ CheckListWndProc(IN HWND hwnd, } #endif - infoPtr->FocusVisible = !(SendMessage(hwnd, - WM_QUERYUISTATE, - 0, - 0) & UISF_HIDEFOCUS); + infoPtr->UIState = SendMessage(hwnd, + WM_QUERYUISTATE, + 0, + 0); } else { @@ -2591,14 +2600,14 @@ RegisterCheckListControl(IN HINSTANCE hInstance) (LPWSTR)IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wc.lpszMenuName = NULL; - wc.lpszClassName = L"CHECKLIST_ACLUI"; + wc.lpszClassName = szCheckListWndClass; return RegisterClass(&wc) != 0; } VOID -UnregisterCheckListControl(VOID) +UnregisterCheckListControl(HINSTANCE hInstance) { - UnregisterClass(L"CHECKLIST_ACLUI", - NULL); + UnregisterClass(szCheckListWndClass, + hInstance); } diff --git a/reactos/dll/win32/aclui/precomp.h b/reactos/dll/win32/aclui/precomp.h index 6b6c67b9f59..84258975e2d 100644 --- a/reactos/dll/win32/aclui/precomp.h +++ b/reactos/dll/win32/aclui/precomp.h @@ -146,7 +146,7 @@ BOOL RegisterCheckListControl(HINSTANCE hInstance); VOID -UnregisterCheckListControl(VOID); +UnregisterCheckListControl(HINSTANCE hInstance); /* DLLMAIN ********************************************************************/ diff --git a/reactos/dll/win32/syssetup/install.c b/reactos/dll/win32/syssetup/install.c index 2ff11d694f7..f2382ef1d0e 100644 --- a/reactos/dll/win32/syssetup/install.c +++ b/reactos/dll/win32/syssetup/install.c @@ -417,6 +417,9 @@ InstallReactOS (HINSTANCE hInstance) CreateShortcut(CSIDL_PROGRAMS, NULL, _T("ibrowser.lnk"), _T("ibrowser.exe"), IDS_CMT_IBROWSER); CreateShortcut(CSIDL_PROGRAMS, NULL, _T("Get Firefox.lnk"), _T("getfirefox.exe"), IDS_CMT_GETFIREFOX); + /* create administritive tools startmenu shortcuts */ + CreateShortcut(CSIDL_ADMINTOOLS, NULL, _T("Services.lnk"), _T("servman.exe"), IDS_CMT_SERVMAN); + /* create and fill Accessories subfolder */ if (CreateShortcutFolder(CSIDL_PROGRAMS, IDS_ACCESSORIES, sAccessories, 256)) { CreateShortcut(CSIDL_PROGRAMS, sAccessories, _T("Calculator.lnk"), _T("calc.exe"), IDS_CMT_CALC); diff --git a/reactos/dll/win32/syssetup/resource.h b/reactos/dll/win32/syssetup/resource.h index eb0df3026b9..c07dd845c6c 100644 --- a/reactos/dll/win32/syssetup/resource.h +++ b/reactos/dll/win32/syssetup/resource.h @@ -97,6 +97,7 @@ #define IDS_CMT_WINEMINE 3217 #define IDS_CMT_IBROWSER 3218 #define IDS_CMT_GETFIREFOX 3219 +#define IDS_CMT_SERVMAN 3220 #define IDS_REACTOS_SETUP 3300 #define IDS_UNKNOWN_ERROR 3301