Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSProgressIndicator.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/NSProgressIndicator.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,179 @@ +/******************************************************************************* + * 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.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 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; + } + +}