Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSInvocation.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.NSInvocation; | |
15 | |
16 import dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSInteger; | |
18 import dwt.internal.cocoa.NSMethodSignature; | |
19 import dwt.internal.cocoa.NSObject; | |
20 import dwt.internal.cocoa.OS; | |
21 import objc = dwt.internal.objc.runtime; | |
22 | |
23 public class NSInvocation : NSObject | |
24 { | |
25 | |
26 public this () | |
27 { | |
28 super(); | |
29 } | |
30 | |
31 public this (objc.id id) | |
32 { | |
33 super(id); | |
34 } | |
35 | |
36 public bool argumentsRetained () | |
37 { | |
38 return OS.objc_msgSend(this.id, OS.sel_argumentsRetained) !is null; | |
39 } | |
40 | |
41 public void getArgument (void* argumentLocation, NSInteger idx) | |
42 { | |
43 OS.objc_msgSend(this.id, OS.sel_getArgument_1atIndex_1, argumentLocation, idx); | |
44 } | |
45 | |
46 public void getReturnValue (void* retLoc) | |
47 { | |
48 OS.objc_msgSend(this.id, OS.sel_getReturnValue_1, retLoc); | |
49 } | |
50 | |
51 public static NSInvocation invocationWithMethodSignature (NSMethodSignature sig) | |
52 { | |
53 objc.id result = OS.objc_msgSend(OS.class_NSInvocation, OS.sel_invocationWithMethodSignature_1, sig !is null ? sig.id : null); | |
54 return result !is null ? new NSInvocation(result) : null; | |
55 } | |
56 | |
57 public void invoke () | |
58 { | |
59 OS.objc_msgSend(this.id, OS.sel_invoke); | |
60 } | |
61 | |
62 public void invokeWithTarget (id target) | |
63 { | |
64 OS.objc_msgSend(this.id, OS.sel_invokeWithTarget_1, target !is null ? target.id : null); | |
65 } | |
66 | |
67 public NSMethodSignature methodSignature () | |
68 { | |
69 objc.id result = OS.objc_msgSend(this.id, OS.sel_methodSignature); | |
70 return result !is null ? new NSMethodSignature(result) : null; | |
71 } | |
72 | |
73 public void retainArguments () | |
74 { | |
75 OS.objc_msgSend(this.id, OS.sel_retainArguments); | |
76 } | |
77 | |
78 public objc.SEL selector () | |
79 { | |
80 return OS.objc_msgSend(this.id, OS.sel_selector); | |
81 } | |
82 | |
83 public void setArgument (void* argumentLocation, NSInteger idx) | |
84 { | |
85 OS.objc_msgSend(this.id, OS.sel_setArgument_1atIndex_1, argumentLocation, idx); | |
86 } | |
87 | |
88 public void setReturnValue (void* retLoc) | |
89 { | |
90 OS.objc_msgSend(this.id, OS.sel_setReturnValue_1, retLoc); | |
91 } | |
92 | |
93 public void setSelector (objc.SEL selector) | |
94 { | |
95 OS.objc_msgSend(this.id, OS.sel_setSelector_1, selector); | |
96 } | |
97 | |
98 public void setTarget (id target) | |
99 { | |
100 OS.objc_msgSend(this.id, OS.sel_setTarget_1, target !is null ? target.id : null); | |
101 } | |
102 | |
103 public id target () | |
104 { | |
105 objc.id result = OS.objc_msgSend(this.id, OS.sel_target); | |
106 return result !is null ? new id(result) : null; | |
107 } | |
108 | |
109 } |