summaryrefslogtreecommitdiff
path: root/objc_darwin.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-04-04 22:21:53 -0400
committerPietro Gagliardi <[email protected]>2014-04-04 22:21:53 -0400
commit8eee2a92b7c4e3884c3b4e0c37a6bd7e6b37d4e4 (patch)
treeeea3ea1c6d51cf1e51b820b09ba0dc4931ef35c3 /objc_darwin.go
parent8c109a0ae96bdbcabf61ea972cceb20b4dd5e2c5 (diff)
Changed the way drawRect: was being added to our Mac OS X Area such that we no longer need a separate function to add it to the class.
Diffstat (limited to 'objc_darwin.go')
-rw-r--r--objc_darwin.go18
1 files changed, 16 insertions, 2 deletions
diff --git a/objc_darwin.go b/objc_darwin.go
index b72dcdd..70406f5 100644
--- a/objc_darwin.go
+++ b/objc_darwin.go
@@ -68,6 +68,7 @@ const (
sel_void_id itype = iota
sel_bool_id
sel_bool
+ sel_void_rect
nitypes
)
@@ -75,9 +76,22 @@ var itypes = [nitypes][]C.char{
sel_void_id: []C.char{'v', '@', ':', '@', 0},
sel_bool_id: []C.char{'c', '@', ':', '@', 0},
sel_bool: []C.char{'c', '@', ':', 0},
+ sel_void_rect: nil, // see init() below
}
-func makeClass(name string, super C.id, sels []selector, desc string) (id C.id, class C.Class, err error) {
+func init() {
+ // see encodedNSRect in bleh_darwin.m
+ x := make([]C.char, 0, 256) // more than enough
+ x = append(x, 'v', '@', ':')
+ y := C.GoString(C.encodedNSRect)
+ for _, b := range y {
+ x = append(x, C.char(b))
+ }
+ x = append(x, 0)
+ itypes[sel_void_rect] = x
+}
+
+func makeClass(name string, super C.id, sels []selector, desc string) (id C.id, err error) {
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
@@ -97,5 +111,5 @@ func makeClass(name string, super C.id, sels []selector, desc string) (id C.id,
return
}
}
- return objc_getClass(name), c, nil
+ return objc_getClass(name), nil
}