summaryrefslogtreecommitdiff
path: root/wintable/new/checkboxes.h
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-12-22 21:16:42 -0500
committerPietro Gagliardi <[email protected]>2014-12-22 21:16:42 -0500
commitd28b05c5b77debafd8dc410be0eebf28d50aba6b (patch)
treedda91eb39c1c50c5ccaf82348d98606ec8dceb81 /wintable/new/checkboxes.h
parent7ba7222976b1260065d633855830ffd20e153bf0 (diff)
Fixed up the rest of the checkbox event handlers. Now to convert to using the drawing functions.
Diffstat (limited to 'wintable/new/checkboxes.h')
-rw-r--r--wintable/new/checkboxes.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/wintable/new/checkboxes.h b/wintable/new/checkboxes.h
index 4308817..b7e8f0f 100644
--- a/wintable/new/checkboxes.h
+++ b/wintable/new/checkboxes.h
@@ -1,10 +1,10 @@
// 16 august 2014
enum {
- checkboxStateChecked = 1 << 0,
- checkboxStateHot = 1 << 1,
- checkboxStatePushed = 1 << 2,
- checkboxnStates = 1 << 3,
+ checkboxStateChecked = 1 << 0,
+ checkboxStateHot = 1 << 1,
+ checkboxStatePushed = 1 << 2,
+ checkboxnStates = 1 << 3,
};
// TODO actually make this
@@ -220,7 +220,7 @@ HANDLER(checkboxMouseUpHandler)
rc = lParamToRowColumn(t, lParam);
if (rc.row == -1 || rc.column == -1)
goto wrongUp;
- if (rc.row != t->checkboxMouseDownRow && rc.column != t->checkboxMouseDownColumn)
+ if (rc.row != t->checkboxMouseDownRow || rc.column != t->checkboxMouseDownColumn)
goto wrongUp;
if (t->columnTypes[rc.column] != tableColumnCheckbox)
goto wrongUp;
@@ -240,7 +240,17 @@ lastCheckbox = rc;
*lResult = 0;
return TRUE;
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;
return FALSE; // TODO really?
}