-
Notifications
You must be signed in to change notification settings - Fork 17
/
application.m
34 lines (29 loc) · 892 Bytes
/
application.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#import "application.h"
#import "appdelegate.h"
#include "_cgo_export.h"
AppDelegate *gocoa_applicationDelegate = nil;
// InitSharedApplication calls NSApplication.sharedApplication() which initializes the
// global application instance NSApp.
void InitSharedApplication() {
static bool hasBeenInitialized = false; // false first time function is called
if (hasBeenInitialized)
return;
[NSApplication sharedApplication];
gocoa_applicationDelegate = [[AppDelegate alloc] init];
[NSApp setDelegate:gocoa_applicationDelegate];
hasBeenInitialized = true;
}
void releaseSharedApplication() {
if (gocoa_applicationDelegate != nil) {
[gocoa_applicationDelegate release];
}
}
void RunApplication() {
@autoreleasepool {
[NSApp run];
releaseSharedApplication();
}
}
void TerminateApplication() {
[NSApp terminate:nil];
}