summaryrefslogtreecommitdiff
path: root/wintable/new/resize.h
blob: 2ffaad701b12e3e27f0fff45649ad34eabf21497 (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
// 7 december 2014

// TODO why doesn't this trigger on first show?
// TODO see if there's anything not metaphor related in the last bits of the scrollbar series
// TODO rename this to boot

HANDLER(resizeHandler)
{
	WINDOWPOS *wp;
	RECT client;
	intptr_t height;

	if (uMsg != WM_WINDOWPOSCHANGED)
		return FALSE;
	wp = (WINDOWPOS *) lParam;
	if ((wp->flags & SWP_NOSIZE) != 0)
		return FALSE;

	// TODO does wp store the window rect or the client rect?
	if (GetClientRect(t->hwnd, &client) == 0)
		panic("error getting Table client rect in resizeHandler()");
	// TODO do this after calling updateTableWidth() (which calls repositionHeader()?)?
	client.top += t->headerHeight;

	// update the width...
	// this will call repositionHeader(); there's a good reason... (see comments)
	// TODO when I clean that mess up, remove this comment
	updateTableWidth(t);

	// ...and the height
	// TODO find out if order matters
	height = client.bottom - client.top;
	t->vpagesize = height / rowht(t);
	// do a dummy scroll to reflect those changes
	vscrollby(t, 0);

	*lResult = 0;
	return TRUE;
}