summaryrefslogtreecommitdiff
path: root/redo/table_windows.c
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-17 17:22:47 -0400
committerPietro Gagliardi <[email protected]>2014-08-17 17:22:47 -0400
commitd9b9a9a74346c4933a11e2369d56a22cf51b12aa (patch)
tree4a0679c92d4cdead845b673815fdaec817041431 /redo/table_windows.c
parentd7c173cc05f139d012618e48e2dbfc4454732126 (diff)
Implemented hover-to-hot on Windows Table checkboxes.
Diffstat (limited to 'redo/table_windows.c')
-rw-r--r--redo/table_windows.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/redo/table_windows.c b/redo/table_windows.c
index 775d4e6..357da25 100644
--- a/redo/table_windows.c
+++ b/redo/table_windows.c
@@ -6,6 +6,22 @@
// provided for cgo's benefit
LPWSTR xWC_LISTVIEW = WC_LISTVIEW;
+static void handleMouseMove(HWND hwnd, WPARAM wParam, LPARAM lParam, void *data)
+{
+ LVHITTESTINFO ht;
+
+ // TODO use wParam
+ ZeroMemory(&ht, sizeof (LVHITTESTINFO));
+ ht.pt.x = GET_X_LPARAM(lParam);
+ ht.pt.y = GET_Y_LPARAM(lParam);
+ ht.flags = LVHT_ONITEMSTATEICON;
+ if (SendMessageW(hwnd, LVM_SUBITEMHITTEST, 0, (LPARAM) (&ht)) == (LRESULT) -1) {
+ tableSetHot(data, -1, -1);
+ return; // no item
+ }
+ tableSetHot(data, ht.iItem, ht.iSubItem);
+}
+
static LRESULT CALLBACK tableSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR id, DWORD_PTR data)
{
NMHDR *nmhdr = (NMHDR *) lParam;
@@ -19,6 +35,10 @@ static LRESULT CALLBACK tableSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
return 0;
}
return (*fv_DefSubclassProc)(hwnd, uMsg, wParam, lParam);
+ case WM_MOUSEMOVE:
+ handleMouseMove(hwnd, wParam, lParam, (void *) data);
+ // and let the list view do its thing
+ return (*fv_DefSubclassProc)(hwnd, uMsg, wParam, lParam);
// see table.autoresize() in table_windows.go for the column autosize policy
case WM_NOTIFY: // from the contained header control
if (nmhdr->code == HDN_BEGINTRACK)