diff --git a/future b/future index 3bb3e44..abd7d12 100644 --- a/future +++ b/future @@ -1,7 +1,13 @@ +mac os x sizing is now completely broken + - need to catch window initial sizes + - need to catch tab changes + - rect should be based on the alignment rect, not the frame rect + new control stuff Tab, Group - - should host Controls directly - - should have sharedWndProc() + - should host Controls directly? + - should have sharedWndProc() + - Tab needs Margined more flexible sizing determination Tab needs a SetMargined(n), Margined(n) diff --git a/newctrl/container_darwin.go b/newctrl/container_darwin.go index 3e8c437..58b7777 100644 --- a/newctrl/container_darwin.go +++ b/newctrl/container_darwin.go @@ -17,7 +17,7 @@ type sizing struct { sizingbase // for size calculations - // nothing for mac + // nothing on Mac OS X // for the actual resizing neighborAlign C.struct_xalignment diff --git a/newctrl/container_darwin.m b/newctrl/container_darwin.m index c5a50e1..1dfa7cb 100644 --- a/newctrl/container_darwin.m +++ b/newctrl/container_darwin.m @@ -34,7 +34,14 @@ id newContainerView(void *gocontainer) void moveControl(id c, intptr_t x, intptr_t y, intptr_t width, intptr_t height) { - [toNSView(c) setFrame:NSMakeRect((CGFloat) x, (CGFloat) y, (CGFloat) width, (CGFloat) height)]; + NSView *v; + NSRect frame; + + frame = NSMakeRect((CGFloat) x, (CGFloat) y, (CGFloat) width, (CGFloat) height); + // mac os x coordinate system has (0,0) in the lower-left + v = toNSView(c); + frame.origin.y = ([[v superview] bounds].size.height - frame.size.height) - frame.origin.y; + [v setFrame:frame]; } struct xrect containerBounds(id view) diff --git a/newctrl/window_darwin.go b/newctrl/window_darwin.go index 4758ac5..e0804be 100644 --- a/newctrl/window_darwin.go +++ b/newctrl/window_darwin.go @@ -34,6 +34,7 @@ func newWindow(title string, width int, height int, control Control) *window { C.windowSetDelegate(w.id, unsafe.Pointer(w)) C.windowSetContentView(w.id, w.container.id) w.child.setParent(w.container.parent()) + // trigger an initial resize return w } @@ -49,6 +50,9 @@ func (w *window) SetTitle(title string) { func (w *window) Show() { C.windowShow(w.id) + // trigger an initial resize + // TODO fine-tune this + windowResized(unsafe.Pointer(w)) } func (w *window) Hide() {