Mercurial > projects > dstep
comparison dstep/foundation/NSNotificationQueue.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 | 89f3c3ef1fd2 |
children | b9de51448c6b |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
6 */ | 6 */ |
7 module dstep.foundation.NSNotificationQueue; | 7 module dstep.foundation.NSNotificationQueue; |
8 | 8 |
9 import dstep.foundation.NSArray; | 9 import dstep.foundation.NSArray; |
10 import dstep.foundation.NSNotification; | 10 import dstep.foundation.NSNotification; |
11 import dstep.foundation.NSNotificationCenter; | 11 import dstep.foundation.NSObjCRuntime; |
12 import dstep.foundation.NSObject; | 12 import dstep.foundation.NSObject; |
13 import dstep.objc.bridge.Bridge; | 13 import dstep.objc.bridge.Bridge; |
14 import dstep.objc.objc : id; | 14 import dstep.objc.objc; |
15 | 15 |
16 alias NSUInteger NSPostingStyle; | 16 alias NSUInteger NSPostingStyle; |
17 alias NSUInteger NSNotificationCoalescing; | 17 alias NSUInteger NSNotificationCoalescing; |
18 | 18 |
19 enum | 19 enum |
30 NSNotificationCoalescingOnSender = 2 | 30 NSNotificationCoalescingOnSender = 2 |
31 } | 31 } |
32 | 32 |
33 class NSNotificationQueue : NSObject | 33 class NSNotificationQueue : NSObject |
34 { | 34 { |
35 mixin ObjcWrap; | 35 mixin (ObjcWrap); |
36 | |
37 this () | |
38 { | |
39 super(typeof(this).alloc.init.objcObject); | |
40 } | |
41 | |
42 typeof(this) init () | |
43 { | |
44 return invokeObjcSelf!(typeof(this), "init"); | |
45 } | |
36 | 46 |
37 static Object defaultQueue () | 47 static Object defaultQueue () |
38 { | 48 { |
39 return invokeObjcSelfClass!(Object, "defaultQueue"); | 49 return invokeObjcSuperClass!(Object, "defaultQueue"); |
40 } | 50 } |
41 | 51 |
42 Object initWithNotificationCenter (NSNotificationCenter notificationCenter) | 52 Object initWithNotificationCenter (NSNotificationCenter notificationCenter) |
43 { | 53 { |
44 return invokeObjcSelf!(Object, "initWithNotificationCenter:", NSNotificationCenter)(notificationCenter); | 54 return invokeObjcSelf!(Object, "initWithNotificationCenter:", NSNotificationCenter)(notificationCenter); |
45 } | 55 } |
46 | 56 |
47 this (NSNotificationCenter notificationCenter) | 57 this (NSNotificationCenter notificationCenter) |
48 { | 58 { |
49 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | 59 typeof(this).alloc.initWithNotificationCenter(notificationCenter); |
50 id result = Bridge.invokeObjcMethod!(id, "initWithNotificationCenter:", NSNotificationCenter)(objcObject, notificationCenter); | |
51 | |
52 if (result) | |
53 objcObject = ret; | |
54 | |
55 dObject = this; | |
56 } | 60 } |
57 | 61 |
58 void enqueueNotification (NSNotification notification, uint postingStyle) | 62 void enqueueNotification (NSNotification notification, uint postingStyle) |
59 { | 63 { |
60 return invokeObjcSelf!(void, "enqueueNotification:postingStyle:", NSNotification, uint)(notification, postingStyle); | 64 return invokeObjcSelf!(void, "enqueueNotification:postingStyle:", NSNotification, uint)(notification, postingStyle); |