view dwt/internal/cocoa/NSProgressIndicator.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 d8635bb48c7c
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.NSProgressIndicator;

import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSDate : NSTimeInterval;
import dwt.internal.cocoa.NSCell : NSControlTint, NSControlSize;
import dwt.internal.cocoa.NSView;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

enum NSProgressIndicatorStyle
{
    NSProgressIndicatorBarStyle = 0,
    NSProgressIndicatorSpinningStyle = 1
}

alias NSProgressIndicatorStyle.NSProgressIndicatorBarStyle NSProgressIndicatorBarStyle;
alias NSProgressIndicatorStyle.NSProgressIndicatorSpinningStyle NSProgressIndicatorSpinningStyle;

public class NSProgressIndicator : NSView
{

    public this ()
    {
        super();
    }

    public this (objc.id id)
    {
        super(id);
    }

    public void animate (id sender)
    {
        OS.objc_msgSend(this.id_, OS.sel_animate_1, sender !is null ? sender.id_ : null);
    }

    public NSTimeInterval animationDelay ()
    {
        return cast(NSTimeInterval) OS.objc_msgSend_fpret(this.id_, OS.sel_animationDelay);
    }

    public NSControlSize controlSize ()
    {
        return cast(NSControlSize) OS.objc_msgSend(this.id_, OS.sel_controlSize);
    }

    public NSControlTint controlTint ()
    {
        return cast(NSControlTint) OS.objc_msgSend(this.id_, OS.sel_controlTint);
    }

    public double doubleValue ()
    {
        return OS.objc_msgSend_fpret(this.id_, OS.sel_doubleValue);
    }

    public void incrementBy (double delta)
    {
        OS.objc_msgSend(this.id_, OS.sel_incrementBy_1, delta);
    }

    public bool isBezeled ()
    {
        return OS.objc_msgSend(this.id_, OS.sel_isBezeled) !is null;
    }

    public bool isDisplayedWhenStopped ()
    {
        return OS.objc_msgSend(this.id_, OS.sel_isDisplayedWhenStopped) !is null;
    }

    public bool isIndeterminate ()
    {
        return OS.objc_msgSend(this.id_, OS.sel_isIndeterminate) !is null;
    }

    public double maxValue ()
    {
        return OS.objc_msgSend_fpret(this.id_, OS.sel_maxValue);
    }

    public double minValue ()
    {
        return OS.objc_msgSend_fpret(this.id_, OS.sel_minValue);
    }

    public void setAnimationDelay (NSTimeInterval delay)
    {
        OS.objc_msgSend(this.id_, OS.sel_setAnimationDelay_1, delay);
    }

    public void setBezeled (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setBezeled_1, flag);
    }

    public void setControlSize (NSControlSize size)
    {
        OS.objc_msgSend(this.id_, OS.sel_setControlSize_1, size);
    }

    public void setControlTint (NSControlSize tint)
    {
        OS.objc_msgSend(this.id_, OS.sel_setControlTint_1, tint);
    }

    public void setDisplayedWhenStopped (bool isDisplayed)
    {
        OS.objc_msgSend(this.id_, OS.sel_setDisplayedWhenStopped_1, isDisplayed);
    }

    public void setDoubleValue (double doubleValue)
    {
        OS.objc_msgSend(this.id_, OS.sel_setDoubleValue_1, doubleValue);
    }

    public void setIndeterminate (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setIndeterminate_1, flag);
    }

    public void setMaxValue (double newMaximum)
    {
        OS.objc_msgSend(this.id_, OS.sel_setMaxValue_1, newMaximum);
    }

    public void setMinValue (double newMinimum)
    {
        OS.objc_msgSend(this.id_, OS.sel_setMinValue_1, newMinimum);
    }

    public void setStyle (NSProgressIndicatorStyle style)
    {
        OS.objc_msgSend(this.id_, OS.sel_setStyle_1, style);
    }

    public void setUsesThreadedAnimation (bool threadedAnimation)
    {
        OS.objc_msgSend(this.id_, OS.sel_setUsesThreadedAnimation_1, threadedAnimation);
    }

    public void sizeToFit ()
    {
        OS.objc_msgSend(this.id_, OS.sel_sizeToFit);
    }

    public void startAnimation (id sender)
    {
        OS.objc_msgSend(this.id_, OS.sel_startAnimation_1, sender !is null ? sender.id_ : null);
    }

    public void stopAnimation (id sender)
    {
        OS.objc_msgSend(this.id_, OS.sel_stopAnimation_1, sender !is null ? sender.id_ : null);
    }

    public NSProgressIndicatorStyle style ()
    {
        return cast(NSProgressIndicatorStyle) OS.objc_msgSend(this.id_, OS.sel_style);
    }

    public bool usesThreadedAnimation ()
    {
        return OS.objc_msgSend(this.id_, OS.sel_usesThreadedAnimation) !is null;
    }

}