diff dwt/internal/cocoa/NSAnimation.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/NSAnimation.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * 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.NSAnimation;
+
+import dwt.internal.cocoa.NSArray;
+import dwt.internal.cocoa.NSDate : NSTimeInterval;
+import dwt.internal.cocoa.NSInteger;
+import dwt.internal.cocoa.NSObject;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+alias float NSAnimationProgress;
+alias NSUInteger NSAnimationCurve;
+alias NSUInteger NSAnimationBlockingMode;
+
+public class NSAnimation : NSObject
+{
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public void addProgressMark (NSAnimationProgress progressMark)
+    {
+        OS.objc_msgSend(this.id, OS.sel_addProgressMark_1, progressMark);
+    }
+
+    public objc.id animationBlockingMode ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_animationBlockingMode);
+    }
+
+    public objc.id animationCurve ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_animationCurve);
+    }
+
+    public void clearStartAnimation ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_clearStartAnimation);
+    }
+
+    public void clearStopAnimation ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_clearStopAnimation);
+    }
+
+    public NSAnimationProgress currentProgress ()
+    {
+        return cast(NSAnimationProgress) OS.objc_msgSend_fpret(this.id, OS.sel_currentProgress);
+    }
+
+    public float currentValue ()
+    {
+        return cast(float) OS.objc_msgSend_fpret(this.id, OS.sel_currentValue);
+    }
+
+    public id delegatee ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate);
+        return result !is null ? new id(result) : null;
+    }
+
+    public double duration ()
+    {
+        return OS.objc_msgSend_fpret(this.id, OS.sel_duration);
+    }
+
+    public float frameRate ()
+    {
+        return cast(float) OS.objc_msgSend_fpret(this.id, OS.sel_frameRate);
+    }
+
+    public NSAnimation initWithDuration (NSTimeInterval duration, NSAnimationCurve animationCurve)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithDuration_1animationCurve_1, duration, animationCurve);
+        return result !is null ? this : null;
+    }
+
+    public bool isAnimating ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_isAnimating) !is null;
+    }
+
+    public NSArray progressMarks ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_progressMarks);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public void removeProgressMark (NSAnimationProgress progressMark)
+    {
+        OS.objc_msgSend(this.id, OS.sel_removeProgressMark_1, progressMark);
+    }
+
+    public NSArray runLoopModesForAnimating ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_runLoopModesForAnimating);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public void setAnimationBlockingMode (NSAnimationBlockingMode animationBlockingMode)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setAnimationBlockingMode_1, animationBlockingMode);
+    }
+
+    public void setAnimationCurve (NSAnimationCurve curve)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setAnimationCurve_1, curve);
+    }
+
+    public void setCurrentProgress (NSAnimationProgress progress)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setCurrentProgress_1, progress);
+    }
+
+    public void setDelegate (id delegatee)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setDelegate_1, delegatee !is null ? delegatee.id : null);
+    }
+
+    public void setDuration (double duration)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setDuration_1, duration);
+    }
+
+    public void setFrameRate (float framesPerSecond)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setFrameRate_1, framesPerSecond);
+    }
+
+    public void setProgressMarks (NSArray progressMarks)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setProgressMarks_1, progressMarks !is null ? progressMarks.id : null);
+    }
+
+    public void startAnimation ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_startAnimation);
+    }
+
+    public void startWhenAnimation (NSAnimation animation, NSAnimationProgress startProgress)
+    {
+        OS.objc_msgSend(this.id, OS.sel_startWhenAnimation_1reachesProgress_1, animation !is null ? animation.id : null, startProgress);
+    }
+
+    public void stopAnimation ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_stopAnimation);
+    }
+
+    public void stopWhenAnimation (NSAnimation animation, NSAnimationProgress stopProgress)
+    {
+        OS.objc_msgSend(this.id, OS.sel_stopWhenAnimation_1reachesProgress_1, animation !is null ? animation.id : null, stopProgress);
+    }
+
+}