Mercurial > projects > dwt-mac
annotate dwt/internal/cocoa/NSObject.d @ 139:86fc761a24ae
Fixes #11
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Thu, 04 Jun 2009 23:23:10 +0200 |
parents | 62202ce0039f |
children |
rev | line source |
---|---|
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
1 /******************************************************************************* |
45 | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
3 * All rights reserved. This program and the accompanying materials |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
5 * which accompanies this distribution, and is available at |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
6 * http://www.eclipse.org/legal/epl-v10.html |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
7 * |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
8 * Contributors: |
45 | 9 * IBM Corporation - initial API and implementation |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
10 * |
13
f565d3a95c0a
Ported dwt.internal
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
1
diff
changeset
|
11 * Port to the D programming language: |
45 | 12 * Jacob Carlborg <doob@me.com> |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
13 *******************************************************************************/ |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
14 module dwt.internal.cocoa.NSObject; |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
15 |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
16 import dwt.dwthelper.utils; |
45 | 17 import dwt.internal.cocoa.DOMEvent; |
18 import cocoa = dwt.internal.cocoa.id; | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
19 import dwt.internal.cocoa.NSArray; |
45 | 20 import dwt.internal.cocoa.NSImage; |
21 import dwt.internal.cocoa.NSNotification; | |
22 import dwt.internal.cocoa.NSOutlineView; | |
23 import dwt.internal.cocoa.NSPasteboard; | |
24 import dwt.internal.cocoa.NSPoint; | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
25 import dwt.internal.cocoa.NSString; |
45 | 26 import dwt.internal.cocoa.NSTableColumn; |
27 import dwt.internal.cocoa.NSTableView; | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
28 import dwt.internal.cocoa.NSURL; |
45 | 29 import dwt.internal.cocoa.NSWindow; |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
30 import dwt.internal.cocoa.OS; |
45 | 31 import dwt.internal.cocoa.Protocol; |
32 import dwt.internal.objc.cocoa.Cocoa; | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
33 import objc = dwt.internal.objc.runtime; |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
34 |
45 | 35 public class NSObject : cocoa.id { |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
36 |
45 | 37 public this() { |
38 super(); | |
39 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
40 |
45 | 41 public this(objc.id id) { |
42 super(id); | |
43 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
44 |
45 | 45 public this(cocoa.id id) { |
46 super(id); | |
47 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
48 |
45 | 49 public NSObject alloc() { |
50 this.id = OS.objc_msgSend(objc_getClass(), OS.sel_alloc); | |
51 return this; | |
52 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
53 |
45 | 54 public void applicationWillResignActive(NSNotification notification) { |
55 OS.objc_msgSend(this.id, OS.sel_applicationWillResignActive_, notification !is null ? notification.id : null); | |
56 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
57 |
45 | 58 public NSImage draggedImage() { |
59 objc.id result = OS.objc_msgSend(this.id, OS.sel_draggedImage); | |
60 return result !is null ? new NSImage(result) : null; | |
61 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
62 |
45 | 63 public NSPoint draggedImageLocation() { |
64 NSPoint result = NSPoint(); | |
60
62202ce0039f
Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
45
diff
changeset
|
65 OS.objc_msgSend_stret(&result, this.id, OS.sel_draggedImageLocation); |
45 | 66 return result; |
67 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
68 |
45 | 69 public NSWindow draggingDestinationWindow() { |
70 objc.id result = OS.objc_msgSend(this.id, OS.sel_draggingDestinationWindow); | |
71 return result !is null ? new NSWindow(result) : null; | |
72 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
73 |
45 | 74 public void draggingEnded(cocoa.id sender) { |
75 OS.objc_msgSend(this.id, OS.sel_draggingEnded_, sender !is null ? sender.id : null); | |
76 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
77 |
45 | 78 public NSDragOperation draggingEntered(cocoa.id sender) { |
60
62202ce0039f
Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
45
diff
changeset
|
79 return cast(NSDragOperation) OS.objc_msgSend(this.id, OS.sel_draggingEntered_, sender !is null ? sender.id : null); |
45 | 80 } |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
81 |
45 | 82 public void draggingExited(dwt.internal.cocoa.id.id sender) { |
83 OS.objc_msgSend(this.id, OS.sel_draggingExited_, sender !is null ? sender.id : null); | |
84 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
85 |
45 | 86 public NSPoint draggingLocation() { |
87 NSPoint result = NSPoint(); | |
60
62202ce0039f
Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
45
diff
changeset
|
88 OS.objc_msgSend_stret(&result, this.id, OS.sel_draggingLocation); |
45 | 89 return result; |
90 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
91 |
45 | 92 public NSPasteboard draggingPasteboard() { |
93 objc.id result = OS.objc_msgSend(this.id, OS.sel_draggingPasteboard); | |
94 return result !is null ? new NSPasteboard(result) : null; | |
95 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
96 |
45 | 97 public NSInteger draggingSequenceNumber() { |
98 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_draggingSequenceNumber); | |
99 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
100 |
45 | 101 public cocoa.id draggingSource() { |
102 objc.id result = OS.objc_msgSend(this.id, OS.sel_draggingSource); | |
60
62202ce0039f
Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
45
diff
changeset
|
103 return result !is null ? new cocoa.id(result) : null; |
45 | 104 } |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
105 |
45 | 106 public NSDragOperation draggingSourceOperationMask() { |
107 return cast(NSDragOperation) OS.objc_msgSend(this.id, OS.sel_draggingSourceOperationMask); | |
108 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
109 |
45 | 110 public NSArray namesOfPromisedFilesDroppedAtDestination(NSURL dropDestination) { |
111 objc.id result = OS.objc_msgSend(this.id, OS.sel_namesOfPromisedFilesDroppedAtDestination_, dropDestination !is null ? dropDestination.id : null); | |
112 return result !is null ? new NSArray(result) : null; | |
113 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
114 |
45 | 115 public void outlineView(NSOutlineView outlineView, NSTableColumn tableColumn) { |
116 OS.objc_msgSend(this.id, OS.sel_outlineView_didClickTableColumn_, outlineView !is null ? outlineView.id : null, tableColumn !is null ? tableColumn.id : null); | |
117 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
118 |
45 | 119 public void outlineViewColumnDidMove(NSNotification notification) { |
120 OS.objc_msgSend(this.id, OS.sel_outlineViewColumnDidMove_, notification !is null ? notification.id : null); | |
121 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
122 |
45 | 123 public void outlineViewColumnDidResize(NSNotification notification) { |
124 OS.objc_msgSend(this.id, OS.sel_outlineViewColumnDidResize_, notification !is null ? notification.id : null); | |
125 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
126 |
45 | 127 public void tableView(NSTableView tableView, NSTableColumn tableColumn) { |
128 OS.objc_msgSend(this.id, OS.sel_tableView_didClickTableColumn_, tableView !is null ? tableView.id : null, tableColumn !is null ? tableColumn.id : null); | |
129 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
130 |
45 | 131 public void tableViewColumnDidMove(NSNotification notification) { |
132 OS.objc_msgSend(this.id, OS.sel_tableViewColumnDidMove_, notification !is null ? notification.id : null); | |
133 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
134 |
45 | 135 public void tableViewColumnDidResize(NSNotification notification) { |
136 OS.objc_msgSend(this.id, OS.sel_tableViewColumnDidResize_, notification !is null ? notification.id : null); | |
137 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
138 |
45 | 139 public NSObject autorelease() { |
140 objc.id result = OS.objc_msgSend(this.id, OS.sel_autorelease); | |
141 return result is this.id ? this : (result !is null ? new NSObject(result) : null); | |
142 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
143 |
45 | 144 public NSString className() { |
145 objc.id result = OS.objc_msgSend(this.id, OS.sel_className); | |
146 return result !is null ? new NSString(result) : null; | |
147 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
148 |
45 | 149 public bool conformsToProtocol(Protocol aProtocol) { |
150 return OS.objc_msgSend_bool(this.id, OS.sel_conformsToProtocol_, aProtocol !is null ? aProtocol.id : null); | |
151 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
152 |
45 | 153 public cocoa.id copy() { |
154 objc.id result = OS.objc_msgSend(this.id, OS.sel_copy); | |
60
62202ce0039f
Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
45
diff
changeset
|
155 return result !is null ? new cocoa.id(result) : null; |
45 | 156 } |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
157 |
45 | 158 public NSString description() { |
159 objc.id result = OS.objc_msgSend(this.id, OS.sel_description); | |
160 return result !is null ? new NSString(result) : null; | |
161 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
162 |
45 | 163 public NSObject init() { |
164 objc.id result = OS.objc_msgSend(this.id, OS.sel_init); | |
165 return result is this.id ? this : (result !is null ? new NSObject(result) : null); | |
166 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
167 |
45 | 168 public bool isEqual(cocoa.id object) { |
169 return OS.objc_msgSend_bool(this.id, OS.sel_isEqual_, object !is null ? object.id : null); | |
170 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
171 |
45 | 172 public bool isEqualTo(cocoa.id object) { |
173 return OS.objc_msgSend_bool(this.id, OS.sel_isEqualTo_, object !is null ? object.id : null); | |
174 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
175 |
45 | 176 public bool isKindOfClass(objc.Class aClass) { |
177 return OS.objc_msgSend_bool(this.id, OS.sel_isKindOfClass_, aClass); | |
178 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
179 |
45 | 180 public void performSelectorOnMainThread(objc.SEL aSelector, cocoa.id arg, bool wait) { |
181 OS.objc_msgSend(this.id, OS.sel_performSelectorOnMainThread_withObject_waitUntilDone_, aSelector, arg !is null ? arg.id : null, wait); | |
182 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
183 |
45 | 184 public void release() { |
185 OS.objc_msgSend(this.id, OS.sel_release); | |
186 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
187 |
45 | 188 public bool respondsToSelector(objc.SEL aSelector) { |
189 return OS.objc_msgSend_bool(this.id, OS.sel_respondsToSelector_, aSelector); | |
190 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
191 |
45 | 192 public cocoa.id retain() { |
193 objc.id result = OS.objc_msgSend(this.id, OS.sel_retain); | |
60
62202ce0039f
Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
45
diff
changeset
|
194 return result !is null ? new cocoa.id(result) : null; |
45 | 195 } |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
196 |
45 | 197 public NSUInteger retainCount() { |
60
62202ce0039f
Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
45
diff
changeset
|
198 return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_retainCount); |
45 | 199 } |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
200 |
45 | 201 public objc.Class superclass() { |
202 return cast(objc.Class) OS.objc_msgSend(this.id, OS.sel_superclass); | |
203 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
204 |
45 | 205 public void addEventListener(NSString type, cocoa.id listener, bool useCapture) { |
206 OS.objc_msgSend(this.id, OS.sel_addEventListener_listener_useCapture_, type !is null ? type.id : null, listener !is null ? listener.id : null, useCapture); | |
207 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
208 |
45 | 209 public void handleEvent(DOMEvent evt) { |
210 OS.objc_msgSend(this.id, OS.sel_handleEvent_, evt !is null ? evt.id : null); | |
211 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
212 |
45 | 213 } |