diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-03 20:08:25 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-03 20:08:25 -0400 |
| commit | 8c4cd789ca4dc69a56bf3327ff7ebbb5b88314be (patch) | |
| tree | fe52b1a8a55552d2ebcea3480442f5953374afd3 /redo/tab_darwin.go | |
| parent | b6d07237b423b690570e105e5f0810d35693b0d0 (diff) | |
Migrated the Mac OS X backend to the new Control setup.
Diffstat (limited to 'redo/tab_darwin.go')
| -rw-r--r-- | redo/tab_darwin.go | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/redo/tab_darwin.go b/redo/tab_darwin.go index ef834ad..5175698 100644 --- a/redo/tab_darwin.go +++ b/redo/tab_darwin.go @@ -10,16 +10,13 @@ import ( import "C" type tab struct { - *controlbase - - tabs []*sizer + _id C.id + tabs []*sizer } func newTab() Tab { t := new(tab) - id := C.newTab(unsafe.Pointer(t)) - t.controlbase = newControl(id) - t.fpreferredSize = t.tabpreferredSize + t._id = C.newTab(unsafe.Pointer(t)) return t } @@ -28,18 +25,11 @@ func (t *tab) Append(name string, control Control) { t.tabs = append(t.tabs, s) cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) - tabview := C.tabAppend(t.id, cname) + tabview := C.tabAppend(t._id, cname) s.child = control s.child.setParent(&controlParent{tabview}) } -func (t *tab) tabpreferredSize(d *sizing) (width, height int) { - s := C.tabPrefSize(t.id) - return int(s.width), int(s.height) -} - -// no need to override Control.commitResize() as only prepared the tabbed control; its children will be reallocated when that one is resized - //export tabResized func tabResized(data unsafe.Pointer, width C.intptr_t, height C.intptr_t) { t := (*tab)(unsafe.Pointer(data)) @@ -48,3 +38,37 @@ func tabResized(data unsafe.Pointer, width C.intptr_t, height C.intptr_t) { s.resize(0, 0, int(width), int(height)) } } + +func (t *tab) id() C.id { + return t._id +} + +func (t *tab) setParent(p *controlParent) { + basesetParent(t, p) +} + +func (t *tab) containerShow() { + basecontainerShow(t) +} + +func (t *tab) containerHide() { + basecontainerHide(t) +} + +func (t *tab) allocate(x int, y int, width int, height int, d *sizing) []*allocation { + return baseallocate(t, x, y, width, height, d) +} + +func (t *tab) preferredSize(d *sizing) (width, height int) { + s := C.tabPrefSize(t._id) + return int(s.width), int(s.height) +} + +// no need to override Control.commitResize() as only prepared the tabbed control; its children will be reallocated when that one is resized +func (t *tab) commitResize(a *allocation, d *sizing) { + basecommitResize(t, a, d) +} + +func (t *tab) getAuxResizeInfo(d *sizing) { + basegetAuxResizeInfo(t, d) +} |
