diff dwt/internal/cocoa/NSTimer.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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/cocoa/NSTimer.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ * Port to the D Programming language:
+ *     Jacob Carlborg <jacob.carlborg@gmail.com>
+ *******************************************************************************/
+module dwt.internal.cocoa.NSTimer;
+
+import dwt.internal.cocoa.id;
+import dwt.internal.cocoa.NSDate;
+import dwt.internal.cocoa.NSInvocation;
+import dwt.internal.cocoa.NSObject;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+public class NSTimer : NSObject
+{
+
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public void fire ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_fire);
+    }
+
+    public NSDate fireDate ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_fireDate);
+        return result !is null ? new NSDate(result) : null;
+    }
+
+    public id initWithFireDate (NSDate date, NSTimeInterval ti, id t, objc.SEL s, id ui, bool rep)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithFireDate_1interval_1target_1selector_1userInfo_1repeats_1,
+                date !is null ? date.id : null, ti, t !is null ? t.id : null, s, ui !is null ? ui.id : null, rep);
+        return result !is null ? new id(result) : null;
+    }
+
+    public void invalidate ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_invalidate);
+    }
+
+    public bool isValid ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_isValid) !is null;
+    }
+
+    public static NSTimer static_scheduledTimerWithTimeInterval_invocation_repeats_ (NSTimeInterval ti, NSInvocation invocation, bool yesOrNo)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSTimer, OS.sel_scheduledTimerWithTimeInterval_1invocation_1repeats_1, ti,
+                invocation !is null ? invocation.id : null, yesOrNo);
+        return result !is null ? new NSTimer(result) : null;
+    }
+
+    public static NSTimer static_scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_ (NSTimeInterval ti, id aTarget, objc.SEL aSelector,
+            objc.id userInfo, bool yesOrNo)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSTimer, OS.sel_scheduledTimerWithTimeInterval_1target_1selector_1userInfo_1repeats_1, ti,
+                aTarget !is null ? aTarget.id : null, aSelector, userInfo, yesOrNo);
+        return result !is null ? new NSTimer(result) : null;
+    }
+
+    public void setFireDate (NSDate date)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setFireDate_1, date !is null ? date.id : null);
+    }
+
+    public NSTimeInterval timeInterval ()
+    {
+        return cast(NSTimeInterval) OS.objc_msgSend_fpret(this.id, OS.sel_timeInterval);
+    }
+
+    public static NSTimer static_timerWithTimeInterval_invocation_repeats_ (NSTimeInterval ti, NSInvocation invocation, bool yesOrNo)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSTimer, OS.sel_timerWithTimeInterval_1invocation_1repeats_1, ti,
+                invocation !is null ? invocation.id : null, yesOrNo);
+        return result !is null ? new NSTimer(result) : null;
+    }
+
+    public static NSTimer static_timerWithTimeInterval_target_selector_userInfo_repeats_ (NSTimeInterval ti, id aTarget, objc.SEL aSelector, id userInfo,
+            bool yesOrNo)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSTimer, OS.sel_timerWithTimeInterval_1target_1selector_1userInfo_1repeats_1, ti,
+                aTarget !is null ? aTarget.id : null, aSelector, userInfo !is null ? userInfo.id : null, yesOrNo);
+        return result !is null ? new NSTimer(result) : null;
+    }
+
+    public objc.id userInfo ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_userInfo);
+    }
+
+}