view dwt/internal/cocoa/NSAnimation.d @ 13:f565d3a95c0a

Ported dwt.internal
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Fri, 22 Aug 2008 16:46:34 +0200
parents 8b48be5454ce
children
line wrap: on
line source

/*******************************************************************************
 * 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.id;
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);
    }

}