diff 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
line wrap: on
line diff
--- a/dstep/foundation/NSDistributedNotificationCenter.d	Mon Aug 03 15:31:48 2009 +0200
+++ b/dstep/foundation/NSDistributedNotificationCenter.d	Sun Jan 03 22:06:11 2010 +0100
@@ -8,15 +8,26 @@
 
 import dstep.foundation.NSDictionary;
 import dstep.foundation.NSNotification;
+import dstep.foundation.NSObjCRuntime;
 import dstep.foundation.NSString;
 import dstep.objc.bridge.Bridge;
-import dstep.objc.objc : id;
+import dstep.objc.objc;
+
+
 
 import bindings = dstep.foundation.NSDistributedNotificationCenter_bindings;
 
 alias NSUInteger NSNotificationSuspensionBehavior;
 
-const NSString NSLocalNotificationCenterType;
+private NSString NSLocalNotificationCenterType_;
+
+NSString NSLocalNotificationCenterType ()
+{
+	if (NSLocalNotificationCenterType_)
+		return NSLocalNotificationCenterType_;
+	
+	return NSLocalNotificationCenterType_ = new NSString(bindings.NSLocalNotificationCenterType);
+}
 
 enum
 {
@@ -32,23 +43,28 @@
 	NSNotificationPostToAllSessions = (1 << 1)
 }
 
-static this ()
-{
-	NSLocalNotificationCenterType = new NSString(bindings.NSLocalNotificationCenterType);
-}
-
 class NSDistributedNotificationCenter : NSNotificationCenter
 {
-	mixin ObjcWrap;
+	mixin (ObjcWrap);
+	
+	this ()
+	{
+		super(typeof(this).alloc.init.objcObject);
+	}
+	
+	typeof(this) init ()
+	{
+		return invokeObjcSelf!(typeof(this), "init");
+	}
 
 	static NSDistributedNotificationCenter notificationCenterForType (NSString notificationCenterType)
 	{
-		return invokeObjcSelfClass!(NSDistributedNotificationCenter, "notificationCenterForType:", NSString)(notificationCenterType);
+		return invokeObjcSuperClass!(NSDistributedNotificationCenter, "notificationCenterForType:", NSString)(notificationCenterType);
 	}
 
 	static Object defaultCenter ()
 	{
-		return invokeObjcSelfClass!(Object, "defaultCenter");
+		return invokeObjcSuperClass!(Object, "defaultCenter");
 	}
 
 	void addObserver (Object observer, SEL selector, NSString name, NSString object, uint suspensionBehavior)