We no longer use the .exe.spec.c files.
[wine/multimedia.git] / dlls / comctl32 / draglist.c
blobbc1e45095a94b35185e5aee0514471df09e37cac
1 /*
2 * Drag List control
4 * Copyright 1999 Eric Kohl
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.
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.
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
20 * NOTES
21 * This is just a dummy control. An author is needed! Any volunteers?
22 * Eric <ekohl@abo.rhein-zeitung.de>
24 * TODO:
25 * - Everything.
28 #include <stdarg.h>
30 #include "windef.h"
31 #include "winbase.h"
32 #include "wingdi.h"
33 #include "winuser.h"
34 #include "winnls.h"
35 #include "commctrl.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
41 static DWORD dwLastScrollTime = 0;
43 /***********************************************************************
44 * MakeDragList (COMCTL32.13)
46 * Makes a normal ListBox into a DragList by subclassing it.
48 * RETURNS
49 * Success: Non-zero
50 * Failure: Zero
52 BOOL WINAPI MakeDragList (HWND hwndLB)
54 FIXME("(%p)\n", hwndLB);
57 return FALSE;
60 /***********************************************************************
61 * DrawInsert (COMCTL32.15)
63 * Draws insert arrow by the side of the ListBox item in the parent window.
65 * RETURNS
66 * Nothing.
68 VOID WINAPI DrawInsert (HWND hwndParent, HWND hwndLB, INT nItem)
70 FIXME("(%p %p %d)\n", hwndParent, hwndLB, nItem);
75 /***********************************************************************
76 * LBItemFromPt (COMCTL32.14)
78 * Gets the index of the ListBox item under the specified point,
79 * scrolling if bAutoScroll is TRUE and pt is outside of the ListBox.
81 * RETURNS
82 * The ListBox item ID if pt is over a list item or -1 otherwise.
84 INT WINAPI LBItemFromPt (HWND hwndLB, POINT pt, BOOL bAutoScroll)
86 RECT rcClient;
87 INT nIndex;
88 DWORD dwScrollTime;
90 FIXME("(%p %ld x %ld %s)\n",
91 hwndLB, pt.x, pt.y, bAutoScroll ? "TRUE" : "FALSE");
93 ScreenToClient (hwndLB, &pt);
94 GetClientRect (hwndLB, &rcClient);
95 nIndex = (INT)SendMessageA (hwndLB, LB_GETTOPINDEX, 0, 0);
97 if (PtInRect (&rcClient, pt))
99 /* point is inside -- get the item index */
100 while (TRUE)
102 if (SendMessageA (hwndLB, LB_GETITEMRECT, nIndex, (LPARAM)&rcClient) == LB_ERR)
103 return -1;
105 if (PtInRect (&rcClient, pt))
106 return nIndex;
108 nIndex++;
111 else
113 /* point is outside */
114 if (!bAutoScroll)
115 return -1;
117 if ((pt.x > rcClient.right) || (pt.x < rcClient.left))
118 return -1;
120 if (pt.y < 0)
121 nIndex--;
122 else
123 nIndex++;
125 dwScrollTime = GetTickCount ();
127 if ((dwScrollTime - dwLastScrollTime) < 200)
128 return -1;
130 dwLastScrollTime = dwScrollTime;
132 SendMessageA (hwndLB, LB_SETTOPINDEX, (WPARAM)nIndex, 0);
135 return -1;
139 #if 0
140 static LRESULT CALLBACK
141 DRAGLIST_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
144 return FALSE;
146 #endif