view 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
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.NSNotificationQueue;

import dstep.foundation.NSArray;
import dstep.foundation.NSNotification;
import dstep.foundation.NSObjCRuntime;
import dstep.foundation.NSObject;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;

alias NSUInteger NSPostingStyle;
alias NSUInteger NSNotificationCoalescing;

enum
{
	NSPostWhenIdle = 1,
	NSPostASAP = 2,
	NSPostNow = 3
}

enum
{
	NSNotificationNoCoalescing = 0,
	NSNotificationCoalescingOnName = 1,
	NSNotificationCoalescingOnSender = 2
}

class NSNotificationQueue : NSObject
{
	mixin (ObjcWrap);
	
	this ()
	{
		super(typeof(this).alloc.init.objcObject);
	}
	
	typeof(this) init ()
	{
		return invokeObjcSelf!(typeof(this), "init");
	}

	static Object defaultQueue ()
	{
		return invokeObjcSuperClass!(Object, "defaultQueue");
	}

	Object initWithNotificationCenter (NSNotificationCenter notificationCenter)
	{
		return invokeObjcSelf!(Object, "initWithNotificationCenter:", NSNotificationCenter)(notificationCenter);
	}

	this (NSNotificationCenter notificationCenter)
	{
		typeof(this).alloc.initWithNotificationCenter(notificationCenter);
	}

	void enqueueNotification (NSNotification notification, uint postingStyle)
	{
		return invokeObjcSelf!(void, "enqueueNotification:postingStyle:", NSNotification, uint)(notification, postingStyle);
	}

	void enqueueNotification (NSNotification notification, uint postingStyle, NSUInteger coalesceMask, NSArray modes)
	{
		return invokeObjcSelf!(void, "enqueueNotification:postingStyle:coalesceMask:forModes:", NSNotification, uint, NSUInteger, NSArray)(notification, postingStyle, coalesceMask, modes);
	}

	void dequeueNotificationsMatching (NSNotification notification, NSUInteger coalesceMask)
	{
		return invokeObjcSelf!(void, "dequeueNotificationsMatching:coalesceMask:", NSNotification, NSUInteger)(notification, coalesceMask);
	}
}