diff options
Diffstat (limited to 'redo/table_windows.go')
| -rw-r--r-- | redo/table_windows.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/redo/table_windows.go b/redo/table_windows.go index 1ed09b8..2976011 100644 --- a/redo/table_windows.go +++ b/redo/table_windows.go @@ -20,6 +20,7 @@ type table struct { hotcol C.int pushedrow C.int pushedcol C.int + selected *event } func finishNewTable(b *tablebase, ty reflect.Type) Table { @@ -32,6 +33,7 @@ func finishNewTable(b *tablebase, ty reflect.Type) Table { hotcol: -1, pushedrow: -1, pushedcol: -1, + selected: newEvent(), } C.setTableSubclass(t._hwnd, unsafe.Pointer(t)) // LVS_EX_FULLROWSELECT gives us selection across the whole row, not just the leftmost column; this makes the list view work like on other platforms @@ -74,6 +76,10 @@ func (t *table) Select(index int) { C.tableSelectItem(t._hwnd, C.intptr_t(index)) } +func (t *table) OnSelected(f func()) { + t.selected.set(f) +} + //export tableGetCell func tableGetCell(data unsafe.Pointer, item *C.LVITEMW) { t := (*table)(data) @@ -181,6 +187,12 @@ func tableToggled(data unsafe.Pointer, row C.int, col C.int) { panic(fmt.Errorf("tableSetHot() on non-checkbox at (%d, %d)", row, col)) } +//export tableOnSelected +func tableOnSelected(data unsafe.Pointer) { + t := (*table)(data) + t.selected.fire() +} + func (t *table) hwnd() C.HWND { return t._hwnd } |
