summaryrefslogtreecommitdiff
path: root/redo/table_darwin.go
diff options
context:
space:
mode:
Diffstat (limited to 'redo/table_darwin.go')
-rw-r--r--redo/table_darwin.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/redo/table_darwin.go b/redo/table_darwin.go
new file mode 100644
index 0000000..91a57ac
--- /dev/null
+++ b/redo/table_darwin.go
@@ -0,0 +1,45 @@
+// 29 july 2014
+
+package ui
+
+import (
+// "fmt"
+ "reflect"
+ "unsafe"
+)
+
+// #include "objc_darwin.h"
+import "C"
+
+type table struct {
+ *widgetbase
+ *tablebase
+
+ // TODO kludge
+ table C.id
+}
+
+func finishNewTable(b *tablebase, ty reflect.Type) Table {
+ id := C.newTable()
+ t := &table{
+ widgetbase: newWidget(C.newScrollView(id)),
+ tablebase: b,
+ table: id,
+ }
+ // TODO model
+ for i := 0; i < ty.NumField(); i++ {
+ cname := C.CString(ty.Field(i).Name)
+ C.tableAppendColumn(t.table, cname)
+ C.free(unsafe.Pointer(cname)) // free now (not deferred) to conserve memory
+ }
+ return t
+}
+
+func (t *table) Unlock() {
+ t.unlock()
+ // TODO RACE CONDITION HERE
+ // not sure about this one...
+ t.RLock()
+ defer t.RUnlock()
+ C.tableUpdate(t.table)
+}