From 85fd26a3e396d0ec621370a5129298d8502ad9ff Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 7 Nov 2014 18:13:59 -0500 Subject: [PATCH] Handled horizontal scrolling in drawing. Now to fix the header... --- wintable/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wintable/main.c b/wintable/main.c index 74d1a0b..2c7ac3e 100644 --- a/wintable/main.c +++ b/wintable/main.c @@ -388,6 +388,8 @@ static void resize(struct table *t) recomputeHScroll(t); } +// TODO alter this so that only the visible columns are redrawn +// TODO this means rename controlSize to clientRect static void drawItem(struct table *t, HDC dc, intptr_t i, LONG y, LONG height, RECT controlSize) { RECT rsel; @@ -413,6 +415,7 @@ static void drawItem(struct table *t, HDC dc, intptr_t i, LONG y, LONG height, R } // first fill the selection rect + // note that this already only draws the visible area rsel.left = controlSize.left; rsel.top = y; rsel.right = controlSize.right - controlSize.left; @@ -421,6 +424,8 @@ static void drawItem(struct table *t, HDC dc, intptr_t i, LONG y, LONG height, R abort(); xoff = SendMessageW(t->header, HDM_GETBITMAPMARGIN, 0, 0); + // now adjust for horizontal scrolling + xoff -= t->hpos; // now draw the cells // TODO check error from GetSysColor()?