Mercurial > projects > dstep
view dstep/foundation/NSTimer.d @ 14:89f3c3ef1fd2
Added the Foundation framework
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 15:23:15 +0200 |
parents | |
children | 7ff919f595d5 |
line wrap: on
line source
/** * Copyright: Copyright (c) 2009 Jacob Carlborg. * Authors: Jacob Carlborg * Version: Initial created: Aug 3, 2009 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) */ module dstep.foundation.NSTimer; import dstep.foundation.NSDate; import dstep.foundation.NSObject; import dstep.objc.bridge.Bridge; import dstep.objc.objc : id; class NSTimer : NSObject { mixin ObjcWrap; static NSTimer timerWithTimeInterval (double ti, NSInvocation invocation, bool yesOrNo) { return invokeObjcSelfClass!(NSTimer, "timerWithTimeInterval:invocation:repeats:", double, NSInvocation, bool)(ti, invocation, yesOrNoreturn result is this.objcObject ? this : (result !is null ? new NSTimer(result) : null); } static NSTimer scheduledTimerWithTimeInterval (double ti, NSInvocation invocation, bool yesOrNo) { return invokeObjcSelfClass!(NSTimer, "scheduledTimerWithTimeInterval:invocation:repeats:", double, NSInvocation, bool)(ti, invocation, yesOrNoreturn result is this.objcObject ? this : (result !is null ? new NSTimer(result) : null); } static NSTimer timerWithTimeInterval (double ti, Object aTarget, SEL aSelector, Object userInfo, bool yesOrNo) { 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); } static NSTimer scheduledTimerWithTimeInterval (double ti, Object aTarget, SEL aSelector, Object userInfo, bool yesOrNo) { 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); } Object initWithFireDate (NSDate date, double ti, Object t, SEL s, Object ui, bool rep) { return invokeObjcSelf!(Object, "initWithFireDate:interval:target:selector:userInfo:repeats:", NSDate, double, Object, SEL, Object, bool)(date, ti, t, s, ui, rep); } this (NSDate date, double ti, Object t, SEL s, Object ui, bool rep) { objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); id result = Bridge.invokeObjcMethod!(id, "initWithFireDate:interval:target:selector:userInfo:repeats:", NSDate, double, Object, SEL, Object, bool)(objcObject, date, ti, t, s, ui, rep); if (result) objcObject = ret; dObject = this; } void fire () { return invokeObjcSelf!(void, "fire"); } NSDate fireDate () { return invokeObjcSelf!(NSDate, "fireDate"); } void setFireDate (NSDate date) { return invokeObjcSelf!(void, "setFireDate:", NSDate)(date); } double timeInterval () { return invokeObjcSelf!(double, "timeInterval"); } void invalidate () { return invokeObjcSelf!(void, "invalidate"); } bool isValid () { return invokeObjcSelf!(bool, "isValid"); } Object userInfo () { return invokeObjcSelf!(Object, "userInfo"); } }