2014-12-09 19:47:03 -06:00
|
|
|
// 9 december 2014
|
|
|
|
|
2014-12-10 14:37:52 -06:00
|
|
|
// forward declaration needed here
|
|
|
|
static void repositionHeader(struct table *);
|
|
|
|
|
2014-12-12 13:53:58 -06:00
|
|
|
static struct scrollParams hscrollParams(struct table *t)
|
2014-12-09 19:47:03 -06:00
|
|
|
{
|
2014-12-12 13:53:58 -06:00
|
|
|
struct scrollParams p;
|
|
|
|
|
|
|
|
ZeroMemory(&p, sizeof (struct scrollParams));
|
|
|
|
p.pos = &(t->hscrollpos);
|
|
|
|
p.pagesize = t->hpagesize;
|
|
|
|
p.length = t->width;
|
|
|
|
p.scale = 1;
|
|
|
|
p.post = repositionHeader;
|
2014-12-12 21:17:20 -06:00
|
|
|
p.wheelCarry = &(t->hwheelCarry);
|
2014-12-12 13:53:58 -06:00
|
|
|
return p;
|
|
|
|
}
|
2014-12-10 14:37:52 -06:00
|
|
|
|
2014-12-12 13:53:58 -06:00
|
|
|
static void hscrollto(struct table *t, intptr_t pos)
|
|
|
|
{
|
|
|
|
struct scrollParams p;
|
2014-12-10 14:37:52 -06:00
|
|
|
|
2014-12-12 13:53:58 -06:00
|
|
|
p = hscrollParams(t);
|
|
|
|
scrollto(t, SB_HORZ, &p, pos);
|
2014-12-09 19:47:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static void hscrollby(struct table *t, intptr_t delta)
|
|
|
|
{
|
2014-12-12 13:53:58 -06:00
|
|
|
struct scrollParams p;
|
|
|
|
|
|
|
|
p = hscrollParams(t);
|
|
|
|
scrollby(t, SB_HORZ, &p, delta);
|
2014-12-09 19:47:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static void hscroll(struct table *t, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2014-12-12 13:53:58 -06:00
|
|
|
struct scrollParams p;
|
2014-12-10 14:37:52 -06:00
|
|
|
|
2014-12-12 13:53:58 -06:00
|
|
|
p = hscrollParams(t);
|
|
|
|
scroll(t, SB_HORZ, &p, wParam, lParam);
|
2014-12-09 19:47:03 -06:00
|
|
|
}
|
|
|
|
|
2014-12-10 14:37:52 -06:00
|
|
|
// TODO find out if we can indicriminately check for WM_WHEELHSCROLL
|
|
|
|
HANDLER(hscrollHandler)
|
2014-12-09 19:47:03 -06:00
|
|
|
{
|
2014-12-10 14:37:52 -06:00
|
|
|
if (uMsg != WM_HSCROLL)
|
|
|
|
return FALSE;
|
|
|
|
hscroll(t, wParam, lParam);
|
|
|
|
*lResult = 0;
|
|
|
|
return TRUE;
|
2014-12-09 19:47:03 -06:00
|
|
|
}
|