aboutsummaryrefslogtreecommitdiff
path: root/core/sys/darwin/Foundation/NSNotification.odin
blob: f2f4e819b09d585542427153aa7583f4e3183491 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package objc_Foundation

@(objc_class="NSNotification")
Notification :: struct{using _: Object}


@(objc_type=Notification, objc_name="alloc", objc_is_class_method=true)
Notification_alloc :: proc "c" () -> ^Notification {
	return msgSend(^Notification, Notification, "alloc")
}

@(objc_type=Notification, objc_name="init")
Notification_init :: proc "c" (self: ^Notification) -> ^Notification {
	return msgSend(^Notification, self, "init")
}

@(objc_type=Notification, objc_name="name")
Notification_name :: proc "c" (self: ^Notification) -> ^String {
	return msgSend(^String, self, "name")
}

@(objc_type=Notification, objc_name="object")
Notification_object :: proc "c" (self: ^Notification) -> ^Object {
	return msgSend(^Object, self, "object")
}

@(objc_type=Notification, objc_name="userInfo")
Notification_userInfo :: proc "c" (self: ^Notification) -> ^Dictionary {
	return msgSend(^Dictionary, self, "userInfo")
}

NotificationName :: ^String

@(objc_class="NSNotificationCenter")
NotificationCenter :: struct{using _: Object}


@(objc_type=NotificationCenter, objc_name="alloc", objc_is_class_method=true)
NotificationCenter_alloc :: proc "c" () -> ^NotificationCenter {
	return msgSend(^NotificationCenter, NotificationCenter, "alloc")
}

@(objc_type=NotificationCenter, objc_name="init")
NotificationCenter_init :: proc "c" (self: ^NotificationCenter) -> ^NotificationCenter {
	return msgSend(^NotificationCenter, self, "init")
}

@(objc_type=NotificationCenter, objc_name="defaultCenter", objc_is_class_method=true)
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_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)
}