Added _setDelegate to the common Objective-C selectors list and added a clarity wrapper function objc_setDelegate().

This commit is contained in:
Pietro Gagliardi 2014-03-01 04:28:47 -05:00
parent 5abea5cc61
commit d611722ac7
2 changed files with 6 additions and 1 deletions

View File

@ -34,6 +34,7 @@ var (
_release = sel_getUid("release")
_stringWithUTF8String = sel_getUid("stringWithUTF8String:")
_UTF8String = sel_getUid("UTF8String")
_setDelegate = sel_getUid("setDelegate:")
)
// some helper functions
@ -64,6 +65,10 @@ func fromNSString(str C.id) string {
return C.GoString((*C.char)(unsafe.Pointer(cstr)))
}
func objc_setDelegate(obj C.id, delegate C.id) {
C.objc_msgSend_id(obj, _setDelegate, delegate)
}
/*
These are wrapper functions for the functions in bleh_darwin.m to wrap around stdint.h type casting.
*/

View File

@ -97,7 +97,7 @@ func mainThread() {
return
}
appDelegate := objc_new(objc_getClass(_goAppDelegate))
C.objc_msgSend_id(_NSApp, _setDelegate, appDelegate)
objc_setDelegate(_NSApp, appDelegate)
// and that's it, really
C.objc_msgSend_noargs(_NSApp, _run)
}