Mercurial > projects > dstep
comparison dstep/foundation/NSDistributedNotificationCenter.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | 7ff919f595d5 |
children | b9de51448c6b |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
6 */ | 6 */ |
7 module dstep.foundation.NSDistributedNotificationCenter; | 7 module dstep.foundation.NSDistributedNotificationCenter; |
8 | 8 |
9 import dstep.foundation.NSDictionary; | 9 import dstep.foundation.NSDictionary; |
10 import dstep.foundation.NSNotification; | 10 import dstep.foundation.NSNotification; |
11 import dstep.foundation.NSObjCRuntime; | |
11 import dstep.foundation.NSString; | 12 import dstep.foundation.NSString; |
12 import dstep.objc.bridge.Bridge; | 13 import dstep.objc.bridge.Bridge; |
13 import dstep.objc.objc : id; | 14 import dstep.objc.objc; |
15 | |
16 | |
14 | 17 |
15 import bindings = dstep.foundation.NSDistributedNotificationCenter_bindings; | 18 import bindings = dstep.foundation.NSDistributedNotificationCenter_bindings; |
16 | 19 |
17 alias NSUInteger NSNotificationSuspensionBehavior; | 20 alias NSUInteger NSNotificationSuspensionBehavior; |
18 | 21 |
19 const NSString NSLocalNotificationCenterType; | 22 private NSString NSLocalNotificationCenterType_; |
23 | |
24 NSString NSLocalNotificationCenterType () | |
25 { | |
26 if (NSLocalNotificationCenterType_) | |
27 return NSLocalNotificationCenterType_; | |
28 | |
29 return NSLocalNotificationCenterType_ = new NSString(bindings.NSLocalNotificationCenterType); | |
30 } | |
20 | 31 |
21 enum | 32 enum |
22 { | 33 { |
23 NSNotificationSuspensionBehaviorDrop = 1, | 34 NSNotificationSuspensionBehaviorDrop = 1, |
24 NSNotificationSuspensionBehaviorCoalesce = 2, | 35 NSNotificationSuspensionBehaviorCoalesce = 2, |
30 { | 41 { |
31 NSNotificationDeliverImmediately = (1 << 0), | 42 NSNotificationDeliverImmediately = (1 << 0), |
32 NSNotificationPostToAllSessions = (1 << 1) | 43 NSNotificationPostToAllSessions = (1 << 1) |
33 } | 44 } |
34 | 45 |
35 static this () | |
36 { | |
37 NSLocalNotificationCenterType = new NSString(bindings.NSLocalNotificationCenterType); | |
38 } | |
39 | |
40 class NSDistributedNotificationCenter : NSNotificationCenter | 46 class NSDistributedNotificationCenter : NSNotificationCenter |
41 { | 47 { |
42 mixin ObjcWrap; | 48 mixin (ObjcWrap); |
49 | |
50 this () | |
51 { | |
52 super(typeof(this).alloc.init.objcObject); | |
53 } | |
54 | |
55 typeof(this) init () | |
56 { | |
57 return invokeObjcSelf!(typeof(this), "init"); | |
58 } | |
43 | 59 |
44 static NSDistributedNotificationCenter notificationCenterForType (NSString notificationCenterType) | 60 static NSDistributedNotificationCenter notificationCenterForType (NSString notificationCenterType) |
45 { | 61 { |
46 return invokeObjcSelfClass!(NSDistributedNotificationCenter, "notificationCenterForType:", NSString)(notificationCenterType); | 62 return invokeObjcSuperClass!(NSDistributedNotificationCenter, "notificationCenterForType:", NSString)(notificationCenterType); |
47 } | 63 } |
48 | 64 |
49 static Object defaultCenter () | 65 static Object defaultCenter () |
50 { | 66 { |
51 return invokeObjcSelfClass!(Object, "defaultCenter"); | 67 return invokeObjcSuperClass!(Object, "defaultCenter"); |
52 } | 68 } |
53 | 69 |
54 void addObserver (Object observer, SEL selector, NSString name, NSString object, uint suspensionBehavior) | 70 void addObserver (Object observer, SEL selector, NSString name, NSString object, uint suspensionBehavior) |
55 { | 71 { |
56 return invokeObjcSelf!(void, "addObserver:selector:name:object:suspensionBehavior:", Object, SEL, NSString, NSString, uint)(observer, selector, name, object, suspensionBehavior); | 72 return invokeObjcSelf!(void, "addObserver:selector:name:object:suspensionBehavior:", Object, SEL, NSString, NSString, uint)(observer, selector, name, object, suspensionBehavior); |