ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

INT WINAPI LBItemFromPt ( HWND  hwndLB,
POINT  pt,
BOOL  bAutoScroll 
)

Definition at line 289 of file draglist.c.

Referenced by TOOLBAR_Cust_AvailDragListNotification(), and TOOLBAR_Cust_ToolbarDragListNotification().

{
    RECT rcClient;
    INT nIndex;
    DWORD dwScrollTime;

    TRACE("(%p %d x %d %s)\n",
           hwndLB, pt.x, pt.y, bAutoScroll ? "TRUE" : "FALSE");

    ScreenToClient (hwndLB, &pt);
    GetClientRect (hwndLB, &rcClient);
    nIndex = (INT)SendMessageW (hwndLB, LB_GETTOPINDEX, 0, 0);

    if (PtInRect (&rcClient, pt))
    {
        /* point is inside -- get the item index */
        while (TRUE)
        {
            if (SendMessageW (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) < DRAGLIST_SCROLLPERIOD)
            return -1;

        dwLastScrollTime = dwScrollTime;

        SendMessageW (hwndLB, LB_SETTOPINDEX, nIndex, 0);
    }

    return -1;
}

Generated on Sun May 27 2012 05:07:02 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.