fixed line endings on all files
[reactos.git] / reactos / lib / comctl32 / draglist.c
1 /*
2 * Drag List control
3 *
4 * Copyright 1999 Eric Kohl
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * NOTES
21 * This is just a dummy control. An author is needed! Any volunteers?
22 * I will only improve this control once in a while.
23 * Eric <ekohl@abo.rhein-zeitung.de>
24 *
25 * TODO:
26 * - Everything.
27 */
28
29 #include <stdarg.h>
30
31 #include "windef.h"
32 #include "winbase.h"
33 #include "wingdi.h"
34 #include "winuser.h"
35 #include "winnls.h"
36 #include "commctrl.h"
37 #include "wine/debug.h"
38
39 WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
40
41
42 static DWORD dwLastScrollTime = 0;
43
44 /***********************************************************************
45 * MakeDragList (COMCTL32.13)
46 */
47 BOOL WINAPI MakeDragList (HWND hwndLB)
48 {
49 FIXME("(%p)\n", hwndLB);
50
51
52 return FALSE;
53 }
54
55 /***********************************************************************
56 * DrawInsert (COMCTL32.15)
57 */
58 VOID WINAPI DrawInsert (HWND hwndParent, HWND hwndLB, INT nItem)
59 {
60 FIXME("(%p %p %d)\n", hwndParent, hwndLB, nItem);
61
62
63 }
64
65 /***********************************************************************
66 * LBItemFromPt (COMCTL32.14)
67 */
68 INT WINAPI LBItemFromPt (HWND hwndLB, POINT pt, BOOL bAutoScroll)
69 {
70 RECT rcClient;
71 INT nIndex;
72 DWORD dwScrollTime;
73
74 FIXME("(%p %ld x %ld %s)\n",
75 hwndLB, pt.x, pt.y, bAutoScroll ? "TRUE" : "FALSE");
76
77 ScreenToClient (hwndLB, &pt);
78 GetClientRect (hwndLB, &rcClient);
79 nIndex = (INT)SendMessageA (hwndLB, LB_GETTOPINDEX, 0, 0);
80
81 if (PtInRect (&rcClient, pt))
82 {
83 /* point is inside -- get the item index */
84 while (TRUE)
85 {
86 if (SendMessageA (hwndLB, LB_GETITEMRECT, nIndex, (LPARAM)&rcClient) == LB_ERR)
87 return -1;
88
89 if (PtInRect (&rcClient, pt))
90 return nIndex;
91
92 nIndex++;
93 }
94 }
95 else
96 {
97 /* point is outside */
98 if (!bAutoScroll)
99 return -1;
100
101 if ((pt.x > rcClient.right) || (pt.x < rcClient.left))
102 return -1;
103
104 if (pt.y < 0)
105 nIndex--;
106 else
107 nIndex++;
108
109 dwScrollTime = GetTickCount ();
110
111 if ((dwScrollTime - dwLastScrollTime) < 200)
112 return -1;
113
114 dwLastScrollTime = dwScrollTime;
115
116 SendMessageA (hwndLB, LB_SETTOPINDEX, (WPARAM)nIndex, 0);
117 }
118
119 return -1;
120 }
121
122
123 #if 0
124 static LRESULT CALLBACK
125 DRAGLIST_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
126 {
127
128 return FALSE;
129 }
130 #endif
131
132
133