summaryrefslogtreecommitdiff
path: root/wintable/new/draw.h
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-12-23 14:43:33 -0500
committerPietro Gagliardi <[email protected]>2014-12-23 14:43:33 -0500
commit9e07f271aa93ad49fd7a4a1f1f134cd1fd500eb8 (patch)
treeb938dc131a6ff4720aeb6b7255da4a7110f51362 /wintable/new/draw.h
parent3bd6ccb02b52f4212051b16d6ef845afed82a9fd (diff)
Draw whole selected row properly this time (full background on row, focus rect on cell). More TODOs.
Diffstat (limited to 'wintable/new/draw.h')
-rw-r--r--wintable/new/draw.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/wintable/new/draw.h b/wintable/new/draw.h
index 409a1ad..135f1df 100644
--- a/wintable/new/draw.h
+++ b/wintable/new/draw.h
@@ -19,12 +19,12 @@ static void drawCell(struct table *t, HDC dc, struct drawCellParams *p)
int textColor;
POINT pt;
int cbState;
+ RECT cellrect;
// TODO verify these two
background = (HBRUSH) (COLOR_WINDOW + 1);
textColor = COLOR_WINDOWTEXT;
- // TODO get rid of the selectedColumn bits
- if (t->selectedRow == p->row && t->selectedColumn == p->column) {
+ if (t->selectedRow == p->row) {
// these are the colors wine uses (http://source.winehq.org/source/dlls/comctl32/listview.c)
// the two for unfocused are also suggested by http://stackoverflow.com/questions/10428710/windows-forms-inactive-highlight-color
background = (HBRUSH) (COLOR_HIGHLIGHT + 1);
@@ -42,6 +42,7 @@ static void drawCell(struct table *t, HDC dc, struct drawCellParams *p)
r.bottom = p->y + p->height;
if (FillRect(dc, &r, background) == 0)
panic("error filling Table cell background");
+ cellrect = r; // save for drawing the focus rect
switch (t->columnTypes[p->column]) {
case tableColumnText:
@@ -72,8 +73,14 @@ static void drawCell(struct table *t, HDC dc, struct drawCellParams *p)
drawCheckbox(t, dc, &r, cbState);
break;
}
+
+ // TODO in front of or behind the cell contents?
+ if (t->selectedRow == p->row && t->selectedColumn == p->column)
+ if (DrawFocusRect(dc, &cellrect) == 0)
+ panic("error drawing focus rect on current Table cell");
}
+// TODO use cliprect
static void draw(struct table *t, HDC dc, RECT cliprect, RECT client)
{
intptr_t i, j;