NSNotification.odin 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package objc_Foundation
  2. @(objc_class="NSNotification")
  3. Notification :: struct{using _: Object}
  4. @(objc_type=Notification, objc_name="alloc", objc_is_class_method=true)
  5. Notification_alloc :: proc "c" () -> ^Notification {
  6. return msgSend(^Notification, Notification, "alloc")
  7. }
  8. @(objc_type=Notification, objc_name="init")
  9. Notification_init :: proc "c" (self: ^Notification) -> ^Notification {
  10. return msgSend(^Notification, self, "init")
  11. }
  12. @(objc_type=Notification, objc_name="name")
  13. Notification_name :: proc "c" (self: ^Notification) -> ^String {
  14. return msgSend(^String, self, "name")
  15. }
  16. @(objc_type=Notification, objc_name="object")
  17. Notification_object :: proc "c" (self: ^Notification) -> ^Object {
  18. return msgSend(^Object, self, "object")
  19. }
  20. @(objc_type=Notification, objc_name="userInfo")
  21. Notification_userInfo :: proc "c" (self: ^Notification) -> ^Dictionary {
  22. return msgSend(^Dictionary, self, "userInfo")
  23. }
  24. NotificationName :: ^String
  25. @(objc_class="NSNotificationCenter")
  26. NotificationCenter :: struct{using _: Object}
  27. @(objc_type=NotificationCenter, objc_name="alloc", objc_is_class_method=true)
  28. NotificationCenter_alloc :: proc "c" () -> ^NotificationCenter {
  29. return msgSend(^NotificationCenter, NotificationCenter, "alloc")
  30. }
  31. @(objc_type=NotificationCenter, objc_name="init")
  32. NotificationCenter_init :: proc "c" (self: ^NotificationCenter) -> ^NotificationCenter {
  33. return msgSend(^NotificationCenter, self, "init")
  34. }
  35. @(objc_type=NotificationCenter, objc_name="defaultCenter", objc_is_class_method=true)
  36. NotificationCenter_defaultCenter :: proc "c" () -> ^NotificationCenter {
  37. return msgSend(^NotificationCenter, NotificationCenter, "defaultCenter")
  38. }
  39. @(objc_type=NotificationCenter, objc_name="addObserverForName")
  40. NotificationCenter_addObserverForName :: proc{NotificationCenter_addObserverForName_old, NotificationCenter_addObserverForName_new}
  41. NotificationCenter_addObserverForName_old :: proc "c" (self: ^NotificationCenter, name: NotificationName, pObj: ^Object, pQueue: rawptr, block: ^Block) -> ^Object {
  42. return msgSend(^Object, self, "addObserverForName:object:queue:usingBlock:", name, pObj, pQueue, block)
  43. }
  44. NotificationCenter_addObserverForName_new :: proc "c" (self: ^NotificationCenter, name: NotificationName, pObj: ^Object, pQueue: rawptr, block: ^Objc_Block) -> ^Object {
  45. return msgSend(^Object, self, "addObserverForName:object:queue:usingBlock:", name, pObj, pQueue, block)
  46. }
  47. @(objc_type=NotificationCenter, objc_name="addObserver")
  48. NotificationCenter_addObserver :: proc "c" (self: ^NotificationCenter, observer: ^Object, selector: SEL, name: NotificationName, object: ^Object) {
  49. msgSend(nil, self, "addObserver:selector:name:object:", observer, selector, name, object)
  50. }
  51. @(objc_type=NotificationCenter, objc_name="removeObserver")
  52. NotificationCenter_removeObserver :: proc "c" (self: ^NotificationCenter, pObserver: ^Object) {
  53. msgSend(nil, self, "removeObserver:", pObserver)
  54. }