-
Notifications
You must be signed in to change notification settings - Fork 17
/
application.go
36 lines (29 loc) · 923 Bytes
/
application.go
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
35
36
package gocoa
// #cgo CFLAGS: -x objective-c
// #cgo LDFLAGS: -framework Cocoa
// #include "application.h"
import "C"
var appDidFinishLaunchingFunc func()
// InitApplication initializes the global application instance. Call this before using
// the rest of the gocoa package.
func InitApplication() {
C.InitSharedApplication()
}
// RunApplication launches the main Cocoa runloop.
func RunApplication() {
C.RunApplication()
}
// OnApplicationDidFinishLaunching - will be triggered after Application Launch is finished
func OnApplicationDidFinishLaunching(fn func()) {
appDidFinishLaunchingFunc = fn
}
// TerminateApplication - will be triggered, when the Application terminates
func TerminateApplication() {
C.TerminateApplication()
}
//export callOnApplicationDidFinishLaunchingHandler
func callOnApplicationDidFinishLaunchingHandler() {
if appDidFinishLaunchingFunc != nil {
appDidFinishLaunchingFunc()
}
}