Mostly finisshed up horizontal scrolling by hooking it up to everything else. The sample text draw doesn't seem to be working correctly, but I'm not sure /when/ it breaks right now...

This commit is contained in:
Pietro Gagliardi 2014-12-11 16:43:05 -05:00
parent 9edf273ba7
commit 8ea320220a
2 changed files with 5 additions and 1 deletions

View File

@ -37,6 +37,8 @@ static void draw(struct table *t, HDC dc, RECT cliprect, RECT client)
for (i = 0; i < t->nColumns; i++) { for (i = 0; i < t->nColumns; i++) {
SendMessage(t->header, HDM_GETITEMRECT, (WPARAM) i, (LPARAM) (&r)); SendMessage(t->header, HDM_GETITEMRECT, (WPARAM) i, (LPARAM) (&r));
r.left -= t->hscrollpos;
r.right -= t->hscrollpos;
r.top = client.top; r.top = client.top;
r.bottom = client.bottom; r.bottom = client.bottom;
FillRect(dc, &r, GetSysColorBrush(x)); FillRect(dc, &r, GetSysColorBrush(x));
@ -47,7 +49,7 @@ static void draw(struct table *t, HDC dc, RECT cliprect, RECT client)
ZeroMemory(&p, sizeof (struct drawCellParams)); ZeroMemory(&p, sizeof (struct drawCellParams));
p.row = 0; p.row = 0;
p.column = 0; p.column = 0;
p.x = r.left; p.x = r.left - t->hscrollpos;
p.y = 100; p.y = 100;
p.width = r.right - r.left; p.width = r.right - r.left;
p.height = rowHeight(t, dc, FALSE); p.height = rowHeight(t, dc, FALSE);

View File

@ -28,6 +28,8 @@ static void repositionHeader(struct table *t)
if (GetClientRect(t->hwnd, &r) == 0) if (GetClientRect(t->hwnd, &r) == 0)
panic("error getting client rect for Table header repositioning"); panic("error getting client rect for Table header repositioning");
// we fake horizontal scrolling here by extending the client rect to the left by the scroll position
r.left -= t->hscrollpos;
l.prc = &r; l.prc = &r;
l.pwpos = &wp; l.pwpos = &wp;
if (SendMessageW(t->header, HDM_LAYOUT, 0, (LPARAM) (&l)) == FALSE) if (SendMessageW(t->header, HDM_LAYOUT, 0, (LPARAM) (&l)) == FALSE)