diff dwt/internal/cocoa/NSSliderCell.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/NSSliderCell.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,253 @@
+/*******************************************************************************
+ * 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.NSSliderCell;
+
+import dwt.internal.cocoa.CGFloat;
+import dwt.internal.cocoa.id;
+import dwt.internal.cocoa.NSActionCell;
+import dwt.internal.cocoa.NSCell;
+import dwt.internal.cocoa.NSColor;
+import dwt.internal.cocoa.NSFont;
+import dwt.internal.cocoa.NSInteger;
+import dwt.internal.cocoa.NSPoint;
+import dwt.internal.cocoa.NSRect;
+import dwt.internal.cocoa.NSString;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+
+
+enum NSTickMarkPosition
+{
+    NSTickMarkBelow = 0,
+    NSTickMarkAbove = 1,
+    NSTickMarkLeft = NSTickMarkAbove,
+    NSTickMarkRight = NSTickMarkBelow
+}
+
+alias NSTickMarkPosition.NSTickMarkBelow NSTickMarkBelow;
+alias NSTickMarkPosition.NSTickMarkAbove NSTickMarkAbove;
+alias NSTickMarkPosition.NSTickMarkLeft NSTickMarkLeft;
+alias NSTickMarkPosition.NSTickMarkRight NSTickMarkRight;
+
+
+
+enum NSSliderType
+{
+    NSLinearSlider = 0,
+    NSCircularSlider = 1
+}
+
+alias NSSliderType.NSLinearSlider NSLinearSlider;
+alias NSSliderType.NSCircularSlider NSCircularSlider;
+
+public class NSSliderCell : NSActionCell
+{
+
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public bool allowsTickMarkValuesOnly ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_allowsTickMarkValuesOnly) !is null;
+    }
+
+    public double altIncrementValue ()
+    {
+        return OS.objc_msgSend_fpret(this.id, OS.sel_altIncrementValue);
+    }
+
+    public double closestTickMarkValueToValue (double value)
+    {
+        return OS.objc_msgSend_fpret(this.id, OS.sel_closestTickMarkValueToValue_1, value);
+    }
+
+    public void drawBarInside (NSRect aRect, bool flipped)
+    {
+        OS.objc_msgSend(this.id, OS.sel_drawBarInside_1flipped_1, aRect, flipped);
+    }
+
+    public void drawKnob ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_drawKnob);
+    }
+
+    public void drawKnob_ (NSRect knobRect)
+    {
+        OS.objc_msgSend(this.id, OS.sel_drawKnob_1, knobRect);
+    }
+
+    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 NSRect knobRectFlipped (bool flipped)
+    {
+        NSRect result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_knobRectFlipped_1, flipped);
+        return result;
+    }
+
+    public CGFloat knobThickness ()
+    {
+        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_knobThickness);
+    }
+
+    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 NSInteger numberOfTickMarks ()
+    {
+        return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfTickMarks);
+    }
+
+    public static bool prefersTrackingUntilMouseUp ()
+    {
+        return OS.objc_msgSend(OS.class_NSSliderCell, OS.sel_prefersTrackingUntilMouseUp) !is null;
+    }
+
+    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 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 setSliderType (NSSliderType sliderType)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setSliderType_1, sliderType);
+    }
+
+    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 NSSliderType sliderType ()
+    {
+        return cast(NSSliderType) OS.objc_msgSend(this.id, OS.sel_sliderType);
+    }
+
+    public NSTickMarkPosition tickMarkPosition ()
+    {
+        return cast(NSTickMarkPosition) OS.objc_msgSend(this.id, OS.sel_tickMarkPosition);
+    }
+
+    public double tickMarkValueAtIndex (NSInteger index)
+    {
+        return 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;
+    }
+
+    public NSRect trackRect ()
+    {
+        NSRect result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_trackRect);
+        return result;
+    }
+
+}