Mercurial > projects > dstep
comparison dstep/foundation/NSScriptCommand.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | 7ff919f595d5 |
children | b9de51448c6b |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | 5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) |
6 */ | 6 */ |
7 module dstep.foundation.NSScriptCommand; | 7 module dstep.foundation.NSScriptCommand; |
8 | 8 |
9 import dstep.foundation.NSAppleEventDescriptor; | 9 import dstep.foundation.NSAppleEventDescriptor; |
10 import dstep.foundation.NSCoder; | |
10 import dstep.foundation.NSDictionary; | 11 import dstep.foundation.NSDictionary; |
11 import dstep.foundation.NSMutableDictionary; | |
12 import dstep.foundation.NSObject; | 12 import dstep.foundation.NSObject; |
13 import dstep.foundation.NSScriptCommandDescription; | 13 import dstep.foundation.NSScriptCommandDescription; |
14 import dstep.foundation.NSScriptObjectSpecifier; | 14 import dstep.foundation.NSScriptObjectSpecifiers; |
15 import dstep.foundation.NSString; | 15 import dstep.foundation.NSString; |
16 import dstep.objc.bridge.Bridge; | 16 import dstep.objc.bridge.Bridge; |
17 import dstep.objc.objc : id; | 17 import dstep.objc.objc; |
18 | 18 |
19 enum | 19 enum |
20 { | 20 { |
21 NSNoScriptError = 0, | 21 NSNoScriptError = 0, |
22 NSReceiverEvaluationScriptError, | 22 NSReceiverEvaluationScriptError, |
31 NSCannotCreateScriptCommandError | 31 NSCannotCreateScriptCommandError |
32 } | 32 } |
33 | 33 |
34 class NSScriptCommand : NSObject, INSCoding | 34 class NSScriptCommand : NSObject, INSCoding |
35 { | 35 { |
36 mixin ObjcWrap; | 36 mixin (ObjcWrap); |
37 | |
38 this () | |
39 { | |
40 super(typeof(this).alloc.init.objcObject); | |
41 } | |
42 | |
43 typeof(this) init () | |
44 { | |
45 return invokeObjcSelf!(typeof(this), "init"); | |
46 } | |
37 | 47 |
38 Object initWithCommandDescription (NSScriptCommandDescription commandDef) | 48 Object initWithCommandDescription (NSScriptCommandDescription commandDef) |
39 { | 49 { |
40 return invokeObjcSelf!(Object, "initWithCommandDescription:", NSScriptCommandDescription)(commandDef); | 50 return invokeObjcSelf!(Object, "initWithCommandDescription:", NSScriptCommandDescription)(commandDef); |
41 } | 51 } |
42 | 52 |
43 this (NSScriptCommandDescription commandDef) | 53 this (NSScriptCommandDescription commandDef) |
44 { | 54 { |
45 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | 55 typeof(this).alloc.initWithCommandDescription(commandDef); |
46 id result = Bridge.invokeObjcMethod!(id, "initWithCommandDescription:", NSScriptCommandDescription)(objcObject, commandDef); | |
47 | |
48 if (result) | |
49 objcObject = ret; | |
50 | |
51 dObject = this; | |
52 } | 56 } |
53 | 57 |
54 NSScriptCommandDescription commandDescription () | 58 NSScriptCommandDescription commandDescription () |
55 { | 59 { |
56 return invokeObjcSelf!(NSScriptCommandDescription, "commandDescription"); | 60 return invokeObjcSelf!(NSScriptCommandDescription, "commandDescription"); |
151 return invokeObjcSelf!(NSString, "scriptErrorString"); | 155 return invokeObjcSelf!(NSString, "scriptErrorString"); |
152 } | 156 } |
153 | 157 |
154 static NSScriptCommand currentCommand () | 158 static NSScriptCommand currentCommand () |
155 { | 159 { |
156 return invokeObjcSelfClass!(NSScriptCommand, "currentCommand"); | 160 return invokeObjcSuperClass!(NSScriptCommand, "currentCommand"); |
157 } | 161 } |
158 | 162 |
159 NSAppleEventDescriptor appleEvent () | 163 NSAppleEventDescriptor appleEvent () |
160 { | 164 { |
161 return invokeObjcSelf!(NSAppleEventDescriptor, "appleEvent"); | 165 return invokeObjcSelf!(NSAppleEventDescriptor, "appleEvent"); |
181 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); | 185 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); |
182 } | 186 } |
183 | 187 |
184 this (NSCoder aDecoder) | 188 this (NSCoder aDecoder) |
185 { | 189 { |
186 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | 190 typeof(this).alloc.initWithCoder(aDecoder); |
187 id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); | |
188 | |
189 if (result) | |
190 objcObject = ret; | |
191 | |
192 dObject = this; | |
193 } | 191 } |
194 } | 192 } |
195 | 193 |