diff options
| author | Pietro Gagliardi <[email protected]> | 2014-04-04 21:32:10 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-04-04 21:32:10 -0400 |
| commit | 7ea493873cb2be2eac1e6bb08c66a119e489b38e (patch) | |
| tree | 1a4dc504e7d699374c3e17752b0c3abb46629669 /delegate_darwin.go | |
| parent | dd20d56f257b001fe58783e86c113c11de58ca53 (diff) | |
Changed the Area class on Mac OS X to use the new class creation code. This gets rid of ALL the class creation code from delegate_darwin.go.
Diffstat (limited to 'delegate_darwin.go')
| -rw-r--r-- | delegate_darwin.go | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/delegate_darwin.go b/delegate_darwin.go index 460e930..87cf4d8 100644 --- a/delegate_darwin.go +++ b/delegate_darwin.go @@ -3,8 +3,7 @@ package ui import ( - "fmt" - "unsafe" + // ... ) /* @@ -49,12 +48,12 @@ var appDelegateSels = []selector{ } func mkAppDelegate() error { - err := makeClass(_goAppDelegate, _NSObject, appDelegateSels, + id, _, err := makeClass(_goAppDelegate, _NSObject, appDelegateSels, "application delegate (handles events)") if err != nil { return err } - appDelegate = C.objc_msgSend_noargs(objc_getClass(_goAppDelegate), _new) + appDelegate = C.objc_msgSend_noargs(id, _new) return nil } @@ -95,20 +94,3 @@ func appDelegate_buttonClicked(self C.id, sel C.SEL, button C.id) { sysData := getSysData(button) sysData.signal() } - -// this actually constructs the delegate class - -var ( - delegate_void = []C.char{'v', '@', ':', '@', 0} // void (*)(id, SEL, id) - delegate_bool = []C.char{'c', '@', ':', '@', 0} // BOOL (*)(id, SEL, id) -) - -// according to errors spit out by cgo, C function pointers are unsafe.Pointer -func addDelegateMethod(class C.Class, sel C.SEL, imp unsafe.Pointer, ty []C.char) error { - ok := C.class_addMethod(class, sel, C.IMP(imp), &ty[0]) - if ok == C.BOOL(C.NO) { - // TODO get function name - return fmt.Errorf("unable to add selector %v/imp %v to class %v (reason unknown)", sel, imp, class) - } - return nil -} |
