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

import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSAppleEventDescriptor;
import dwt.internal.cocoa.NSDictionary;
import dwt.internal.cocoa.NSObject;
import dwt.internal.cocoa.NSScriptCommandDescription;
import dwt.internal.cocoa.NSScriptObjectSpecifier;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

public class NSScriptCommand : NSObject
{

    public this ()
    {
        super();
    }

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

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

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

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

    public static NSScriptCommand currentCommand ()
    {
        objc.id result = OS.objc_msgSend(OS.class_NSScriptCommand, OS.sel_currentCommand);
        return result !is null ? new NSScriptCommand(result) : null;
    }

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

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

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

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

    public id initWithCommandDescription (NSScriptCommandDescription commandDef)
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithCommandDescription_1, commandDef !is null ? commandDef.id_ : null);
        return result !is null ? new id(result) : null;
    }

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

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

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

    public void resumeExecutionWithResult (id result)
    {
        OS.objc_msgSend(this.id_, OS.sel_resumeExecutionWithResult_1, result !is null ? result.id_ : null);
    }

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

    public int scriptErrorNumber ()
    {
        return cast(int) OS.objc_msgSend(this.id_, OS.sel_scriptErrorNumber);
    }

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

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

    public void setArguments (NSDictionary args)
    {
        OS.objc_msgSend(this.id_, OS.sel_setArguments_1, args !is null ? args.id_ : null);
    }

    public void setDirectParameter (id directParameter)
    {
        OS.objc_msgSend(this.id_, OS.sel_setDirectParameter_1, directParameter !is null ? directParameter.id_ : null);
    }

    public void setReceiversSpecifier (NSScriptObjectSpecifier receiversRef)
    {
        OS.objc_msgSend(this.id_, OS.sel_setReceiversSpecifier_1, receiversRef !is null ? receiversRef.id_ : null);
    }

    public void setScriptErrorExpectedTypeDescriptor (NSAppleEventDescriptor errorExpectedTypeDescriptor)
    {
        OS.objc_msgSend(this.id_, OS.sel_setScriptErrorExpectedTypeDescriptor_1,
                errorExpectedTypeDescriptor !is null ? errorExpectedTypeDescriptor.id_ : null);
    }

    public void setScriptErrorNumber (int errorNumber)
    {
        OS.objc_msgSend(this.id_, OS.sel_setScriptErrorNumber_1, errorNumber);
    }

    public void setScriptErrorOffendingObjectDescriptor (NSAppleEventDescriptor errorOffendingObjectDescriptor)
    {
        OS.objc_msgSend(this.id_, OS.sel_setScriptErrorOffendingObjectDescriptor_1,
                errorOffendingObjectDescriptor !is null ? errorOffendingObjectDescriptor.id_ : null);
    }

    public void setScriptErrorString (NSString errorString)
    {
        OS.objc_msgSend(this.id_, OS.sel_setScriptErrorString_1, errorString !is null ? errorString.id_ : null);
    }

    public void suspendExecution ()
    {
        OS.objc_msgSend(this.id_, OS.sel_suspendExecution);
    }

}