view dwt/internal/cocoa/NSControl.d @ 1:8b48be5454ce

The internal cocoa classes compile now
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Tue, 19 Aug 2008 17:35:17 +0200
parents 380af2bdd8e5
children f565d3a95c0a
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.NSControl;

import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSAttributedString;
import dwt.internal.cocoa.NSCell;
import dwt.internal.cocoa.NSEvent;
import dwt.internal.cocoa.NSFont;
import dwt.internal.cocoa.NSFormatter;
import dwt.internal.cocoa.NSInteger;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.NSText;
import dwt.internal.cocoa.NSView;
import dwt.internal.cocoa.OS;
import obj = dwt.internal.objc.runtime;

public class NSControl : NSView
{

    public this ()
    {
        super();
    }

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

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

    public objc.SEL action ()
    {
        return cast(objc.SEL) OS.objc_msgSend(this.id_, OS.sel_action);
    }

    public objc.id alignment ()
    {
        return OS.objc_msgSend(this.id_, OS.sel_alignment);
    }

    public NSAttributedString attributedStringValue ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_attributedStringValue);
        return result !is null ? new NSAttributedString(result) : null;
    }

    public objc.id baseWritingDirection ()
    {
        return OS.objc_msgSend(this.id_, OS.sel_baseWritingDirection);
    }

    public void calcSize ()
    {
        OS.objc_msgSend(this.id_, OS.sel_calcSize);
    }

    public objc.id cell ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_cell);
        return result !is null ? result : null;
    }

    public static objc.Class cellClass ()
    {
        return cast(objc.Class) OS.objc_msgSend(OS.class_NSControl, OS.sel_cellClass);
    }

    public NSText currentEditor ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_currentEditor);
        return result !is null ? new NSText(result) : null;
    }

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

    public void drawCell (NSCell aCell)
    {
        OS.objc_msgSend(this.id_, OS.sel_drawCell_1, aCell !is null ? aCell.id_ : null);
    }

    public void drawCellInside (NSCell aCell)
    {
        OS.objc_msgSend(this.id_, OS.sel_drawCellInside_1, aCell !is null ? aCell.id_ : null);
    }

    public float floatValue ()
    {
        return cast(float) OS.objc_msgSend_fpret(this.id_, OS.sel_floatValue);
    }

    public NSFont font ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_font);
        return result !is null ? new NSFont(result) : null;
    }

    public id formatter ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_formatter);
        return result !is null ? new id(result) : null;
    }

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

    public int intValue ()
    {
        return cast(int) OS.objc_msgSend(this.id_, OS.sel_intValue);
    }

    public NSInteger integerValue ()
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_integerValue);
    }

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

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

    public void mouseDown (NSEvent theEvent)
    {
        OS.objc_msgSend(this.id_, OS.sel_mouseDown_1, theEvent !is null ? theEvent.id_ : null);
    }

    public id objectValue ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_objectValue);
        return result !is null ? new id(result) : null;
    }

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

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

    public void selectCell (NSCell aCell)
    {
        OS.objc_msgSend(this.id_, OS.sel_selectCell_1, aCell !is null ? aCell.id_ : null);
    }

    public id selectedCell ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_selectedCell);
        return result !is null ? new id(result) : null;
    }

    public NSInteger selectedTag ()
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_selectedTag);
    }

    public bool sendAction (objc.SEL theAction, id theTarget)
    {
        return OS.objc_msgSend(this.id_, OS.sel_sendAction_1to_1, theAction, theTarget !is null ? theTarget.id_ : null) !is null;
    }

    public NSInteger sendActionOn (NSInteger mask)
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_sendActionOn_1, mask);
    }

    public void setAction (objc.SEL aSelector)
    {
        OS.objc_msgSend(this.id_, OS.sel_setAction_1, aSelector);
    }

    public void setAlignment (objc.id mode)
    {
        OS.objc_msgSend(this.id_, OS.sel_setAlignment_1, mode);
    }

    public void setAttributedStringValue (NSAttributedString obj)
    {
        OS.objc_msgSend(this.id_, OS.sel_setAttributedStringValue_1, obj !is null ? obj.id_ : null);
    }

    public void setBaseWritingDirection (objc.id writingDirection)
    {
        OS.objc_msgSend(this.id_, OS.sel_setBaseWritingDirection_1, writingDirection);
    }

    public void setCell (NSCell aCell)
    {
        OS.objc_msgSend(this.id_, OS.sel_setCell_1, aCell !is null ? aCell.id_ : null);
    }

    public static void setCellClass (objc.Class factoryId)
    {
        OS.objc_msgSend(OS.class_NSControl, OS.sel_setCellClass_1, factoryId);
    }

    public void setContinuous (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setContinuous_1, flag);
    }

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

    public void setEnabled (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setEnabled_1, flag);
    }

    public void setFloatValue (float aFloat)
    {
        OS.objc_msgSend(this.id_, OS.sel_setFloatValue_1, aFloat);
    }

    public void setFloatingPointFormat (bool autoRange, NSUInteger leftDigits, NSUInteger rightDigits)
    {
        OS.objc_msgSend(this.id_, OS.sel_setFloatingPointFormat_1left_1right_1, autoRange, leftDigits, rightDigits);
    }

    public void setFont (NSFont fontObj)
    {
        OS.objc_msgSend(this.id_, OS.sel_setFont_1, fontObj !is null ? fontObj.id_ : null);
    }

    public void setFormatter (NSFormatter newFormatter)
    {
        OS.objc_msgSend(this.id_, OS.sel_setFormatter_1, newFormatter !is null ? newFormatter.id_ : null);
    }

    public void setIgnoresMultiClick (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setIgnoresMultiClick_1, flag);
    }

    public void setIntValue (int anInt)
    {
        OS.objc_msgSend(this.id_, OS.sel_setIntValue_1, anInt);
    }

    public void setIntegerValue (NSInteger anInteger)
    {
        OS.objc_msgSend(this.id_, OS.sel_setIntegerValue_1, anInteger);
    }

    public void setNeedsDisplay ()
    {
        OS.objc_msgSend(this.id_, OS.sel_setNeedsDisplay);
    }

    public void setObjectValue (id obj)
    {
        OS.objc_msgSend(this.id_, OS.sel_setObjectValue_1, obj !is null ? obj.id_ : null);
    }

    public void setRefusesFirstResponder (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setRefusesFirstResponder_1, flag);
    }

    public void setStringValue (NSString aString)
    {
        OS.objc_msgSend(this.id_, OS.sel_setStringValue_1, aString !is null ? aString.id_ : null);
    }

    public void setTag (NSInteger anInt)
    {
        OS.objc_msgSend(this.id_, OS.sel_setTag_1, anInt);
    }

    public void setTarget (id anObject)
    {
        OS.objc_msgSend(this.id_, OS.sel_setTarget_1, anObject !is null ? anObject.id_ : null);
    }

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

    public NSString stringValue ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringValue);
        return result !is null ? new NSString(result) : null;
    }

    public NSInteger tag ()
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_tag);
    }

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

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

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

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

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

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

    public id target ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_target);
        return result !is null ? new id(result) : null;
    }

    public void updateCell (NSCell aCell)
    {
        OS.objc_msgSend(this.id_, OS.sel_updateCell_1, aCell !is null ? aCell.id_ : null);
    }

    public void updateCellInside (NSCell aCell)
    {
        OS.objc_msgSend(this.id_, OS.sel_updateCellInside_1, aCell !is null ? aCell.id_ : null);
    }

    public void validateEditing ()
    {
        OS.objc_msgSend(this.id_, OS.sel_validateEditing);
    }

}