comparison dstep/foundation/NSTimer.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.NSTimer; 7 module dstep.foundation.NSTimer;
8 8
9 import dstep.foundation.NSDate; 9 import dstep.foundation.NSDate;
10 import dstep.foundation.NSInvocation;
10 import dstep.foundation.NSObject; 11 import dstep.foundation.NSObject;
11 import dstep.objc.bridge.Bridge; 12 import dstep.objc.bridge.Bridge;
12 import dstep.objc.objc : id; 13 import dstep.objc.objc;
13 14
14 class NSTimer : NSObject 15 class NSTimer : NSObject
15 { 16 {
16 mixin ObjcWrap; 17 mixin (ObjcWrap);
18
19 this ()
20 {
21 super(typeof(this).alloc.init.objcObject);
22 }
23
24 typeof(this) init ()
25 {
26 return invokeObjcSelf!(typeof(this), "init");
27 }
17 28
18 static NSTimer timerWithTimeInterval (double ti, NSInvocation invocation, bool yesOrNo) 29 static NSTimer timerWithTimeInterval (double ti, NSInvocation invocation, bool yesOrNo)
19 { 30 {
20 return invokeObjcSelfClass!(NSTimer, "timerWithTimeInterval:invocation:repeats:", double, NSInvocation, bool)(ti, invocation, yesOrNo); 31 return invokeObjcSuperClass!(NSTimer, "timerWithTimeInterval:invocation:repeats:", double, NSInvocation, bool)(ti, invocation, yesOrNo);
21 } 32 }
22 33
23 static NSTimer scheduledTimerWithTimeInterval (double ti, NSInvocation invocation, bool yesOrNo) 34 static NSTimer scheduledTimerWithTimeInterval (double ti, NSInvocation invocation, bool yesOrNo)
24 { 35 {
25 return invokeObjcSelfClass!(NSTimer, "scheduledTimerWithTimeInterval:invocation:repeats:", double, NSInvocation, bool)(ti, invocation, yesOrNo); 36 return invokeObjcSuperClass!(NSTimer, "scheduledTimerWithTimeInterval:invocation:repeats:", double, NSInvocation, bool)(ti, invocation, yesOrNo);
26 } 37 }
27 38
28 static NSTimer timerWithTimeInterval (double ti, Object aTarget, SEL aSelector, Object userInfo, bool yesOrNo) 39 static NSTimer timerWithTimeInterval (double ti, Object aTarget, SEL aSelector, Object userInfo, bool yesOrNo)
29 { 40 {
30 return invokeObjcSelfClass!(NSTimer, "timerWithTimeInterval:target:selector:userInfo:repeats:", double, Object, SEL, Object, bool)(ti, aTarget, aSelector, userInfo, yesOrNo); 41 return invokeObjcSuperClass!(NSTimer, "timerWithTimeInterval:target:selector:userInfo:repeats:", double, Object, SEL, Object, bool)(ti, aTarget, aSelector, userInfo, yesOrNo);
31 } 42 }
32 43
33 static NSTimer scheduledTimerWithTimeInterval (double ti, Object aTarget, SEL aSelector, Object userInfo, bool yesOrNo) 44 static NSTimer scheduledTimerWithTimeInterval (double ti, Object aTarget, SEL aSelector, Object userInfo, bool yesOrNo)
34 { 45 {
35 return invokeObjcSelfClass!(NSTimer, "scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:", double, Object, SEL, Object, bool)(ti, aTarget, aSelector, userInfo, yesOrNo); 46 return invokeObjcSuperClass!(NSTimer, "scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:", double, Object, SEL, Object, bool)(ti, aTarget, aSelector, userInfo, yesOrNo);
36 } 47 }
37 48
38 Object initWithFireDate (NSDate date, double ti, Object t, SEL s, Object ui, bool rep) 49 Object initWithFireDate (NSDate date, double ti, Object t, SEL s, Object ui, bool rep)
39 { 50 {
40 return invokeObjcSelf!(Object, "initWithFireDate:interval:target:selector:userInfo:repeats:", NSDate, double, Object, SEL, Object, bool)(date, ti, t, s, ui, rep); 51 return invokeObjcSelf!(Object, "initWithFireDate:interval:target:selector:userInfo:repeats:", NSDate, double, Object, SEL, Object, bool)(date, ti, t, s, ui, rep);
41 } 52 }
42 53
43 this (NSDate date, double ti, Object t, SEL s, Object ui, bool rep) 54 this (NSDate date, double ti, Object t, SEL s, Object ui, bool rep)
44 { 55 {
45 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); 56 typeof(this).alloc.initWithFireDate(date, ti, t, s, ui, rep);
46 id result = Bridge.invokeObjcMethod!(id, "initWithFireDate:interval:target:selector:userInfo:repeats:", NSDate, double, Object, SEL, Object, bool)(objcObject, date, ti, t, s, ui, rep);
47
48 if (result)
49 objcObject = ret;
50
51 dObject = this;
52 } 57 }
53 58
54 void fire () 59 void fire ()
55 { 60 {
56 return invokeObjcSelf!(void, "fire"); 61 return invokeObjcSelf!(void, "fire");