Mercurial > projects > dstep
view 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 source
/** * Copyright: Copyright (c) 2009 Jacob Carlborg. * Authors: Jacob Carlborg * Version: Initial created: Aug 3, 2009 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) */ module dstep.foundation.NSDistributedNotificationCenter; 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; import bindings = dstep.foundation.NSDistributedNotificationCenter_bindings; alias NSUInteger NSNotificationSuspensionBehavior; private NSString NSLocalNotificationCenterType_; NSString NSLocalNotificationCenterType () { if (NSLocalNotificationCenterType_) return NSLocalNotificationCenterType_; return NSLocalNotificationCenterType_ = new NSString(bindings.NSLocalNotificationCenterType); } enum { NSNotificationSuspensionBehaviorDrop = 1, NSNotificationSuspensionBehaviorCoalesce = 2, NSNotificationSuspensionBehaviorHold = 3, NSNotificationSuspensionBehaviorDeliverImmediately = 4 } enum { NSNotificationDeliverImmediately = (1 << 0), NSNotificationPostToAllSessions = (1 << 1) } class NSDistributedNotificationCenter : NSNotificationCenter { mixin (ObjcWrap); this () { super(typeof(this).alloc.init.objcObject); } typeof(this) init () { return invokeObjcSelf!(typeof(this), "init"); } static NSDistributedNotificationCenter notificationCenterForType (NSString notificationCenterType) { return invokeObjcSuperClass!(NSDistributedNotificationCenter, "notificationCenterForType:", NSString)(notificationCenterType); } static Object defaultCenter () { return invokeObjcSuperClass!(Object, "defaultCenter"); } void addObserver (Object observer, SEL selector, NSString name, NSString object, uint suspensionBehavior) { return invokeObjcSelf!(void, "addObserver:selector:name:object:suspensionBehavior:", Object, SEL, NSString, NSString, uint)(observer, selector, name, object, suspensionBehavior); } void postNotificationName (NSString name, NSString object, NSDictionary userInfo, bool deliverImmediately) { return invokeObjcSelf!(void, "postNotificationName:object:userInfo:deliverImmediately:", NSString, NSString, NSDictionary, bool)(name, object, userInfo, deliverImmediately); } void postNotificationName (NSString name, NSString object, NSDictionary userInfo, NSUInteger options) { return invokeObjcSelf!(void, "postNotificationName:object:userInfo:options:", NSString, NSString, NSDictionary, NSUInteger)(name, object, userInfo, options); } void setSuspended (bool suspended) { return invokeObjcSelf!(void, "setSuspended:", bool)(suspended); } bool suspended () { return invokeObjcSelf!(bool, "suspended"); } void addObserver (Object observer, SEL aSelector, NSString aName, NSString anObject) { return invokeObjcSelf!(void, "addObserver:selector:name:object:", Object, SEL, NSString, NSString)(observer, aSelector, aName, anObject); } void postNotificationName (NSString aName, NSString anObject) { return invokeObjcSelf!(void, "postNotificationName:object:", NSString, NSString)(aName, anObject); } void postNotificationName (NSString aName, NSString anObject, NSDictionary aUserInfo) { return invokeObjcSelf!(void, "postNotificationName:object:userInfo:", NSString, NSString, NSDictionary)(aName, anObject, aUserInfo); } void removeObserver (Object observer, NSString aName, NSString anObject) { return invokeObjcSelf!(void, "removeObserver:name:object:", Object, NSString, NSString)(observer, aName, anObject); } }