diff dwt/internal/cocoa/NSTimer.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents 642f460a0908
children
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSTimer.d	Tue Oct 21 15:20:04 2008 +0200
+++ b/dwt/internal/cocoa/NSTimer.d	Mon Dec 01 17:07:00 2008 +0100
@@ -1,111 +1,55 @@
 /*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 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
+ *    IBM Corporation - initial API and implementation
  *     
  * Port to the D programming language:
- *     Jacob Carlborg <jacob.carlborg@gmail.com>
+ *    Jacob Carlborg <doob@me.com>
  *******************************************************************************/
 module dwt.internal.cocoa.NSTimer;
 
-import dwt.internal.cocoa.id;
+import dwt.dwthelper.utils;
+import cocoa = 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;
 
-import dwt.dwthelper.utils;
-
-public class NSTimer : NSObject
-{
-
-    public this ()
-    {
-        super();
-    }
+public class NSTimer : NSObject {
 
-    public this (objc.id id)
-    {
-        super(id);
-    }
-
-    public void fire ()
-    {
-        OS.objc_msgSend(this.id_, OS.sel_fire);
-    }
+public this() {
+    super();
+}
 
-    public NSDate fireDate ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_fireDate);
-        return result !is null ? new NSDate(result) : null;
-    }
+public this(objc.id id) {
+    super(id);
+}
 
-    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 this(cocoa.id id) {
+    super(id);
+}
 
-    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 void invalidate() {
+    OS.objc_msgSend(this.id, OS.sel_invalidate);
+}
 
-    public static NSTimer static_scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_ (NSTimeInterval ti, id aTarget, String 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.ptr, 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 static NSTimer scheduledTimerWithTimeInterval(NSTimeInterval ti, cocoa.id aTarget, objc.SEL aSelector, cocoa.id userInfo, bool yesOrNo) {
+    objc.id result = OS.objc_msgSend(OS.class_NSTimer, OS.sel_scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_, ti, aTarget !is null ? aTarget.id : null, aSelector, userInfo !is null ? userInfo.id : null, yesOrNo);
+    return result !is null ? new NSTimer(result) : 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 void setFireDate(NSDate date) {
+    OS.objc_msgSend(this.id, OS.sel_setFireDate_, date !is null ? date.id : null);
+}
 
-    public static NSTimer static_timerWithTimeInterval_target_selector_userInfo_repeats_ (NSTimeInterval ti, id aTarget, String 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.ptr, 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);
-    }
+public cocoa.id userInfo() {
+    objc.id result = OS.objc_msgSend(this.id, OS.sel_userInfo);
+    return result !is null ? new cocoa.id(result) : null;
+}
 
 }