From 3cb96de1628495f176d9e7fe4104b8c6cca36635 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 20 Dec 2014 21:09:01 -0500 Subject: Wrote up toItemContentRect() and used that in drawCell(). More TODOs. --- wintable/new/draw.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'wintable/new/draw.h') diff --git a/wintable/new/draw.h b/wintable/new/draw.h index 0659f54..a4bd22d 100644 --- a/wintable/new/draw.h +++ b/wintable/new/draw.h @@ -41,13 +41,10 @@ static void drawCell(struct table *t, HDC dc, struct drawCellParams *p) if (FillRect(dc, &r, background) == 0) panic("error filling Table cell background"); - // now offset the content to where inside the cell it should be - r.left += p->xoff; - // TODO vertical center content too - switch (t->columnTypes[p->column]) { case tableColumnText: case tableColumnImage: // TODO + toItemContentRect(t, &r, p->xoff, 0, 0); // TODO get the text height if (SetTextColor(dc, GetSysColor(textColor)) == CLR_INVALID) panic("error setting Table cell text color"); if (SetBkMode(dc, TRANSPARENT) == 0) @@ -57,8 +54,7 @@ static void drawCell(struct table *t, HDC dc, struct drawCellParams *p) panic("error drawing Table cell text"); break; case tableColumnCheckbox: - r.right = r.left + t->checkboxWidth; - r.bottom = r.top + t->checkboxHeight; + toCheckboxRect(t, &r); SetDCBrushColor(dc, RGB(255, 0, 0)); FillRect(dc, &r, GetStockObject(DC_BRUSH)); break; -- cgit v1.2.3