Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSNotificationQueue.d @ 13:f565d3a95c0a
Ported dwt.internal
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Fri, 22 Aug 2008 16:46:34 +0200 |
parents | 8b48be5454ce |
children |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * * Port to the D programming language: * Jacob Carlborg <jacob.carlborg@gmail.com> *******************************************************************************/ module dwt.internal.cocoa.NSNotificationQueue; import dwt.internal.cocoa.id; import dwt.internal.cocoa.NSArray; import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSNotification; import dwt.internal.cocoa.NSNotificationCenter; import dwt.internal.cocoa.NSObject; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; enum NSPostingStyle { NSPostWhenIdle = 1, NSPostASAP = 2, NSPostNow = 3 } alias NSPostingStyle.NSPostWhenIdle NSPostWhenIdle; alias NSPostingStyle.NSPostASAP NSPostASAP; alias NSPostingStyle.NSPostNow NSPostNow; public class NSNotificationQueue : NSObject { public this () { super(); } public this (objc.id id) { super(id); } public static id defaultQueue () { objc.id result = OS.objc_msgSend(OS.class_NSNotificationQueue, OS.sel_defaultQueue); return result !is null ? new id(result) : null; } public void dequeueNotificationsMatching (NSNotification notification, NSUInteger coalesceMask) { OS.objc_msgSend(this.id_, OS.sel_dequeueNotificationsMatching_1coalesceMask_1, notification !is null ? notification.id_ : null, coalesceMask); } public void enqueueNotification_postingStyle_ (NSNotification notification, NSPostingStyle postingStyle) { OS.objc_msgSend(this.id_, OS.sel_enqueueNotification_1postingStyle_1, notification !is null ? notification.id_ : null, postingStyle); } public void enqueueNotification_postingStyle_coalesceMask_forModes_ (NSNotification notification, NSPostingStyle postingStyle, NSUInteger coalesceMask, NSArray modes) { OS.objc_msgSend(this.id_, OS.sel_enqueueNotification_1postingStyle_1coalesceMask_1forModes_1, notification !is null ? notification.id_ : null, postingStyle, coalesceMask, modes !is null ? modes.id_ : null); } public id initWithNotificationCenter (NSNotificationCenter notificationCenter) { objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithNotificationCenter_1, notificationCenter !is null ? notificationCenter.id_ : null); return result !is null ? new id(result) : null; } }