Mercurial > projects > dstep
annotate dstep/foundation/NSDistributedNotificationCenter.d @ 15:7ff919f595d5
Added the Foundation framework, again
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 15:31:48 +0200 |
parents | 89f3c3ef1fd2 |
children | 19885b43130e |
rev | line source |
---|---|
14 | 1 /** |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Aug 3, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.foundation.NSDistributedNotificationCenter; | |
8 | |
9 import dstep.foundation.NSDictionary; | |
10 import dstep.foundation.NSNotification; | |
11 import dstep.foundation.NSString; | |
12 import dstep.objc.bridge.Bridge; | |
13 import dstep.objc.objc : id; | |
14 | |
15 import bindings = dstep.foundation.NSDistributedNotificationCenter_bindings; | |
16 | |
17 alias NSUInteger NSNotificationSuspensionBehavior; | |
18 | |
19 const NSString NSLocalNotificationCenterType; | |
20 | |
21 enum | |
22 { | |
23 NSNotificationSuspensionBehaviorDrop = 1, | |
24 NSNotificationSuspensionBehaviorCoalesce = 2, | |
25 NSNotificationSuspensionBehaviorHold = 3, | |
26 NSNotificationSuspensionBehaviorDeliverImmediately = 4 | |
27 } | |
28 | |
29 enum | |
30 { | |
31 NSNotificationDeliverImmediately = (1 << 0), | |
32 NSNotificationPostToAllSessions = (1 << 1) | |
33 } | |
34 | |
35 static this () | |
36 { | |
37 NSLocalNotificationCenterType = new NSString(bindings.NSLocalNotificationCenterType); | |
38 } | |
39 | |
40 class NSDistributedNotificationCenter : NSNotificationCenter | |
41 { | |
42 mixin ObjcWrap; | |
43 | |
44 static NSDistributedNotificationCenter notificationCenterForType (NSString notificationCenterType) | |
45 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
46 return invokeObjcSelfClass!(NSDistributedNotificationCenter, "notificationCenterForType:", NSString)(notificationCenterType); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
47 } |
14 | 48 |
49 static Object defaultCenter () | |
50 { | |
51 return invokeObjcSelfClass!(Object, "defaultCenter"); | |
52 } | |
53 | |
54 void addObserver (Object observer, SEL selector, NSString name, NSString object, uint suspensionBehavior) | |
55 { | |
56 return invokeObjcSelf!(void, "addObserver:selector:name:object:suspensionBehavior:", Object, SEL, NSString, NSString, uint)(observer, selector, name, object, suspensionBehavior); | |
57 } | |
58 | |
59 void postNotificationName (NSString name, NSString object, NSDictionary userInfo, bool deliverImmediately) | |
60 { | |
61 return invokeObjcSelf!(void, "postNotificationName:object:userInfo:deliverImmediately:", NSString, NSString, NSDictionary, bool)(name, object, userInfo, deliverImmediately); | |
62 } | |
63 | |
64 void postNotificationName (NSString name, NSString object, NSDictionary userInfo, NSUInteger options) | |
65 { | |
66 return invokeObjcSelf!(void, "postNotificationName:object:userInfo:options:", NSString, NSString, NSDictionary, NSUInteger)(name, object, userInfo, options); | |
67 } | |
68 | |
69 void setSuspended (bool suspended) | |
70 { | |
71 return invokeObjcSelf!(void, "setSuspended:", bool)(suspended); | |
72 } | |
73 | |
74 bool suspended () | |
75 { | |
76 return invokeObjcSelf!(bool, "suspended"); | |
77 } | |
78 | |
79 void addObserver (Object observer, SEL aSelector, NSString aName, NSString anObject) | |
80 { | |
81 return invokeObjcSelf!(void, "addObserver:selector:name:object:", Object, SEL, NSString, NSString)(observer, aSelector, aName, anObject); | |
82 } | |
83 | |
84 void postNotificationName (NSString aName, NSString anObject) | |
85 { | |
86 return invokeObjcSelf!(void, "postNotificationName:object:", NSString, NSString)(aName, anObject); | |
87 } | |
88 | |
89 void postNotificationName (NSString aName, NSString anObject, NSDictionary aUserInfo) | |
90 { | |
91 return invokeObjcSelf!(void, "postNotificationName:object:userInfo:", NSString, NSString, NSDictionary)(aName, anObject, aUserInfo); | |
92 } | |
93 | |
94 void removeObserver (Object observer, NSString aName, NSString anObject) | |
95 { | |
96 return invokeObjcSelf!(void, "removeObserver:name:object:", Object, NSString, NSString)(observer, aName, anObject); | |
97 } | |
98 } | |
99 |