summaryrefslogtreecommitdiff
path: root/redo/table_windows.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-06 10:42:26 -0400
committerPietro Gagliardi <[email protected]>2014-08-06 10:42:26 -0400
commitb3b91c68d0b2613700cf84b5887b5ac79da0eb56 (patch)
tree9dda9358e571d3dfcf64a549d92c72846c229bce /redo/table_windows.go
parent3dcdd055620e76a3606e6d525aed7cf86595a279 (diff)
Implemented reasonable table column autosizing on Windows.
Diffstat (limited to 'redo/table_windows.go')
-rw-r--r--redo/table_windows.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/redo/table_windows.go b/redo/table_windows.go
index 2748b0d..576ae4a 100644
--- a/redo/table_windows.go
+++ b/redo/table_windows.go
@@ -14,6 +14,8 @@ import "C"
type table struct {
*tablebase
_hwnd C.HWND
+ noautosize bool
+ colcount C.int
}
func finishNewTable(b *tablebase, ty reflect.Type) Table {
@@ -30,6 +32,7 @@ func finishNewTable(b *tablebase, ty reflect.Type) Table {
for i := 0; i < ty.NumField(); i++ {
C.tableAppendColumn(t._hwnd, C.int(i), toUTF16(ty.Field(i).Name))
}
+ t.colcount = C.int(ty.NumField())
return t
}
@@ -53,6 +56,27 @@ func tableGetCellText(data unsafe.Pointer, row C.int, col C.int, str *C.LPWSTR)
*str = toUTF16(s)
}
+//export tableStopColumnAutosize
+func tableStopColumnAutosize(data unsafe.Pointer) {
+ t := (*table)(data)
+ t.noautosize = true
+}
+
+//export tableAutosizeColumns
+func tableAutosizeColumns(data unsafe.Pointer) C.BOOL {
+ t := (*table)(data)
+ if t.noautosize {
+ return C.FALSE
+ }
+ return C.TRUE
+}
+
+//export tableColumnCount
+func tableColumnCount(data unsafe.Pointer) C.int {
+ t := (*table)(data)
+ return t.colcount
+}
+
func (t *table) hwnd() C.HWND {
return t._hwnd
}