andlabs-ui/wintable/vscroll.h

66 lines
1.2 KiB
C
Raw Normal View History

// 9 december 2014
// forward declaration needed here
static void repositionHeader(struct table *);
static struct scrollParams vscrollParams(struct table *t)
{
struct scrollParams p;
ZeroMemory(&p, sizeof (struct scrollParams));
p.pos = &(t->vscrollpos);
p.pagesize = t->vpagesize;
p.length = t->count;
p.scale = rowht(t);
p.post = NULL;
2014-12-12 21:17:20 -06:00
p.wheelCarry = &(t->vwheelCarry);
return p;
}
static void vscrollto(struct table *t, intptr_t pos)
{
struct scrollParams p;
p = vscrollParams(t);
scrollto(t, SB_VERT, &p, pos);
}
static void vscrollby(struct table *t, intptr_t delta)
{
struct scrollParams p;
p = vscrollParams(t);
scrollby(t, SB_VERT, &p, delta);
}
static void vscroll(struct table *t, WPARAM wParam, LPARAM lParam)
{
struct scrollParams p;
p = vscrollParams(t);
scroll(t, SB_VERT, &p, wParam, lParam);
}
2014-12-12 21:17:20 -06:00
static void vwheelscroll(struct table *t, WPARAM wParam, LPARAM lParam)
{
struct scrollParams p;
p = vscrollParams(t);
wheelscroll(t, SB_VERT, &p, wParam, lParam);
}
HANDLER(vscrollHandler)
{
2014-12-12 21:17:20 -06:00
switch (uMsg) {
case WM_VSCROLL:
vscroll(t, wParam, lParam);
*lResult = 0;
return TRUE;
case WM_MOUSEWHEEL:
vwheelscroll(t, wParam, lParam);
2014-12-12 21:48:19 -06:00
*lResult = 0;
return TRUE;
2014-12-12 21:17:20 -06:00
}
return FALSE;
}