1999-01-24 20:12:34 +01:00
|
|
|
/*
|
|
|
|
* Drag List control
|
|
|
|
*
|
|
|
|
* Copyright 1999 Eric Kohl
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* This is just a dummy control. An author is needed! Any volunteers?
|
|
|
|
* I will only improve this control once in a while.
|
|
|
|
* Eric <ekohl@abo.rhein-zeitung.de>
|
|
|
|
*
|
|
|
|
* TODO:
|
|
|
|
* - Everything.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "commctrl.h"
|
1999-06-12 17:45:58 +02:00
|
|
|
#include "debugtools.h"
|
1999-01-24 20:12:34 +01:00
|
|
|
|
1999-04-19 16:56:29 +02:00
|
|
|
DEFAULT_DEBUG_CHANNEL(commctrl)
|
|
|
|
|
1999-01-24 20:12:34 +01:00
|
|
|
|
1999-11-24 00:35:12 +01:00
|
|
|
static DWORD dwLastScrollTime = 0;
|
|
|
|
|
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI MakeDragList (HWND hwndLB)
|
1999-01-24 20:12:34 +01:00
|
|
|
{
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("(0x%x)\n", hwndLB);
|
1999-01-24 20:12:34 +01:00
|
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
VOID WINAPI DrawInsert (HWND hwndParent, HWND hwndLB, INT nItem)
|
1999-01-24 20:12:34 +01:00
|
|
|
{
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("(0x%x 0x%x %d)\n", hwndParent, hwndLB, nItem);
|
1999-01-24 20:12:34 +01:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
INT WINAPI LBItemFromPt (HWND hwndLB, POINT pt, BOOL bAutoScroll)
|
1999-01-24 20:12:34 +01:00
|
|
|
{
|
1999-11-24 00:35:12 +01:00
|
|
|
RECT rcClient;
|
|
|
|
INT nIndex;
|
|
|
|
DWORD dwScrollTime;
|
|
|
|
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("(0x%x %ld x %ld %s)\n",
|
1999-01-24 20:12:34 +01:00
|
|
|
hwndLB, pt.x, pt.y, bAutoScroll ? "TRUE" : "FALSE");
|
|
|
|
|
1999-11-24 00:35:12 +01:00
|
|
|
ScreenToClient (hwndLB, &pt);
|
|
|
|
GetClientRect (hwndLB, &rcClient);
|
|
|
|
nIndex = (INT)SendMessageA (hwndLB, LB_GETTOPINDEX, 0, 0);
|
|
|
|
|
|
|
|
if (PtInRect (&rcClient, pt))
|
|
|
|
{
|
|
|
|
/* point is inside -- get the item index */
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
if (SendMessageA (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) < 200)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
dwLastScrollTime = dwScrollTime;
|
|
|
|
|
|
|
|
SendMessageA (hwndLB, LB_SETTOPINDEX, (WPARAM)nIndex, 0);
|
|
|
|
}
|
1999-01-24 20:12:34 +01:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
1999-11-24 00:35:12 +01:00
|
|
|
|
|
|
|
static LRESULT CALLBACK
|
|
|
|
DRAGLIST_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|