summaryrefslogtreecommitdiff
path: root/wintable/new/draw.h
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-12-20 21:09:01 -0500
committerPietro Gagliardi <[email protected]>2014-12-20 21:09:01 -0500
commit3cb96de1628495f176d9e7fe4104b8c6cca36635 (patch)
tree8d6ed07fd2d458e9fb8e3d9d7d0df2763b9d9356 /wintable/new/draw.h
parent7713c913875ebea0af7cfd21840981a94dab654d (diff)
Wrote up toItemContentRect() and used that in drawCell(). More TODOs.
Diffstat (limited to 'wintable/new/draw.h')
-rw-r--r--wintable/new/draw.h8
1 files changed, 2 insertions, 6 deletions
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;