andlabs-ui/prev/dialog_darwin.go

26 lines
403 B
Go
Raw Normal View History

2014-08-19 11:44:42 -05:00
// 19 august 2014
package ui
import (
"unsafe"
)
// #include "objc_darwin.h"
import "C"
func (w *window) openFile(f func(filename string)) {
C.openFile(w.id, unsafe.Pointer(&f))
}
//export finishOpenFile
func finishOpenFile(fname *C.char, data unsafe.Pointer) {
f := (*func(string))(data)
2014-08-19 11:44:42 -05:00
if fname == nil {
(*f)("")
return
2014-08-19 11:44:42 -05:00
}
defer C.free(unsafe.Pointer(fname))
(*f)(C.GoString(fname))
2014-08-19 11:44:42 -05:00
}