14
|
1 /**
|
|
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
|
|
3 * Authors: Jacob Carlborg
|
|
4 * Version: Initial created: Aug 3, 2009
|
|
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
|
|
6 */
|
|
7 module dstep.foundation.NSTimer;
|
|
8
|
|
9 import dstep.foundation.NSDate;
|
|
10 import dstep.foundation.NSObject;
|
|
11 import dstep.objc.bridge.Bridge;
|
|
12 import dstep.objc.objc : id;
|
|
13
|
|
14 class NSTimer : NSObject
|
|
15 {
|
|
16 mixin ObjcWrap;
|
|
17
|
|
18 static NSTimer timerWithTimeInterval (double ti, NSInvocation invocation, bool yesOrNo)
|
|
19 {
|
|
20 return invokeObjcSelfClass!(NSTimer, "timerWithTimeInterval:invocation:repeats:", double, NSInvocation, bool)(ti, invocation, yesOrNoreturn result is this.objcObject ? this : (result !is null ? new NSTimer(result) : null); }
|
|
21
|
|
22 static NSTimer scheduledTimerWithTimeInterval (double ti, NSInvocation invocation, bool yesOrNo)
|
|
23 {
|
|
24 return invokeObjcSelfClass!(NSTimer, "scheduledTimerWithTimeInterval:invocation:repeats:", double, NSInvocation, bool)(ti, invocation, yesOrNoreturn result is this.objcObject ? this : (result !is null ? new NSTimer(result) : null); }
|
|
25
|
|
26 static NSTimer timerWithTimeInterval (double ti, Object aTarget, SEL aSelector, Object userInfo, bool yesOrNo)
|
|
27 {
|
|
28 return invokeObjcSelfClass!(NSTimer, "timerWithTimeInterval:target:selector:userInfo:repeats:", double, Object, SEL, Object, bool)(ti, aTarget, aSelector, userInfo, yesOrNoreturn result is this.objcObject ? this : (result !is null ? new NSTimer(result) : null); }
|
|
29
|
|
30 static NSTimer scheduledTimerWithTimeInterval (double ti, Object aTarget, SEL aSelector, Object userInfo, bool yesOrNo)
|
|
31 {
|
|
32 return invokeObjcSelfClass!(NSTimer, "scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:", double, Object, SEL, Object, bool)(ti, aTarget, aSelector, userInfo, yesOrNoreturn result is this.objcObject ? this : (result !is null ? new NSTimer(result) : null); }
|
|
33
|
|
34 Object initWithFireDate (NSDate date, double ti, Object t, SEL s, Object ui, bool rep)
|
|
35 {
|
|
36 return invokeObjcSelf!(Object, "initWithFireDate:interval:target:selector:userInfo:repeats:", NSDate, double, Object, SEL, Object, bool)(date, ti, t, s, ui, rep);
|
|
37 }
|
|
38
|
|
39 this (NSDate date, double ti, Object t, SEL s, Object ui, bool rep)
|
|
40 {
|
|
41 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
|
|
42 id result = Bridge.invokeObjcMethod!(id, "initWithFireDate:interval:target:selector:userInfo:repeats:", NSDate, double, Object, SEL, Object, bool)(objcObject, date, ti, t, s, ui, rep);
|
|
43
|
|
44 if (result)
|
|
45 objcObject = ret;
|
|
46
|
|
47 dObject = this;
|
|
48 }
|
|
49
|
|
50 void fire ()
|
|
51 {
|
|
52 return invokeObjcSelf!(void, "fire");
|
|
53 }
|
|
54
|
|
55 NSDate fireDate ()
|
|
56 {
|
|
57 return invokeObjcSelf!(NSDate, "fireDate");
|
|
58 }
|
|
59
|
|
60 void setFireDate (NSDate date)
|
|
61 {
|
|
62 return invokeObjcSelf!(void, "setFireDate:", NSDate)(date);
|
|
63 }
|
|
64
|
|
65 double timeInterval ()
|
|
66 {
|
|
67 return invokeObjcSelf!(double, "timeInterval");
|
|
68 }
|
|
69
|
|
70 void invalidate ()
|
|
71 {
|
|
72 return invokeObjcSelf!(void, "invalidate");
|
|
73 }
|
|
74
|
|
75 bool isValid ()
|
|
76 {
|
|
77 return invokeObjcSelf!(bool, "isValid");
|
|
78 }
|
|
79
|
|
80 Object userInfo ()
|
|
81 {
|
|
82 return invokeObjcSelf!(Object, "userInfo");
|
|
83 }
|
|
84 }
|
|
85
|