diff options
| author | Pietro Gagliardi <[email protected]> | 2014-10-18 17:03:38 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-10-18 17:03:38 -0400 |
| commit | aed423a09f35e26a318bd44a6670d4222906de9a (patch) | |
| tree | 01ad31d5c137859dfeae5f42094834b405971177 /newctrl/container_darwin.m | |
| parent | 62048303a34f6cac733798651adb53b640e2114a (diff) | |
Remvoed the newctrl working directory.
Diffstat (limited to 'newctrl/container_darwin.m')
| -rw-r--r-- | newctrl/container_darwin.m | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/newctrl/container_darwin.m b/newctrl/container_darwin.m deleted file mode 100644 index 1dfa7cb..0000000 --- a/newctrl/container_darwin.m +++ /dev/null @@ -1,58 +0,0 @@ -// 4 august 2014 - -#include "objc_darwin.h" -#include "_cgo_export.h" -#include <Cocoa/Cocoa.h> - -#define toNSView(x) ((NSView *) (x)) - -// calling -[className] on the content views of NSWindow, NSTabItem, and NSBox all return NSView, so I'm assuming I just need to override these -// fornunately: -// - NSWindow resizing calls -[setFrameSize:] (but not -[setFrame:]) -// - NSTab resizing calls both -[setFrame:] and -[setFrameSIze:] on the current tab -// - NSTab switching tabs calls both -[setFrame:] and -[setFrameSize:] on the new tab -// so we just override setFrameSize: -// thanks to mikeash and JtRip in irc.freenode.net/#macdev -@interface goContainerView : NSView { -@public - void *gocontainer; -} -@end - -@implementation goContainerView - -@end - -id newContainerView(void *gocontainer) -{ - goContainerView *c; - - c = [[goContainerView alloc] initWithFrame:NSZeroRect]; - c->gocontainer = gocontainer; - return (id) c; -} - -void moveControl(id c, intptr_t x, intptr_t y, intptr_t width, intptr_t 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; -} |
