diff options
| author | Pietro Gagliardi <[email protected]> | 2014-10-18 17:03:07 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-10-18 17:03:07 -0400 |
| commit | 62048303a34f6cac733798651adb53b640e2114a (patch) | |
| tree | b03994dfe1d5cfbc94be65075f3345a45166bbef /container_darwin.m | |
| parent | 8c8b642adbed274133b6e9d975c7ca8786300d2c (diff) | |
Merged new container/sizing stuff.
Diffstat (limited to 'container_darwin.m')
| -rw-r--r-- | container_darwin.m | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/container_darwin.m b/container_darwin.m index 0a598c6..1dfa7cb 100644 --- a/container_darwin.m +++ b/container_darwin.m @@ -21,12 +21,6 @@ @implementation goContainerView -- (void)setFrameSize:(NSSize)s -{ - [super setFrameSize:s]; - containerResized(self->gocontainer, (intptr_t) s.width, (intptr_t) s.height); -} - @end id newContainerView(void *gocontainer) @@ -40,5 +34,25 @@ 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) +{ + NSRect b; + struct xrect r; + + b = [toNSView(view) bounds]; + r.x = (intptr_t) b.origin.x; + r.y = (intptr_t) b.origin.y; + r.width = (intptr_t) b.size.width; + r.height = (intptr_t) b.size.height; + return r; } |
