Added code for distinguishing column types to drawCell().

This commit is contained in:
Pietro Gagliardi 2014-12-19 20:48:02 -05:00
parent ee9b958171
commit 34d3771f77
1 changed files with 11 additions and 7 deletions

View File

@ -45,13 +45,17 @@ static void drawCell(struct table *t, HDC dc, struct drawCellParams *p)
r.left += p->xoff; r.left += p->xoff;
// TODO vertical center content too // TODO vertical center content too
if (SetTextColor(dc, GetSysColor(textColor)) == CLR_INVALID) switch (t->columnTypes[p->column]) {
panic("error setting Table cell text color"); case tableColumnText:
if (SetBkMode(dc, TRANSPARENT) == 0) case tableColumnImage: // TODO
panic("error setting transparent text drawing mode for Table cell"); if (SetTextColor(dc, GetSysColor(textColor)) == CLR_INVALID)
n = wsprintf(msg, L"(%d,%d)", p->row, p->column); panic("error setting Table cell text color");
if (DrawTextExW(dc, msg, n, &r, DT_END_ELLIPSIS | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE, NULL) == 0) if (SetBkMode(dc, TRANSPARENT) == 0)
panic("error drawing Table cell text"); panic("error setting transparent text drawing mode for Table cell");
n = wsprintf(msg, L"(%d,%d)", p->row, p->column);
if (DrawTextExW(dc, msg, n, &r, DT_END_ELLIPSIS | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE, NULL) == 0)
panic("error drawing Table cell text");
}
} }
static void draw(struct table *t, HDC dc, RECT cliprect, RECT client) static void draw(struct table *t, HDC dc, RECT cliprect, RECT client)