2014-03-01 03:17:32 -06:00
|
|
|
// 28 february 2014
|
2014-03-12 20:55:45 -05:00
|
|
|
|
2014-03-01 03:42:13 -06:00
|
|
|
package ui
|
2014-03-01 03:17:32 -06:00
|
|
|
|
|
|
|
import (
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
// #include <stdlib.h>
|
|
|
|
// #include "objc_darwin.h"
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
func toNSString(str string) C.id {
|
|
|
|
cstr := C.CString(str)
|
|
|
|
defer C.free(unsafe.Pointer(cstr))
|
|
|
|
|
2014-05-15 18:55:16 -05:00
|
|
|
return C.toNSString(cstr)
|
2014-03-01 03:17:32 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func fromNSString(str C.id) string {
|
2014-05-15 18:55:16 -05:00
|
|
|
return C.GoString(C.fromNSString(str))
|
2014-03-01 03:17:32 -06:00
|
|
|
}
|
2014-04-04 20:06:01 -05:00
|
|
|
|
2014-05-16 19:29:16 -05:00
|
|
|
func toBOOL(what bool) C.BOOL {
|
|
|
|
if what {
|
|
|
|
return C.YES
|
|
|
|
}
|
|
|
|
return C.NO
|
|
|
|
}
|
|
|
|
|
2014-04-13 11:52:10 -05:00
|
|
|
// These consolidate the NSScrollView code (used by listbox_darwin.go and area_darwin.go) into a single place.
|
|
|
|
|
2014-05-16 19:44:19 -05:00
|
|
|
func makeScrollView(content C.id) C.id {
|
2014-05-15 18:55:16 -05:00
|
|
|
return C.makeScrollView(content)
|
2014-04-13 11:52:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func getScrollViewContent(scrollview C.id) C.id {
|
2014-05-15 18:55:16 -05:00
|
|
|
return C.scrollViewContent(scrollview)
|
2014-04-13 11:52:10 -05:00
|
|
|
}
|