Fixed up the rest of the checkbox event handlers. Now to convert to using the drawing functions.
This commit is contained in:
parent
7ba7222976
commit
d28b05c5b7
|
@ -1,10 +1,10 @@
|
||||||
// 16 august 2014
|
// 16 august 2014
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
checkboxStateChecked = 1 << 0,
|
checkboxStateChecked = 1 << 0,
|
||||||
checkboxStateHot = 1 << 1,
|
checkboxStateHot = 1 << 1,
|
||||||
checkboxStatePushed = 1 << 2,
|
checkboxStatePushed = 1 << 2,
|
||||||
checkboxnStates = 1 << 3,
|
checkboxnStates = 1 << 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO actually make this
|
// TODO actually make this
|
||||||
|
@ -220,7 +220,7 @@ HANDLER(checkboxMouseUpHandler)
|
||||||
rc = lParamToRowColumn(t, lParam);
|
rc = lParamToRowColumn(t, lParam);
|
||||||
if (rc.row == -1 || rc.column == -1)
|
if (rc.row == -1 || rc.column == -1)
|
||||||
goto wrongUp;
|
goto wrongUp;
|
||||||
if (rc.row != t->checkboxMouseDownRow && rc.column != t->checkboxMouseDownColumn)
|
if (rc.row != t->checkboxMouseDownRow || rc.column != t->checkboxMouseDownColumn)
|
||||||
goto wrongUp;
|
goto wrongUp;
|
||||||
if (t->columnTypes[rc.column] != tableColumnCheckbox)
|
if (t->columnTypes[rc.column] != tableColumnCheckbox)
|
||||||
goto wrongUp;
|
goto wrongUp;
|
||||||
|
@ -240,7 +240,17 @@ lastCheckbox = rc;
|
||||||
*lResult = 0;
|
*lResult = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
wrongUp:
|
wrongUp:
|
||||||
// TODO redraw the invalid cell
|
if (t->checkboxMouseDown) {
|
||||||
|
rc.row = t->checkboxMouseDownRow;
|
||||||
|
rc.column = t->checkboxMouseDownColumn;
|
||||||
|
if (rowColumnToClientRect(t, rc, &r))
|
||||||
|
// TODO only the checkbox rect?
|
||||||
|
if (InvalidateRect(t->hwnd, &r, TRUE) == 0)
|
||||||
|
panic("error redrawing Table checkbox rect for aborted mouse up event");
|
||||||
|
}
|
||||||
|
// if we landed on another checkbox, be sure to draw that one too
|
||||||
|
if (t->checkboxMouseOverLast)
|
||||||
|
redrawCheckboxRect(t, t->checkboxMouseOverLastPoint);
|
||||||
t->checkboxMouseDown = FALSE;
|
t->checkboxMouseDown = FALSE;
|
||||||
return FALSE; // TODO really?
|
return FALSE; // TODO really?
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ static void drawCell(struct table *t, HDC dc, struct drawCellParams *p)
|
||||||
toCheckboxRect(t, &r, p->xoff);
|
toCheckboxRect(t, &r, p->xoff);
|
||||||
SetDCBrushColor(dc, RGB(255, 0, 0));
|
SetDCBrushColor(dc, RGB(255, 0, 0));
|
||||||
if (p->row == lastCheckbox.row && p->column == lastCheckbox.column)
|
if (p->row == lastCheckbox.row && p->column == lastCheckbox.column)
|
||||||
SetDCBrushColor(dc, RGB(128, 0, 128));
|
SetDCBrushColor(dc, RGB(216, 0, 216));
|
||||||
if (t->checkboxMouseDown) {
|
if (t->checkboxMouseDown) {
|
||||||
if (p->row == t->checkboxMouseDownRow && p->column == t->checkboxMouseDownColumn)
|
if (p->row == t->checkboxMouseDownRow && p->column == t->checkboxMouseDownColumn)
|
||||||
SetDCBrushColor(dc, RGB(0, 0, 255));
|
SetDCBrushColor(dc, RGB(0, 0, 255));
|
||||||
|
|
Loading…
Reference in New Issue