diff options
| author | Tohei Ichikawa <ichikawa.tohei.desu@gmail.com> | 2025-09-11 09:50:31 -0400 |
|---|---|---|
| committer | Tohei Ichikawa <ichikawa.tohei.desu@gmail.com> | 2025-09-11 09:50:31 -0400 |
| commit | a454633774937b6bb7a3d9fcfec38386d3fff1eb (patch) | |
| tree | ade3656b70b4829d4aaba6d059aecd13442f3844 /core/sys/darwin | |
| parent | f7936419cd5a022d6bb2100274832df5e7f42eee (diff) | |
Fix addObserver methods and add support for new Objc_Block
Diffstat (limited to 'core/sys/darwin')
| -rw-r--r-- | core/sys/darwin/Foundation/NSNotification.odin | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/core/sys/darwin/Foundation/NSNotification.odin b/core/sys/darwin/Foundation/NSNotification.odin index f766d0cab..f2f4e819b 100644 --- a/core/sys/darwin/Foundation/NSNotification.odin +++ b/core/sys/darwin/Foundation/NSNotification.odin @@ -50,10 +50,22 @@ NotificationCenter_defaultCenter :: proc "c" () -> ^NotificationCenter { return msgSend(^NotificationCenter, NotificationCenter, "defaultCenter") } +@(objc_type=NotificationCenter, objc_name="addObserverForName") +NotificationCenter_addObserverForName :: proc{NotificationCenter_addObserverForName_old, NotificationCenter_addObserverForName_new} + +NotificationCenter_addObserverForName_old :: proc "c" (self: ^NotificationCenter, name: NotificationName, pObj: ^Object, pQueue: rawptr, block: ^Block) -> ^Object { + return msgSend(^Object, self, "addObserverForName:object:queue:usingBlock:", name, pObj, pQueue, block) +} + +NotificationCenter_addObserverForName_new :: proc "c" (self: ^NotificationCenter, name: NotificationName, pObj: ^Object, pQueue: rawptr, block: ^Objc_Block) -> ^Object { + return msgSend(^Object, self, "addObserverForName:object:queue:usingBlock:", name, pObj, pQueue, block) +} + @(objc_type=NotificationCenter, objc_name="addObserver") -NotificationCenter_addObserverName :: proc "c" (self: ^NotificationCenter, name: NotificationName, pObj: ^Object, pQueue: rawptr, block: ^Block) -> ^Object { - return msgSend(^Object, self, "addObserverName:object:queue:block:", name, pObj, pQueue, block) +NotificationCenter_addObserver :: proc "c" (self: ^NotificationCenter, observer: ^Object, selector: SEL, name: NotificationName, object: ^Object) { + msgSend(nil, self, "addObserver:selector:name:object:", observer, selector, name, object) } + @(objc_type=NotificationCenter, objc_name="removeObserver") NotificationCenter_removeObserver :: proc "c" (self: ^NotificationCenter, pObserver: ^Object) { msgSend(nil, self, "removeObserver:", pObserver) |