summaryrefslogtreecommitdiff
path: root/darwintest/runtimetest.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-02-27 23:07:45 -0500
committerPietro Gagliardi <[email protected]>2014-02-27 23:07:45 -0500
commite0c351a2d7dd30c52a1067fbc5cdb6517b6eeed0 (patch)
tree289dff6dbcfb9380288b966cb569b559f0d6b1eb /darwintest/runtimetest.go
parent134afc60a64620d9f67b087c8f494b053d00efea (diff)
Added code to create new Objective-C types at runtime, which will be important both for handling custom messages and for handling events.
Diffstat (limited to 'darwintest/runtimetest.go')
-rw-r--r--darwintest/runtimetest.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/darwintest/runtimetest.go b/darwintest/runtimetest.go
index be6357f..f86398d 100644
--- a/darwintest/runtimetest.go
+++ b/darwintest/runtimetest.go
@@ -21,6 +21,7 @@ import (
// id objc_msgSend_strarg(id obj, SEL sel, char *a) { return objc_msgSend(obj, sel, a); }
// id objc_msgSend_NSRect_uint_uint_bool(id obj, SEL sel, CGRect a, NSUInteger b, NSUInteger c, BOOL d) { return objc_msgSend(obj, sel, a, b, c, d); }
// id objc_msgSend_id(id obj, SEL sel, id a) { return objc_msgSend(obj, sel, a); }
+// Class NilClass = Nil; /* for newtypes.go */
import "C"
func objc_getClass(class string) C.id {
@@ -37,6 +38,12 @@ func sel_getUid(sel string) C.SEL {
return C.sel_getUid(csel)
}
+func main() {
+ sel := sel_getUid("ourMethod")
+ C.objc_msgSend_noargs(mk("hello", sel),
+ sel)
+}
+
const (
NSBorderlessWindowMask = 0
NSTitledWindowMask = 1 << 0
@@ -54,7 +61,7 @@ const (
var alloc = sel_getUid("alloc")
-func main() {
+func wintest() {
NSWindow := objc_getClass("NSWindow")
NSWindowinit :=
sel_getUid("initWithContentRect:styleMask:backing:defer:")