comctl32/treeview: Set hot item when hovering over item, not entire row.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
87754283be
commit
d73d6b2093
|
@ -3635,7 +3635,7 @@ TREEVIEW_HitTestPoint(const TREEVIEW_INFO *infoPtr, POINT pt)
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT
|
static TREEVIEW_ITEM *
|
||||||
TREEVIEW_HitTest(const TREEVIEW_INFO *infoPtr, LPTVHITTESTINFO lpht)
|
TREEVIEW_HitTest(const TREEVIEW_INFO *infoPtr, LPTVHITTESTINFO lpht)
|
||||||
{
|
{
|
||||||
TREEVIEW_ITEM *item;
|
TREEVIEW_ITEM *item;
|
||||||
|
@ -3670,14 +3670,14 @@ TREEVIEW_HitTest(const TREEVIEW_INFO *infoPtr, LPTVHITTESTINFO lpht)
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
lpht->flags = status;
|
lpht->flags = status;
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
item = TREEVIEW_HitTestPoint(infoPtr, lpht->pt);
|
item = TREEVIEW_HitTestPoint(infoPtr, lpht->pt);
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
{
|
||||||
lpht->flags = TVHT_NOWHERE;
|
lpht->flags = TVHT_NOWHERE;
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x >= item->textOffset + item->textWidth)
|
if (x >= item->textOffset + item->textWidth)
|
||||||
|
@ -3708,7 +3708,7 @@ TREEVIEW_HitTest(const TREEVIEW_INFO *infoPtr, LPTVHITTESTINFO lpht)
|
||||||
lpht->hItem = item;
|
lpht->hItem = item;
|
||||||
TRACE("(%d,%d):result 0x%x\n", lpht->pt.x, lpht->pt.y, lpht->flags);
|
TRACE("(%d,%d):result 0x%x\n", lpht->pt.x, lpht->pt.y, lpht->flags);
|
||||||
|
|
||||||
return (LRESULT)item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Item Label Editing ***************************************************/
|
/* Item Label Editing ***************************************************/
|
||||||
|
@ -4131,7 +4131,7 @@ TREEVIEW_LButtonDoubleClick(TREEVIEW_INFO *infoPtr, LPARAM lParam)
|
||||||
hit.pt.x = (short)LOWORD(lParam);
|
hit.pt.x = (short)LOWORD(lParam);
|
||||||
hit.pt.y = (short)HIWORD(lParam);
|
hit.pt.y = (short)HIWORD(lParam);
|
||||||
|
|
||||||
item = (TREEVIEW_ITEM *)TREEVIEW_HitTest(infoPtr, &hit);
|
item = TREEVIEW_HitTest(infoPtr, &hit);
|
||||||
if (!item)
|
if (!item)
|
||||||
return 0;
|
return 0;
|
||||||
TRACE("item %d\n", TREEVIEW_GetItemIndex(infoPtr, item));
|
TRACE("item %d\n", TREEVIEW_GetItemIndex(infoPtr, item));
|
||||||
|
@ -5331,9 +5331,9 @@ TREEVIEW_MouseLeave (TREEVIEW_INFO * infoPtr)
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TREEVIEW_MouseMove (TREEVIEW_INFO * infoPtr, LPARAM lParam)
|
TREEVIEW_MouseMove (TREEVIEW_INFO * infoPtr, LPARAM lParam)
|
||||||
{
|
{
|
||||||
POINT pt;
|
|
||||||
TRACKMOUSEEVENT trackinfo;
|
TRACKMOUSEEVENT trackinfo;
|
||||||
TREEVIEW_ITEM * item;
|
TREEVIEW_ITEM * item;
|
||||||
|
TVHITTESTINFO ht;
|
||||||
|
|
||||||
if (!(infoPtr->dwStyle & TVS_TRACKSELECT)) return 0;
|
if (!(infoPtr->dwStyle & TVS_TRACKSELECT)) return 0;
|
||||||
|
|
||||||
|
@ -5358,18 +5358,21 @@ TREEVIEW_MouseMove (TREEVIEW_INFO * infoPtr, LPARAM lParam)
|
||||||
_TrackMouseEvent(&trackinfo);
|
_TrackMouseEvent(&trackinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
pt.x = (short)LOWORD(lParam);
|
ht.pt.x = (short)LOWORD(lParam);
|
||||||
pt.y = (short)HIWORD(lParam);
|
ht.pt.y = (short)HIWORD(lParam);
|
||||||
|
|
||||||
item = TREEVIEW_HitTestPoint(infoPtr, pt);
|
item = TREEVIEW_HitTest(infoPtr, &ht);
|
||||||
|
if ((item != infoPtr->hotItem) || !(ht.flags & TVHT_ONITEM))
|
||||||
if (item != infoPtr->hotItem)
|
|
||||||
{
|
{
|
||||||
/* redraw old hot item */
|
/* redraw old hot item */
|
||||||
TREEVIEW_InvalidateItem(infoPtr, infoPtr->hotItem);
|
TREEVIEW_InvalidateItem(infoPtr, infoPtr->hotItem);
|
||||||
infoPtr->hotItem = item;
|
infoPtr->hotItem = NULL;
|
||||||
/* redraw new hot item */
|
if (item && (ht.flags & TVHT_ONITEM))
|
||||||
TREEVIEW_InvalidateItem(infoPtr, infoPtr->hotItem);
|
{
|
||||||
|
infoPtr->hotItem = item;
|
||||||
|
/* redraw new hot item */
|
||||||
|
TREEVIEW_InvalidateItem(infoPtr, infoPtr->hotItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -5508,14 +5511,14 @@ TREEVIEW_StyleChanged(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TREEVIEW_SetCursor(const TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
TREEVIEW_SetCursor(const TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
POINT pt;
|
|
||||||
TREEVIEW_ITEM * item;
|
TREEVIEW_ITEM * item;
|
||||||
|
TVHITTESTINFO ht;
|
||||||
NMMOUSE nmmouse;
|
NMMOUSE nmmouse;
|
||||||
|
|
||||||
GetCursorPos(&pt);
|
GetCursorPos(&ht.pt);
|
||||||
ScreenToClient(infoPtr->hwnd, &pt);
|
ScreenToClient(infoPtr->hwnd, &ht.pt);
|
||||||
|
|
||||||
item = TREEVIEW_HitTestPoint(infoPtr, pt);
|
item = TREEVIEW_HitTest(infoPtr, &ht);
|
||||||
|
|
||||||
memset(&nmmouse, 0, sizeof(nmmouse));
|
memset(&nmmouse, 0, sizeof(nmmouse));
|
||||||
if (item)
|
if (item)
|
||||||
|
@ -5529,7 +5532,7 @@ TREEVIEW_SetCursor(const TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
||||||
if (TREEVIEW_SendRealNotify(infoPtr, NM_SETCURSOR, &nmmouse.hdr))
|
if (TREEVIEW_SendRealNotify(infoPtr, NM_SETCURSOR, &nmmouse.hdr))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (item && (infoPtr->dwStyle & TVS_TRACKSELECT))
|
if (item && (infoPtr->dwStyle & TVS_TRACKSELECT) && (ht.flags & TVHT_ONITEM))
|
||||||
{
|
{
|
||||||
SetCursor(infoPtr->hcurHand);
|
SetCursor(infoPtr->hcurHand);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -5673,7 +5676,7 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
return TREEVIEW_GetVisibleCount(infoPtr);
|
return TREEVIEW_GetVisibleCount(infoPtr);
|
||||||
|
|
||||||
case TVM_HITTEST:
|
case TVM_HITTEST:
|
||||||
return TREEVIEW_HitTest(infoPtr, (LPTVHITTESTINFO)lParam);
|
return (LRESULT)TREEVIEW_HitTest(infoPtr, (TVHITTESTINFO*)lParam);
|
||||||
|
|
||||||
case TVM_INSERTITEMA:
|
case TVM_INSERTITEMA:
|
||||||
case TVM_INSERTITEMW:
|
case TVM_INSERTITEMW:
|
||||||
|
|
Loading…
Reference in New Issue