summaryrefslogtreecommitdiff
path: root/wintable/new/select.h
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-12-13 13:56:31 -0500
committerPietro Gagliardi <[email protected]>2014-12-13 13:56:31 -0500
commitcecfa8299429d52315616a9a3ce74302946d5662 (patch)
treea67a0c3f2e37d145c5ce4b3c227e2eff7175e62d /wintable/new/select.h
parent516173916e598781f22c42580aecbf75b109f6d3 (diff)
Implemented mouse click selection.
Diffstat (limited to 'wintable/new/select.h')
-rw-r--r--wintable/new/select.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/wintable/new/select.h b/wintable/new/select.h
new file mode 100644
index 0000000..c849802
--- /dev/null
+++ b/wintable/new/select.h
@@ -0,0 +1,23 @@
+// 13 december 2014
+
+// damn winsock
+static void doselect(struct table *t, intptr_t row, intptr_t column)
+{
+ t->selectedRow = row;
+ t->selectedColumn = column;
+ // TODO scroll to ensure the full cell is visible
+ // TODO redraw only the old and new columns /if there was no scrolling/
+ InvalidateRect(t->hwnd, NULL, TRUE);
+}
+
+// TODO which WM_xBUTTONDOWNs?
+HANDLER(mouseDownSelectHandler)
+{
+ struct rowcol rc;
+
+ rc = lParamToRowColumn(t, lParam);
+ // don't check if lParamToRowColumn() returned row -1 or column -1; we want deselection behavior
+ doselect(t, rc.row, rc.column);
+ *lResult = 0;
+ return TRUE;
+}