summaryrefslogtreecommitdiff
path: root/redo/table_windows.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-20 21:21:45 -0400
committerPietro Gagliardi <[email protected]>2014-08-20 21:21:45 -0400
commitb964c564e7a7d7a460dbcf922f4ceeb5368def50 (patch)
tree4573927e1f9b7e025cfe6fbffa65f45e309691d7 /redo/table_windows.go
parentf60e888c38dc866b3110145dfdfeffff0c0e0f40 (diff)
Added Table.OnSelected() and implemented it on Windows.
Diffstat (limited to 'redo/table_windows.go')
-rw-r--r--redo/table_windows.go12
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
}