summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-11-07 18:13:59 -0500
committerPietro Gagliardi <[email protected]>2014-11-07 18:13:59 -0500
commit85fd26a3e396d0ec621370a5129298d8502ad9ff (patch)
tree34ebc7e0f5a1db2aa2c50bf4c949d2b935ed22c4
parent3cb5017b35154237ea862d3856ef945eb7790005 (diff)
Handled horizontal scrolling in drawing. Now to fix the header...
-rw-r--r--wintable/main.c5
1 files changed, 5 insertions, 0 deletions
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()?