Added some prerequisite bookkeeping needed for Windows Table horizontal scrolling.

This commit is contained in:
Pietro Gagliardi 2014-11-06 20:28:34 -05:00
parent 80679f3d35
commit 0c1e4bedb1
1 changed files with 8 additions and 2 deletions

View File

@ -45,6 +45,9 @@ struct table {
intptr_t nColumns;
HIMAGELIST imagelist;
int imagelistHeight;
intptr_t width;
intptr_t hpageSize;
intptr_t hpos;
};
static LONG rowHeight(struct table *t)
@ -107,15 +110,18 @@ static void recomputeHScroll(struct table *t)
abort();
width += item.cxy;
}
t->width = (intptr_t) width;
if (GetClientRect(t->hwnd, &r) == 0)
abort();
t->hpageSize = r.right - r.left;
ZeroMemory(&si, sizeof (SCROLLINFO));
si.cbSize = sizeof (SCROLLINFO);
si.fMask = SIF_PAGE | SIF_RANGE;
si.nPage = r.right - r.left;
si.nPage = t->hpageSize;
si.nMin = 0;
si.nMax = width - 1; // - 1 because endpoints inclusive
si.nMax = t->width - 1; // - 1 because endpoints inclusive
SetScrollInfo(t->hwnd, SB_HORZ, &si, TRUE);
}