Change the callback declarations to a safer format.
[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  *              MakeDragList
25  */
26 BOOL WINAPI MakeDragList (HWND hwndLB)
27 {
28     FIXME("(0x%x)\n", hwndLB);
29
30
31     return FALSE;
32 }
33
34 /***********************************************************************
35  *              DrawInsert
36  */
37 VOID WINAPI DrawInsert (HWND hwndParent, HWND hwndLB, INT nItem)
38 {
39     FIXME("(0x%x 0x%x %d)\n", hwndParent, hwndLB, nItem);
40
41
42 }
43
44 /***********************************************************************
45  *              LBItemFromPt
46  */
47 INT WINAPI LBItemFromPt (HWND hwndLB, POINT pt, BOOL bAutoScroll)
48 {
49     RECT rcClient;
50     INT nIndex;
51     DWORD dwScrollTime;
52
53     FIXME("(0x%x %ld x %ld %s)\n",
54            hwndLB, pt.x, pt.y, bAutoScroll ? "TRUE" : "FALSE");
55
56     ScreenToClient (hwndLB, &pt);
57     GetClientRect (hwndLB, &rcClient);
58     nIndex = (INT)SendMessageA (hwndLB, LB_GETTOPINDEX, 0, 0);
59
60     if (PtInRect (&rcClient, pt))
61     {
62         /* point is inside -- get the item index */
63         while (TRUE)
64         {
65             if (SendMessageA (hwndLB, LB_GETITEMRECT, nIndex, (LPARAM)&rcClient) == LB_ERR)
66                 return -1;
67
68             if (PtInRect (&rcClient, pt))
69                 return nIndex;
70
71             nIndex++;
72         }
73     }
74     else
75     {
76         /* point is outside */
77         if (!bAutoScroll)
78             return -1;
79
80         if ((pt.x > rcClient.right) || (pt.x < rcClient.left))
81             return -1;
82
83         if (pt.y < 0)
84             nIndex--;
85         else
86             nIndex++;
87
88         dwScrollTime = GetTickCount ();
89
90         if ((dwScrollTime - dwLastScrollTime) < 200)
91             return -1;
92
93         dwLastScrollTime = dwScrollTime;
94
95         SendMessageA (hwndLB, LB_SETTOPINDEX, (WPARAM)nIndex, 0);
96     }
97
98     return -1;
99 }
100
101
102 #if 0
103 static LRESULT CALLBACK
104 DRAGLIST_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
105 {
106
107     return FALSE;
108 }
109 #endif
110
111
112