view dwt/internal/cocoa/NSSlider.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.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;
    }

}