mirror of
https://github.com/reactos/reactos.git
synced 2024-12-30 19:14:31 +00:00
- fix UI state handling
- by Thomas Weidenmueller svn path=/trunk/; revision=21246
This commit is contained in:
parent
5316bc7eef
commit
95558d0f30
6 changed files with 67 additions and 49 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1557,7 +1557,7 @@ DllMain(IN HINSTANCE hinstDLL,
|
|||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
UnregisterCheckListControl();
|
||||
UnregisterCheckListControl(hinstDLL);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ BOOL
|
|||
RegisterCheckListControl(HINSTANCE hInstance);
|
||||
|
||||
VOID
|
||||
UnregisterCheckListControl(VOID);
|
||||
UnregisterCheckListControl(HINSTANCE hInstance);
|
||||
|
||||
/* DLLMAIN ********************************************************************/
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue