diff options
| author | Pietro Gagliardi <[email protected]> | 2015-12-11 20:37:59 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-12-11 20:37:59 -0500 |
| commit | f8e3f12ab02b528f2a05a4f713d7af7ea8e44b42 (patch) | |
| tree | 82dedf4d37f0f6d31e88ebb2ca1ce6499dead261 /prev/tab_darwin.go | |
| parent | e34c561ed5bedeb180437ec165882b98d70d38c1 (diff) | |
LET'S GET THIS FINAL REWRITE EVER STARTED
Diffstat (limited to 'prev/tab_darwin.go')
| -rw-r--r-- | prev/tab_darwin.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/prev/tab_darwin.go b/prev/tab_darwin.go new file mode 100644 index 0000000..7a8aefe --- /dev/null +++ b/prev/tab_darwin.go @@ -0,0 +1,41 @@ +// 25 july 2014 + +package ui + +import ( + "unsafe" +) + +// #include "objc_darwin.h" +import "C" + +type tab struct { + *controlSingleObject + tabs []*container + children []Control +} + +func newTab() Tab { + t := &tab{ + controlSingleObject: newControlSingleObject(C.newTab()), + } + t.fpreferredSize = t.xpreferredSize + return t +} + +func (t *tab) Append(name string, control Control) { + c := newContainer(control.resize) + t.tabs = append(t.tabs, c) + control.setParent(c.parent()) + t.children = append(t.children, control) + cname := C.CString(name) + defer C.free(unsafe.Pointer(cname)) + C.tabAppend(t.id, cname, c.id) +} + +func (t *tab) xpreferredSize(d *sizing) (width, height int) { + s := C.tabPreferredSize(t.id) + return int(s.width), int(s.height) +} + +// no need to handle resize; the children containers handle that for us |
