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

import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSArray;
import dwt.internal.cocoa.NSInteger;
import dwt.internal.cocoa.NSPanel;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.NSURL;
import dwt.internal.cocoa.NSView;
import dwt.internal.cocoa.NSWindow;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

public class NSSavePanel : NSPanel
{

    public this ()
    {
        super();
    }

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

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

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

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

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

    public void beginSheetForDirectory (NSString path, NSString name, NSWindow docWindow, id delegatee, objc.SEL didEndSelector, void* contextInfo)
    {
        OS.objc_msgSend(this.id_, OS.sel_beginSheetForDirectory_1file_1modalForWindow_1modalDelegate_1didEndSelector_1contextInfo_1,
                path !is null ? path.id_ : null, name !is null ? name.id_ : null, docWindow !is null ? docWindow.id_ : null,
                delegatee !is null ? delegatee.id_ : null, didEndSelector, contextInfo);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

    public NSInteger runModal ()
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_runModal);
    }

    public NSInteger runModalForDirectory (NSString path, NSString name)
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_runModalForDirectory_1file_1, path !is null ? path.id_ : null, name !is null ? name.id_ : null);
    }

    public static NSSavePanel savePanel ()
    {
        objc.id result = OS.objc_msgSend(OS.class_NSSavePanel, OS.sel_savePanel);
        return result !is null ? new NSSavePanel(result) : null;
    }

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

    public void setAccessoryView (NSView view)
    {
        OS.objc_msgSend(this.id_, OS.sel_setAccessoryView_1, view !is null ? view.id_ : null);
    }

    public void setAllowedFileTypes (NSArray types)
    {
        OS.objc_msgSend(this.id_, OS.sel_setAllowedFileTypes_1, types !is null ? types.id_ : null);
    }

    public void setAllowsOtherFileTypes (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setAllowsOtherFileTypes_1, flag);
    }

    public void setCanCreateDirectories (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setCanCreateDirectories_1, flag);
    }

    public void setCanSelectHiddenExtension (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setCanSelectHiddenExtension_1, flag);
    }

    public void setDelegate (id delegatee)
    {
        OS.objc_msgSend(this.id_, OS.sel_setDelegate_1, delegatee !is null ? delegatee.id_ : null);
    }

    public void setDirectory (NSString path)
    {
        OS.objc_msgSend(this.id_, OS.sel_setDirectory_1, path !is null ? path.id_ : null);
    }

    public void setExtensionHidden (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setExtensionHidden_1, flag);
    }

    public void setMessage (NSString message)
    {
        OS.objc_msgSend(this.id_, OS.sel_setMessage_1, message !is null ? message.id_ : null);
    }

    public void setNameFieldLabel (NSString label)
    {
        OS.objc_msgSend(this.id_, OS.sel_setNameFieldLabel_1, label !is null ? label.id_ : null);
    }

    public void setPrompt (NSString prompt)
    {
        OS.objc_msgSend(this.id_, OS.sel_setPrompt_1, prompt !is null ? prompt.id_ : null);
    }

    public void setRequiredFileType (NSString type)
    {
        OS.objc_msgSend(this.id_, OS.sel_setRequiredFileType_1, type !is null ? type.id_ : null);
    }

    public void setTitle (NSString title)
    {
        OS.objc_msgSend(this.id_, OS.sel_setTitle_1, title !is null ? title.id_ : null);
    }

    public void setTreatsFilePackagesAsDirectories (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setTreatsFilePackagesAsDirectories_1, flag);
    }

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

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

    public void validateVisibleColumns ()
    {
        OS.objc_msgSend(this.id_, OS.sel_validateVisibleColumns);
    }

}