summaryrefslogtreecommitdiff
path: root/wintable/new/vscroll.h
blob: bcab488a78c4020c86c06695dbf670649abc2f3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// 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;
	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);
}

// TODO WM_MOUSEWHEEL
HANDLER(vscrollHandler)
{
	if (uMsg != WM_VSCROLL)
		return FALSE;
	vscroll(t, wParam, lParam);
	*lResult = 0;
	return TRUE;
}