comparison dwt/internal/cocoa/NSNotificationQueue.d @ 0:380af2bdd8e5

Upload of whole dwt tree
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sat, 09 Aug 2008 17:00:02 +0200
parents
children 8b48be5454ce
comparison
equal deleted inserted replaced
-1:000000000000 0:380af2bdd8e5
1 /*******************************************************************************
2 * Copyright (c) 2007 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *
11 * Port to the D Programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com>
13 *******************************************************************************/
14 module dwt.internal.cocoa.NSNotificationQueue;
15
16 import dwt.internal.cocoa.id;
17 import dwt.internal.cocoa.NSArray;
18 import dwt.internal.cocoa.NSInteger;
19 import dwt.internal.cocoa.NSNotification;
20 import dwt.internal.cocoa.NSNotificationCenter;
21 import dwt.internal.cocoa.NSObject;
22 import dwt.internal.cocoa.OS;
23 import objc = dwt.internal.objc.runtime;
24
25 enum NSPostingStyle
26 {
27 NSPostWhenIdle = 1,
28 NSPostASAP = 2,
29 NSPostNow = 3
30 }
31
32 alias NSPostingStyle.NSPostWhenIdle NSPostWhenIdle;
33 alias NSPostingStyle.NSPostASAP NSPostASAP;
34 alias NSPostingStyle.NSPostNow NSPostNow;
35
36 public class NSNotificationQueue : NSObject
37 {
38
39 public this ()
40 {
41 super();
42 }
43
44 public this (objc.id id)
45 {
46 super(id);
47 }
48
49 public static id defaultQueue ()
50 {
51 objc.id result = OS.objc_msgSend(OS.class_NSNotificationQueue, OS.sel_defaultQueue);
52 return result !is null ? new id(result) : null;
53 }
54
55 public void dequeueNotificationsMatching (NSNotification notification, NSUInteger coalesceMask)
56 {
57 OS.objc_msgSend(this.id, OS.sel_dequeueNotificationsMatching_1coalesceMask_1, notification !is null ? notification.id : null, coalesceMask);
58 }
59
60 public void enqueueNotification_postingStyle_ (NSNotification notification, NSPostingStyle postingStyle)
61 {
62 OS.objc_msgSend(this.id, OS.sel_enqueueNotification_1postingStyle_1, notification !is null ? notification.id : null, postingStyle);
63 }
64
65 public void enqueueNotification_postingStyle_coalesceMask_forModes_ (NSNotification notification, NSPostingStyle postingStyle, NSUInteger coalesceMask,
66 NSArray modes)
67 {
68 OS.objc_msgSend(this.id, OS.sel_enqueueNotification_1postingStyle_1coalesceMask_1forModes_1, notification !is null ? notification.id : null,
69 postingStyle, coalesceMask, modes !is null ? modes.id : null);
70 }
71
72 public id initWithNotificationCenter (NSNotificationCenter notificationCenter)
73 {
74 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithNotificationCenter_1, notificationCenter !is null ? notificationCenter.id : null);
75 return result !is null ? new id(result) : null;
76 }
77
78 }