You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dws/ui/ui_darwin.go

43 lines
596 B
Go

package ui
import (
"log"
"runtime"
)
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#include "ui_darwin.h"
*/
import "C"
var desktopUI *cocoaUI
func Desktop() UI {
if desktopUI != nil {
return desktopUI
}
log.Println("Creating new cocoaUI")
runtime.LockOSThread()
C.Initialize()
desktopUI = new(cocoaUI)
return desktopUI
}
type cocoaUI struct {
out chan Event
}
func (ui *cocoaUI) Run(out chan Event) error {
ui.out = out
C.Run()
return nil
}
//export selectDirectory
func selectDirectory(path string) {
desktopUI.out <- SelectDirectoryEvent{Path: path}
}