summaryrefslogtreecommitdiff
path: root/redo/table_darwin.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-03 20:08:25 -0400
committerPietro Gagliardi <[email protected]>2014-08-03 20:08:25 -0400
commit8c4cd789ca4dc69a56bf3327ff7ebbb5b88314be (patch)
treefe52b1a8a55552d2ebcea3480442f5953374afd3 /redo/table_darwin.go
parentb6d07237b423b690570e105e5f0810d35693b0d0 (diff)
Migrated the Mac OS X backend to the new Control setup.
Diffstat (limited to 'redo/table_darwin.go')
-rw-r--r--redo/table_darwin.go47
1 files changed, 41 insertions, 6 deletions
diff --git a/redo/table_darwin.go b/redo/table_darwin.go
index 8417afe..a3e3b76 100644
--- a/redo/table_darwin.go
+++ b/redo/table_darwin.go
@@ -12,20 +12,23 @@ import (
import "C"
type table struct {
- *scrolledcontrol
*tablebase
+
+ _id C.id
+ scroller *scroller
}
func finishNewTable(b *tablebase, ty reflect.Type) Table {
id := C.newTable()
t := &table{
- scrolledcontrol: newScrolledControl(id),
- tablebase: b,
+ _id: id,
+ scroller: newScroller(id),
+ tablebase: b,
}
- C.tableMakeDataSource(t.id, unsafe.Pointer(t))
+ C.tableMakeDataSource(t._id, unsafe.Pointer(t))
for i := 0; i < ty.NumField(); i++ {
cname := C.CString(ty.Field(i).Name)
- C.tableAppendColumn(t.id, cname)
+ C.tableAppendColumn(t._id, cname)
C.free(unsafe.Pointer(cname)) // free now (not deferred) to conserve memory
}
return t
@@ -37,7 +40,7 @@ func (t *table) Unlock() {
// not sure about this one...
t.RLock()
defer t.RUnlock()
- C.tableUpdate(t.id)
+ C.tableUpdate(t._id)
}
//export goTableDataSource_getValue
@@ -59,3 +62,35 @@ func goTableDataSource_getRowCount(data unsafe.Pointer) C.intptr_t {
d := reflect.Indirect(reflect.ValueOf(t.data))
return C.intptr_t(d.Len())
}
+
+func (t *table) id() C.id {
+ return t._id
+}
+
+func (t *table) setParent(p *controlParent) {
+ t.scroller.setParent(p)
+}
+
+func (t *table) containerShow() {
+ basecontainerShow(t)
+}
+
+func (t *table) containerHide() {
+ basecontainerHide(t)
+}
+
+func (t *table) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
+ return baseallocate(t, x, y, width, height, d)
+}
+
+func (t *table) preferredSize(d *sizing) (width, height int) {
+ return basepreferredSize(t, d)
+}
+
+func (t *table) commitResize(c *allocation, d *sizing) {
+ t.scroller.commitResize(c, d)
+}
+
+func (t *table) getAuxResizeInfo(d *sizing) {
+ basegetAuxResizeInfo(t, d)
+}