Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSDistributedNotificationCenter.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.NSDistributedNotificationCenter; | |
15 | |
16 import dwt.internal.cocoa.NSDictionary; | |
17 import dwt.internal.cocoa.NSInteger; | |
18 import dwt.internal.cocoa.NSNotificationCenter; | |
19 import dwt.internal.cocoa.NSString; | |
20 import dwt.internal.cocoa.OS; | |
21 import objc = dwt.internal.objc.runtime; | |
22 | |
23 public class NSDistributedNotificationCenter : NSNotificationCenter | |
24 { | |
25 | |
26 public this () | |
27 { | |
28 super(); | |
29 } | |
30 | |
31 public this (objc.id id) | |
32 { | |
33 super(id); | |
34 } | |
35 | |
36 public void addObserver_selector_name_object_ (id observer, objc.SEL aSelector, NSString aName, NSString anObject) | |
37 { | |
38 OS.objc_msgSend(this.id, OS.sel_addObserver_1selector_1name_1object_1, observer !is null ? observer.id : null, aSelector, | |
39 aName !is null ? aName.id : null, anObject !is null ? anObject.id : null); | |
40 } | |
41 | |
42 public void addObserver_selector_name_object_suspensionBehavior_ (id observer, objc.SEL selector, NSString name, NSString object, | |
43 objc.id suspensionBehavior) | |
44 { | |
45 OS.objc_msgSend(this.id, OS.sel_addObserver_1selector_1name_1object_1suspensionBehavior_1, observer !is null ? observer.id : null, selector, | |
46 name !is null ? name.id : null, object !is null ? object.id : null, suspensionBehavior); | |
47 } | |
48 | |
49 public static NSNotificationCenter defaultCenter () | |
50 { | |
51 objc.id result = OS.objc_msgSend(OS.class_NSDistributedNotificationCenter, OS.sel_defaultCenter); | |
52 return result !is null ? new NSNotificationCenter(result) : null; | |
53 } | |
54 | |
55 public static NSDistributedNotificationCenter notificationCenterForType (NSString notificationCenterType) | |
56 { | |
57 objc.id result = OS.objc_msgSend(OS.class_NSDistributedNotificationCenter, OS.sel_notificationCenterForType_1, | |
58 notificationCenterType !is null ? notificationCenterType.id : null); | |
59 return result !is null ? new NSDistributedNotificationCenter(result) : null; | |
60 } | |
61 | |
62 public void postNotificationName_object_ (NSString aName, NSString anObject) | |
63 { | |
64 OS.objc_msgSend(this.id, OS.sel_postNotificationName_1object_1, aName !is null ? aName.id : null, anObject !is null ? anObject.id : null); | |
65 } | |
66 | |
67 public void postNotificationName_object_userInfo_ (NSString aName, NSString anObject, NSDictionary aUserInfo) | |
68 { | |
69 OS.objc_msgSend(this.id, OS.sel_postNotificationName_1object_1userInfo_1, aName !is null ? aName.id : null, | |
70 anObject !is null ? anObject.id : null, aUserInfo !is null ? aUserInfo.id : null); | |
71 } | |
72 | |
73 public void postNotificationName_object_userInfo_deliverImmediately_ (NSString name, NSString object, NSDictionary userInfo, | |
74 bool deliverImmediately) | |
75 { | |
76 OS.objc_msgSend(this.id, OS.sel_postNotificationName_1object_1userInfo_1deliverImmediately_1, name !is null ? name.id : null, | |
77 object !is null ? object.id : null, userInfo !is null ? userInfo.id : null, deliverImmediately); | |
78 } | |
79 | |
80 public void postNotificationName_object_userInfo_options_ (NSString name, NSString object, NSDictionary userInfo, NSUInteger options) | |
81 { | |
82 OS.objc_msgSend(this.id, OS.sel_postNotificationName_1object_1userInfo_1options_1, name !is null ? name.id : null, | |
83 object !is null ? object.id : null, userInfo !is null ? userInfo.id : null, options); | |
84 } | |
85 | |
86 public void removeObserver (id observer, NSString aName, NSString anObject) | |
87 { | |
88 OS.objc_msgSend(this.id, OS.sel_removeObserver_1name_1object_1, observer !is null ? observer.id : null, aName !is null ? aName.id : null, | |
89 anObject !is null ? anObject.id : null); | |
90 } | |
91 | |
92 public void setSuspended (bool suspended) | |
93 { | |
94 OS.objc_msgSend(this.id, OS.sel_setSuspended_1, suspended); | |
95 } | |
96 | |
97 public bool suspended () | |
98 { | |
99 return OS.objc_msgSend(this.id, OS.sel_suspended) !is null; | |
100 } | |
101 | |
102 } |