diff --git a/redo/containerctrls_darwin.go b/redo/containerctrls_darwin.go index 7249134..4c70cce 100644 --- a/redo/containerctrls_darwin.go +++ b/redo/containerctrls_darwin.go @@ -12,7 +12,7 @@ import "C" type tab struct { *controlbase - containers []*container + tabs []*sizer } func newTab() Tab { @@ -23,14 +23,13 @@ func newTab() Tab { } func (t *tab) Append(name string, control Control) { - // TODO isolate and standardize - c := new(container) - t.containers = append(t.containers, c) + s := new(sizer) + t.tabs = append(t.tabs, s) cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) tabview := C.tabAppend(t.id, cname) - c.child = control - c.child.setParent(&controlParent{tabview}) + s.child = control + s.child.setParent(&controlParent{tabview}) } // no need to override Control.allocate() as only prepared the tabbed control; its children will be reallocated when that one is resized @@ -38,8 +37,8 @@ func (t *tab) Append(name string, control Control) { //export tabResized func tabResized(data unsafe.Pointer, width C.intptr_t, height C.intptr_t) { t := (*tab)(unsafe.Pointer(data)) - for _, c := range t.containers { + for _, s := range t.tabs { // the tab area's coordinate system is localized, so the origin is (0, 0) - c.resize(0, 0, int(width), int(height)) + s.resize(0, 0, int(width), int(height)) } } diff --git a/redo/sizing_darwin.go b/redo/sizer_darwin.go similarity index 94% rename from redo/sizing_darwin.go rename to redo/sizer_darwin.go index 6eb29b2..1aa345a 100644 --- a/redo/sizing_darwin.go +++ b/redo/sizer_darwin.go @@ -24,7 +24,7 @@ const ( macYPadding = 12 ) -func (c *container) beginResize() (d *sizing) { +func (s *sizer) beginResize() (d *sizing) { d = new(sizing) if spaced { d.xmargin = macXMargin @@ -35,7 +35,7 @@ func (c *container) beginResize() (d *sizing) { return d } -func (c *container) translateAllocationCoords(allocations []*allocation, winwidth, winheight int) { +func (s *sizer) translateAllocationCoords(allocations []*allocation, winwidth, winheight int) { for _, a := range allocations { // winheight - y because (0,0) is the bottom-left corner of the window and not the top-left corner // (winheight - y) - height because (x, y) is the bottom-left corner of the control and not the top-left diff --git a/redo/window_darwin.go b/redo/window_darwin.go index 80d1a51..8393cf7 100644 --- a/redo/window_darwin.go +++ b/redo/window_darwin.go @@ -15,7 +15,7 @@ type window struct { closing *event - *container + *sizer } func newWindow(title string, width int, height int, control Control) *window { @@ -26,7 +26,7 @@ func newWindow(title string, width int, height int, control Control) *window { w := &window{ id: id, closing: newEvent(), - container: new(container), + sizer: new(sizer), } C.windowSetDelegate(id, unsafe.Pointer(w)) w.child = control