summaryrefslogtreecommitdiff
path: root/prevlib/objc_darwin.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-02 17:13:40 -0400
committerPietro Gagliardi <[email protected]>2014-07-02 17:13:40 -0400
commit5d339e656b66d00356960ae057969532d34245b4 (patch)
tree01f00932aba2a4b996603beeda788995e0f0a382 /prevlib/objc_darwin.go
parent2d7e168e6a350a0cfb52970fbf74c9e37834eaec (diff)
Moved everything out of the way pending rewrite.
Diffstat (limited to 'prevlib/objc_darwin.go')
-rw-r--r--prevlib/objc_darwin.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/prevlib/objc_darwin.go b/prevlib/objc_darwin.go
new file mode 100644
index 0000000..15027e4
--- /dev/null
+++ b/prevlib/objc_darwin.go
@@ -0,0 +1,39 @@
+// 28 february 2014
+
+package ui
+
+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))
+
+ return C.toNSString(cstr)
+}
+
+func fromNSString(str C.id) string {
+ return C.GoString(C.fromNSString(str))
+}
+
+func toBOOL(what bool) C.BOOL {
+ if what {
+ return C.YES
+ }
+ return C.NO
+}
+
+// These consolidate the NSScrollView code (used by listbox_darwin.go and area_darwin.go) into a single place.
+
+func makeScrollView(content C.id) C.id {
+ return C.makeScrollView(content)
+}
+
+func getScrollViewContent(scrollview C.id) C.id {
+ return C.scrollViewContent(scrollview)
+}