summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-10-18 17:02:51 -0400
committerPietro Gagliardi <[email protected]>2014-10-18 17:02:51 -0400
commit8c8b642adbed274133b6e9d975c7ca8786300d2c (patch)
treefa64294c47863013ee1a76d7525afeb50a0733c7
parent922407d5b6e8093d6f6239e43d50b7e20b38c748 (diff)
Fixed Mac OS X sizing and more TODOs. Ready to merge back!
-rw-r--r--future10
-rw-r--r--newctrl/container_darwin.go2
-rw-r--r--newctrl/container_darwin.m9
-rw-r--r--newctrl/window_darwin.go4
4 files changed, 21 insertions, 4 deletions
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() {