summaryrefslogtreecommitdiff
path: root/newctrl/window_darwin.m
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-10-18 17:03:38 -0400
committerPietro Gagliardi <[email protected]>2014-10-18 17:03:38 -0400
commitaed423a09f35e26a318bd44a6670d4222906de9a (patch)
tree01ad31d5c137859dfeae5f42094834b405971177 /newctrl/window_darwin.m
parent62048303a34f6cac733798651adb53b640e2114a (diff)
Remvoed the newctrl working directory.
Diffstat (limited to 'newctrl/window_darwin.m')
-rw-r--r--newctrl/window_darwin.m91
1 files changed, 0 insertions, 91 deletions
diff --git a/newctrl/window_darwin.m b/newctrl/window_darwin.m
deleted file mode 100644
index b156392..0000000
--- a/newctrl/window_darwin.m
+++ /dev/null
@@ -1,91 +0,0 @@
-// 8 july 2014
-
-#import "objc_darwin.h"
-#import "_cgo_export.h"
-#import <Cocoa/Cocoa.h>
-
-#define toNSWindow(x) ((NSWindow *) (x))
-#define toNSView(x) ((NSView *) (x))
-
-@interface goWindowDelegate : NSObject <NSWindowDelegate> {
-@public
- void *gowin;
-}
-@end
-
-@implementation goWindowDelegate
-
-- (BOOL)windowShouldClose:(id)win
-{
- return windowClosing(self->gowin);
-}
-
-- (void)windowDidResize:(NSNotification *)note
-{
- windowResized(self->gowin);
-}
-
-@end
-
-id newWindow(intptr_t width, intptr_t height)
-{
- NSWindow *w;
- NSTextView *tv;
-
- w = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, (CGFloat) width, (CGFloat) height)
- styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)
- backing:NSBackingStoreBuffered
- defer:YES];
- // we do not want substitutions
- // text fields, labels, etc. take their smart quotes and other autocorrect settings from their parent window, which provides a shared "field editor"
- // so we have to turn them off here
- // thanks akempgen in irc.freenode.net/#macdev
- // for some reason, this selector returns NSText but is documented to return NSTextView...
- disableAutocorrect((id) [w fieldEditor:YES forObject:nil]);
- return w;
-}
-
-void windowSetDelegate(id win, void *w)
-{
- goWindowDelegate *d;
-
- d = [goWindowDelegate new];
- d->gowin = w;
- [toNSWindow(win) setDelegate:d];
-}
-
-void windowSetContentView(id win, id view)
-{
- [toNSWindow(win) setContentView:toNSView(view)];
-}
-
-const char *windowTitle(id win)
-{
- return [[toNSWindow(win) title] UTF8String];
-}
-
-void windowSetTitle(id win, const char * title)
-{
- [toNSWindow(win) setTitle:[NSString stringWithUTF8String:title]];
-}
-
-void windowShow(id win)
-{
- [toNSWindow(win) makeKeyAndOrderFront:toNSWindow(win)];
- // no need to worry about reshowing the window initially; that's handled by our container view (container_darwin.m)
-}
-
-void windowHide(id win)
-{
- [toNSWindow(win) orderOut:toNSWindow(win)];
-}
-
-void windowClose(id win)
-{
- [toNSWindow(win) close];
-}
-
-id windowContentView(id win)
-{
- return (id) [toNSWindow(win) contentView];
-}