Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSSlider.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/NSSlider.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,202 @@ +/******************************************************************************* + * 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.NSSlider; + +import dwt.internal.cocoa.CGFloat; +import dwt.internal.cocoa.id; +import dwt.internal.cocoa.NSCell; +import dwt.internal.cocoa.NSColor; +import dwt.internal.cocoa.NSControl; +import dwt.internal.cocoa.NSEvent; +import dwt.internal.cocoa.NSFont; +import dwt.internal.cocoa.NSImage; +import dwt.internal.cocoa.NSInteger; +import dwt.internal.cocoa.NSPoint; +import dwt.internal.cocoa.NSRect; +import dwt.internal.cocoa.NSSliderCell : NSTickMarkPosition; +import dwt.internal.cocoa.NSString; +import dwt.internal.cocoa.OS; +import objc = dwt.internal.objc.runtime; + +public class NSSlider : NSControl +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public bool acceptsFirstMouse (NSEvent theEvent) + { + return OS.objc_msgSend(this.id, OS.sel_acceptsFirstMouse_1, theEvent !is null ? theEvent.id : null) !is null; + } + + public bool allowsTickMarkValuesOnly () + { + return OS.objc_msgSend(this.id, OS.sel_allowsTickMarkValuesOnly) !is null; + } + + public double altIncrementValue () + { + return cast(double) OS.objc_msgSend_fpret(this.id, OS.sel_altIncrementValue); + } + + public double closestTickMarkValueToValue (double value) + { + return cast(double) OS.objc_msgSend_fpret(this.id, OS.sel_closestTickMarkValueToValue_1, value); + } + + public NSImage image () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_image); + return result !is null ? new NSImage(result) : null; + } + + public NSInteger indexOfTickMarkAtPoint (NSPoint point) + { + return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfTickMarkAtPoint_1, point); + } + + public NSInteger isVertical () + { + return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_isVertical); + } + + public CGFloat knobThickness () + { + return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_knobThickness); + } + + public double maxValue () + { + return cast(double) OS.objc_msgSend_fpret(this.id, OS.sel_maxValue); + } + + public double minValue () + { + return cast(double) OS.objc_msgSend_fpret(this.id, OS.sel_minValue); + } + + public NSInteger numberOfTickMarks () + { + return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfTickMarks); + } + + public NSRect rectOfTickMarkAtIndex (NSInteger index) + { + NSRect result; + OS.objc_msgSend_stret(result, this.id, OS.sel_rectOfTickMarkAtIndex_1, index); + return result; + } + + public void setAllowsTickMarkValuesOnly (bool yorn) + { + OS.objc_msgSend(this.id, OS.sel_setAllowsTickMarkValuesOnly_1, yorn); + } + + public void setAltIncrementValue (double incValue) + { + OS.objc_msgSend(this.id, OS.sel_setAltIncrementValue_1, incValue); + } + + public void setImage (NSImage backgroundImage) + { + OS.objc_msgSend(this.id, OS.sel_setImage_1, backgroundImage !is null ? backgroundImage.id : null); + } + + public void setKnobThickness (CGFloat aFloat) + { + OS.objc_msgSend(this.id, OS.sel_setKnobThickness_1, aFloat); + } + + public void setMaxValue (double aDouble) + { + OS.objc_msgSend(this.id, OS.sel_setMaxValue_1, aDouble); + } + + public void setMinValue (double aDouble) + { + OS.objc_msgSend(this.id, OS.sel_setMinValue_1, aDouble); + } + + public void setNumberOfTickMarks (NSInteger count) + { + OS.objc_msgSend(this.id, OS.sel_setNumberOfTickMarks_1, count); + } + + public void setTickMarkPosition (NSTickMarkPosition position) + { + OS.objc_msgSend(this.id, OS.sel_setTickMarkPosition_1, position); + } + + public void setTitle (NSString aString) + { + OS.objc_msgSend(this.id, OS.sel_setTitle_1, aString !is null ? aString.id : null); + } + + public void setTitleCell (NSCell aCell) + { + OS.objc_msgSend(this.id, OS.sel_setTitleCell_1, aCell !is null ? aCell.id : null); + } + + public void setTitleColor (NSColor newColor) + { + OS.objc_msgSend(this.id, OS.sel_setTitleColor_1, newColor !is null ? newColor.id : null); + } + + public void setTitleFont (NSFont fontObj) + { + OS.objc_msgSend(this.id, OS.sel_setTitleFont_1, fontObj !is null ? fontObj.id : null); + } + + public NSTickMarkPosition tickMarkPosition () + { + return cast(NSTickMarkPosition) OS.objc_msgSend(this.id, OS.sel_tickMarkPosition); + } + + public double tickMarkValueAtIndex (NSInteger index) + { + return cast(double) OS.objc_msgSend_fpret(this.id, OS.sel_tickMarkValueAtIndex_1, index); + } + + public NSString title () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_title); + return result !is null ? new NSString(result) : null; + } + + public id titleCell () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_titleCell); + return result !is null ? new id(result) : null; + } + + public NSColor titleColor () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_titleColor); + return result !is null ? new NSColor(result) : null; + } + + public NSFont titleFont () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_titleFont); + return result !is null ? new NSFont(result) : null; + } + +}