- implemented LBItemFromPt
This commit is contained in:
parent
2b51c94674
commit
663921f97c
|
@ -18,6 +18,9 @@
|
|||
DEFAULT_DEBUG_CHANNEL(commctrl)
|
||||
|
||||
|
||||
static DWORD dwLastScrollTime = 0;
|
||||
|
||||
|
||||
BOOL WINAPI MakeDragList (HWND hwndLB)
|
||||
{
|
||||
FIXME("(0x%x)\n", hwndLB);
|
||||
|
@ -37,10 +40,65 @@ VOID WINAPI DrawInsert (HWND hwndParent, HWND hwndLB, INT nItem)
|
|||
|
||||
INT WINAPI LBItemFromPt (HWND hwndLB, POINT pt, BOOL bAutoScroll)
|
||||
{
|
||||
RECT rcClient;
|
||||
INT nIndex;
|
||||
DWORD dwScrollTime;
|
||||
|
||||
FIXME("(0x%x %ld x %ld %s)\n",
|
||||
hwndLB, pt.x, pt.y, bAutoScroll ? "TRUE" : "FALSE");
|
||||
|
||||
ScreenToClient (hwndLB, &pt);
|
||||
GetClientRect (hwndLB, &rcClient);
|
||||
nIndex = (INT)SendMessageA (hwndLB, LB_GETTOPINDEX, 0, 0);
|
||||
|
||||
if (PtInRect (&rcClient, pt))
|
||||
{
|
||||
/* point is inside -- get the item index */
|
||||
while (TRUE)
|
||||
{
|
||||
if (SendMessageA (hwndLB, LB_GETITEMRECT, nIndex, (LPARAM)&rcClient) == LB_ERR)
|
||||
return -1;
|
||||
|
||||
if (PtInRect (&rcClient, pt))
|
||||
return nIndex;
|
||||
|
||||
nIndex++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* point is outside */
|
||||
if (!bAutoScroll)
|
||||
return -1;
|
||||
|
||||
if ((pt.x > rcClient.right) || (pt.x < rcClient.left))
|
||||
return -1;
|
||||
|
||||
if (pt.y < 0)
|
||||
nIndex--;
|
||||
else
|
||||
nIndex++;
|
||||
|
||||
dwScrollTime = GetTickCount ();
|
||||
|
||||
if ((dwScrollTime - dwLastScrollTime) < 200)
|
||||
return -1;
|
||||
|
||||
dwLastScrollTime = dwScrollTime;
|
||||
|
||||
SendMessageA (hwndLB, LB_SETTOPINDEX, (WPARAM)nIndex, 0);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static LRESULT CALLBACK
|
||||
DRAGLIST_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue