summaryrefslogtreecommitdiff
path: root/wintable/new/checkboxes.h
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-12-21 18:45:37 -0500
committerPietro Gagliardi <[email protected]>2014-12-21 18:45:37 -0500
commit2cf116883096bf809db292db26eef889ad39d4db (patch)
tree45b216f69ac3ff0df30481e3a744f7f00836a047 /wintable/new/checkboxes.h
parent9e66dc006edec187b7be9e62b3e2d15abfe86de4 (diff)
Started writing the code for handling mouse moves and checkbox hovers.
Diffstat (limited to 'wintable/new/checkboxes.h')
-rw-r--r--wintable/new/checkboxes.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/wintable/new/checkboxes.h b/wintable/new/checkboxes.h
index 1320fa1..6d8a86d 100644
--- a/wintable/new/checkboxes.h
+++ b/wintable/new/checkboxes.h
@@ -132,3 +132,34 @@ static void loadCheckboxThemeData(struct table *t)
if (ReleaseDC(t->hwnd, dc) == 0)
panic("error releasing Table DC for loading checkbox theme data");
}
+
+HANDLER(checkboxMouseMoveHandler)
+{
+ struct rowcol rc;
+ RECT r;
+
+ if (!t->checkboxMouseOverLast) {
+ t->checkboxMouseOverLast = TRUE;
+ retrack(t);
+ }
+ // TODO redraw old cell
+ // TODO we could probably optimize these by only checking the checkbox rects
+ t->checkboxMouseOverLastPoint = lParam;
+ rc = lParamToRowColumn(t, t->checkboxMouseOverLastPoint);
+ if (rc.row != -1 && rc.column != -1)
+ if (t->columnTypes[rc.column] == tableColumnCheckbox)
+ if (rowColumnToClientRect(t, rc, &r))
+ if (InvalidateRect(t->hwnd, &r, TRUE) == 0)
+ panic("error queueing Table checkbox for redraw after mouse over");
+ *lResult = 0;
+ return TRUE;
+}
+
+HANDLER(checkboxMouseLeaveHandler)
+{
+ // TODO redraw old cell
+ // TODO remember what I wanted to do here in the case of a held mouse button
+ t->checkboxMouseOverLast = FALSE;
+ *lResult = 0;
+ return TRUE;
+}