Commit ea058d22 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/listview: Add NM_HOVER notification.

parent 5f191553
......@@ -99,7 +99,6 @@
* -- LVN_GETINFOTIP
* -- LVN_HOTTRACK
* -- LVN_SETDISPINFO
* -- NM_HOVER
* -- LVN_BEGINRDRAG
*
* Messages:
......@@ -3654,18 +3653,22 @@ static inline BOOL LISTVIEW_IsHotTracking(const LISTVIEW_INFO *infoPtr)
*/
static LRESULT LISTVIEW_MouseHover(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, INT y)
{
NMHDR hdr;
if (notify_hdr(infoPtr, NM_HOVER, &hdr)) return 0;
if (LISTVIEW_IsHotTracking(infoPtr))
{
LVITEMW item;
POINT pt;
SetFocus(infoPtr->hwndSelf);
pt.x = x;
pt.y = y;
if (LISTVIEW_GetItemAtPt(infoPtr, &item, pt))
LISTVIEW_SetSelection(infoPtr, item.iItem);
SetFocus(infoPtr->hwndSelf);
}
return 0;
......
......@@ -46,7 +46,9 @@ static const WCHAR testparentclassW[] =
HWND hwndparent, hwndparentW;
/* prevents edit box creation, LVN_BEGINLABELEDIT return value */
BOOL blockEdit;
static BOOL blockEdit;
/* return nonzero on NM_HOVER */
static BOOL g_block_hover;
/* dumps LVN_ITEMCHANGED message data */
static BOOL g_dump_itemchanged;
/* format reported to control:
......@@ -278,6 +280,12 @@ static const struct message edit_end_nochange[] = {
{ 0 }
};
static const struct message hover_parent[] = {
{ WM_GETDLGCODE, sent }, /* todo_wine */
{ WM_NOTIFY, sent|id, 0, 0, NM_HOVER },
{ 0 }
};
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static LONG defwndproc_counter = 0;
......@@ -344,6 +352,9 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP
nmlv->iItem, nmlv->uNewState, nmlv->uOldState, nmlv->uChanged);
}
break;
case NM_HOVER:
if (g_block_hover) return 1;
break;
}
break;
}
......@@ -4247,6 +4258,28 @@ static void test_LVS_EX_HEADERINALLVIEWS(void)
DestroyWindow(hwnd);
}
static void test_hover(void)
{
HWND hwnd;
DWORD r;
hwnd = create_custom_listview_control(LVS_ICON);
/* test WM_MOUSEHOVER forwarding */
flush_sequences(sequences, NUM_MSG_SEQUENCES);
r = SendMessage(hwnd, WM_MOUSEHOVER, 0, 0);
expect(0, r);
ok_sequence(sequences, PARENT_SEQ_INDEX, hover_parent, "NM_HOVER allow test", TRUE);
g_block_hover = TRUE;
flush_sequences(sequences, NUM_MSG_SEQUENCES);
r = SendMessage(hwnd, WM_MOUSEHOVER, 0, 0);
expect(0, r);
ok_sequence(sequences, PARENT_SEQ_INDEX, hover_parent, "NM_HOVER block test", TRUE);
g_block_hover = FALSE;
DestroyWindow(hwnd);
}
START_TEST(listview)
{
HMODULE hComctl32;
......@@ -4306,6 +4339,7 @@ START_TEST(listview)
test_getcolumnwidth();
test_approximate_viewrect();
test_finditem();
test_hover();
if (!load_v6_module(&ctx_cookie, &hCtx))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment