Draw whole selected row properly this time (full background on row, focus rect on cell). More TODOs.
This commit is contained in:
parent
3bd6ccb02b
commit
9e07f271aa
|
@ -19,12 +19,12 @@ static void drawCell(struct table *t, HDC dc, struct drawCellParams *p)
|
||||||
int textColor;
|
int textColor;
|
||||||
POINT pt;
|
POINT pt;
|
||||||
int cbState;
|
int cbState;
|
||||||
|
RECT cellrect;
|
||||||
|
|
||||||
// TODO verify these two
|
// TODO verify these two
|
||||||
background = (HBRUSH) (COLOR_WINDOW + 1);
|
background = (HBRUSH) (COLOR_WINDOW + 1);
|
||||||
textColor = COLOR_WINDOWTEXT;
|
textColor = COLOR_WINDOWTEXT;
|
||||||
// TODO get rid of the selectedColumn bits
|
if (t->selectedRow == p->row) {
|
||||||
if (t->selectedRow == p->row && t->selectedColumn == p->column) {
|
|
||||||
// these are the colors wine uses (http://source.winehq.org/source/dlls/comctl32/listview.c)
|
// 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
|
// the two for unfocused are also suggested by http://stackoverflow.com/questions/10428710/windows-forms-inactive-highlight-color
|
||||||
background = (HBRUSH) (COLOR_HIGHLIGHT + 1);
|
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;
|
r.bottom = p->y + p->height;
|
||||||
if (FillRect(dc, &r, background) == 0)
|
if (FillRect(dc, &r, background) == 0)
|
||||||
panic("error filling Table cell background");
|
panic("error filling Table cell background");
|
||||||
|
cellrect = r; // save for drawing the focus rect
|
||||||
|
|
||||||
switch (t->columnTypes[p->column]) {
|
switch (t->columnTypes[p->column]) {
|
||||||
case tableColumnText:
|
case tableColumnText:
|
||||||
|
@ -72,8 +73,14 @@ static void drawCell(struct table *t, HDC dc, struct drawCellParams *p)
|
||||||
drawCheckbox(t, dc, &r, cbState);
|
drawCheckbox(t, dc, &r, cbState);
|
||||||
break;
|
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)
|
static void draw(struct table *t, HDC dc, RECT cliprect, RECT client)
|
||||||
{
|
{
|
||||||
intptr_t i, j;
|
intptr_t i, j;
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
// - going right from column 0 to column 2 with the right arrow key deselects
|
// - going right from column 0 to column 2 with the right arrow key deselects
|
||||||
// - make sure all error messages involving InvalidateRect() are consistent with regards to "redrawing" and "queueing for redraw"
|
// - make sure all error messages involving InvalidateRect() are consistent with regards to "redrawing" and "queueing for redraw"
|
||||||
// - collect all resize-related tasks in a single function (so things like adding columns will refresh everything, not just horizontal scrolls; also would fix initial coordinates)
|
// - collect all resize-related tasks in a single function (so things like adding columns will refresh everything, not just horizontal scrolls; also would fix initial coordinates)
|
||||||
|
// - checkbox columns don't clip to the column width
|
||||||
|
|
||||||
#define tableWindowClass L"gouitable"
|
#define tableWindowClass L"gouitable"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue