No longer directly accessing debuggee memory.
[wine] / dlls / comctl32 / draglist.c
1 /*
2  * Drag List control
3  *
4  * Copyright 1999 Eric Kohl
5  *
6  * NOTES
7  *   This is just a dummy control. An author is needed! Any volunteers?
8  *   I will only improve this control once in a while.
9  *     Eric <ekohl@abo.rhein-zeitung.de>
10  *
11  * TODO:
12  *   - Everything.
13  */
14
15 #include "commctrl.h"
16 #include "debugtools.h"
17
18 DEFAULT_DEBUG_CHANNEL(commctrl)
19
20
21 static DWORD dwLastScrollTime = 0;
22
23
24 BOOL WINAPI MakeDragList (HWND hwndLB)
25 {
26     FIXME("(0x%x)\n", hwndLB);
27
28
29     return FALSE;
30 }
31
32
33 VOID WINAPI DrawInsert (HWND hwndParent, HWND hwndLB, INT nItem)
34 {
35     FIXME("(0x%x 0x%x %d)\n", hwndParent, hwndLB, nItem);
36
37
38 }
39
40
41 INT WINAPI LBItemFromPt (HWND hwndLB, POINT pt, BOOL bAutoScroll)
42 {
43     RECT rcClient;
44     INT nIndex;
45     DWORD dwScrollTime;
46
47     FIXME("(0x%x %ld x %ld %s)\n",
48            hwndLB, pt.x, pt.y, bAutoScroll ? "TRUE" : "FALSE");
49
50     ScreenToClient (hwndLB, &pt);
51     GetClientRect (hwndLB, &rcClient);
52     nIndex = (INT)SendMessageA (hwndLB, LB_GETTOPINDEX, 0, 0);
53
54     if (PtInRect (&rcClient, pt))
55     {
56         /* point is inside -- get the item index */
57         while (TRUE)
58         {
59             if (SendMessageA (hwndLB, LB_GETITEMRECT, nIndex, (LPARAM)&rcClient) == LB_ERR)
60                 return -1;
61
62             if (PtInRect (&rcClient, pt))
63                 return nIndex;
64
65             nIndex++;
66         }
67     }
68     else
69     {
70         /* point is outside */
71         if (!bAutoScroll)
72             return -1;
73
74         if ((pt.x > rcClient.right) || (pt.x < rcClient.left))
75             return -1;
76
77         if (pt.y < 0)
78             nIndex--;
79         else
80             nIndex++;
81
82         dwScrollTime = GetTickCount ();
83
84         if ((dwScrollTime - dwLastScrollTime) < 200)
85             return -1;
86
87         dwLastScrollTime = dwScrollTime;
88
89         SendMessageA (hwndLB, LB_SETTOPINDEX, (WPARAM)nIndex, 0);
90     }
91
92     return -1;
93 }
94
95
96 #if 0
97 static LRESULT CALLBACK
98 DRAGLIST_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
99 {
100
101     return FALSE;
102 }
103 #endif
104
105
106