comparison dwt/internal/cocoa/NSNotification.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents f565d3a95c0a
children
comparison
equal deleted inserted replaced
44:ca5e494f2bbf 45:d8635bb48c7c
1 /******************************************************************************* 1 /*******************************************************************************
2 * Copyright (c) 2007 IBM Corporation and others. 2 * Copyright (c) 2000, 2008 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials 3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0 4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at 5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html 6 * http://www.eclipse.org/legal/epl-v10.html
7 * 7 *
8 * Contributors: 8 * Contributors:
9 * IBM Corporation - initial API and implementation 9 * IBM Corporation - initial API and implementation
10 * 10 *
11 * Port to the D programming language: 11 * Port to the D programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com> 12 * Jacob Carlborg <doob@me.com>
13 *******************************************************************************/ 13 *******************************************************************************/
14 module dwt.internal.cocoa.NSNotification; 14 module dwt.internal.cocoa.NSNotification;
15 15
16 import dwt.internal.cocoa.id; 16 import dwt.dwthelper.utils;
17 import cocoa = dwt.internal.cocoa.id;
17 import dwt.internal.cocoa.NSDictionary; 18 import dwt.internal.cocoa.NSDictionary;
18 import dwt.internal.cocoa.NSObject; 19 import dwt.internal.cocoa.NSObject;
19 import dwt.internal.cocoa.NSString;
20 import dwt.internal.cocoa.OS; 20 import dwt.internal.cocoa.OS;
21 import objc = dwt.internal.objc.runtime; 21 import objc = dwt.internal.objc.runtime;
22 22
23 public class NSNotification : NSObject 23 public class NSNotification : NSObject {
24 {
25 24
26 public this () 25 public this() {
27 { 26 super();
28 super(); 27 }
29 }
30 28
31 public this (objc.id id) 29 public this(objc.id id) {
32 { 30 super(id);
33 super(id); 31 }
34 }
35 32
36 public NSString name () 33 public this(cocoa.id id) {
37 { 34 super(id);
38 objc.id result = OS.objc_msgSend(this.id_, OS.sel_name); 35 }
39 return result !is null ? new NSString(result) : null;
40 }
41 36
42 public static id static_notificationWithName_object_ (NSString aName, id anObject) 37 public cocoa.id object() {
43 { 38 objc.id result = OS.objc_msgSend(this.id, OS.sel_object);
44 objc.id result = OS.objc_msgSend(OS.class_NSNotification, OS.sel_notificationWithName_1object_1, aName !is null ? aName.id_ : null, 39 return result !is null ? new cocoa.id(result) : null;
45 anObject !is null ? anObject.id_ : null); 40 }
46 return result !is null ? new id(result) : null;
47 }
48 41
49 public static id static_notificationWithName_object_userInfo_ (NSString aName, id anObject, NSDictionary aUserInfo) 42 public NSDictionary userInfo() {
50 { 43 objc.id result = OS.objc_msgSend(this.id, OS.sel_userInfo);
51 objc.id result = OS.objc_msgSend(OS.class_NSNotification, OS.sel_notificationWithName_1object_1userInfo_1, aName !is null ? aName.id_ : null, 44 return result !is null ? new NSDictionary(result) : null;
52 anObject !is null ? anObject.id_ : null, aUserInfo !is null ? aUserInfo.id_ : null); 45 }
53 return result !is null ? new id(result) : null;
54 }
55
56 public id object ()
57 {
58 objc.id result = OS.objc_msgSend(this.id_, OS.sel_object);
59 return result !is null ? new id(result) : null;
60 }
61
62 public NSDictionary userInfo ()
63 {
64 objc.id result = OS.objc_msgSend(this.id_, OS.sel_userInfo);
65 return result !is null ? new NSDictionary(result) : null;
66 }
67 46
68 } 47 }