comctl32/pager: Support WM_NOTIFYFORMAT message.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2018-08-24 22:04:49 +08:00 committed by Alexandre Julliard
parent 4be93106cd
commit 069eb68bf9
2 changed files with 29 additions and 4 deletions

View File

@ -71,6 +71,7 @@ typedef struct
HWND hwndSelf; /* handle of the control wnd */
HWND hwndChild; /* handle of the contained wnd */
HWND hwndNotify; /* handle of the parent wnd */
BOOL bUnicode; /* send notifications in Unicode */
DWORD dwStyle; /* styles for this control */
COLORREF clrBk; /* background color */
INT nBorder; /* border size for the control */
@ -555,6 +556,7 @@ static LRESULT
PAGER_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
{
PAGER_INFO *infoPtr;
INT ret;
/* allocate memory for info structure */
infoPtr = heap_alloc_zero (sizeof(*infoPtr));
@ -581,6 +583,9 @@ PAGER_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
if (infoPtr->dwStyle & PGS_DRAGNDROP)
FIXME("[%p] Drag and Drop style is not implemented yet.\n", infoPtr->hwndSelf);
ret = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
infoPtr->bUnicode = (ret == NFR_UNICODE);
return 0;
}
@ -998,6 +1003,23 @@ PAGER_StyleChanged(PAGER_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lp
return 0;
}
static LRESULT PAGER_NotifyFormat(PAGER_INFO *infoPtr, INT command)
{
INT ret;
switch (command)
{
case NF_REQUERY:
ret = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
infoPtr->bUnicode = (ret == NFR_UNICODE);
return ret;
case NF_QUERY:
/* Pager always wants Unicode notifications from children */
return NFR_UNICODE;
default:
return 0;
}
}
static LRESULT WINAPI
PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@ -1089,6 +1111,9 @@ PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_TIMER:
return PAGER_Timer (infoPtr, (INT)wParam);
case WM_NOTIFYFORMAT:
return PAGER_NotifyFormat (infoPtr, lParam);
case WM_NOTIFY:
case WM_COMMAND:
return SendMessageW (infoPtr->hwndNotify, uMsg, wParam, lParam);

View File

@ -392,8 +392,8 @@ static void test_wm_notifyformat(void)
/* Test parent */
notify_query_received = FALSE;
ret = SendMessageW(pager, WM_NOTIFYFORMAT, (WPARAM)parent, NF_REQUERY);
todo_wine_if(notify_format == NFR_ANSI) ok(ret == notify_format, "Expect %d, got %ld\n", notify_format, ret);
todo_wine ok(notify_query_received, "Didn't receive notify\n");
ok(ret == notify_format, "Expect %d, got %ld\n", notify_format, ret);
ok(notify_query_received, "Didn't receive notify\n");
/* Send NF_QUERY directly to parent */
notify_query_received = FALSE;
@ -404,8 +404,8 @@ static void test_wm_notifyformat(void)
/* Pager send notifications to its parent regardless of wParam */
notify_query_received = FALSE;
ret = SendMessageW(pager, WM_NOTIFYFORMAT, (WPARAM)parent_wnd, NF_REQUERY);
todo_wine_if(notify_format == NFR_ANSI) ok(ret == notify_format, "Expect %d, got %ld\n", notify_format, ret);
todo_wine ok(notify_query_received, "Didn't receive notify\n");
ok(ret == notify_format, "Expect %d, got %ld\n", notify_format, ret);
ok(notify_query_received, "Didn't receive notify\n");
/* Pager always wants Unicode notifications from children */
ret = SendMessageW(child, WM_NOTIFYFORMAT, (WPARAM)pager, NF_REQUERY);