Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSOpenPanel.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.NSOpenPanel; import dwt.internal.cocoa.id; import dwt.internal.cocoa.NSArray; import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSSavePanel; import dwt.internal.cocoa.NSString; import dwt.internal.cocoa.NSWindow; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; public class NSOpenPanel : NSSavePanel { public this () { super(); } public this (objc.id id) { super(id); } public NSArray URLs () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_URLs); return result !is null ? new NSArray(result) : null; } public bool allowsMultipleSelection () { return OS.objc_msgSend(this.id_, OS.sel_allowsMultipleSelection) !is null; } public void beginForDirectory (NSString path, NSString name, NSArray fileTypes, id delegatee, objc.SEL didEndSelector, void* contextInfo) { OS.objc_msgSend(this.id_, OS.sel_beginForDirectory_1file_1types_1modelessDelegate_1didEndSelector_1contextInfo_1, path !is null ? path.id_ : null, name !is null ? name.id_ : null, fileTypes !is null ? fileTypes.id_ : null, delegatee !is null ? delegatee.id_ : null, didEndSelector, contextInfo); } public void beginSheetForDirectory (NSString path, NSString name, NSArray fileTypes, NSWindow docWindow, id delegatee, objc.SEL didEndSelector, void* contextInfo) { OS.objc_msgSend(this.id_, OS.sel_beginSheetForDirectory_1file_1types_1modalForWindow_1modalDelegate_1didEndSelector_1contextInfo_1, path !is null ? path.id_ : null, name !is null ? name.id_ : null, fileTypes !is null ? fileTypes.id_ : null, docWindow !is null ? docWindow.id_ : null, delegatee !is null ? delegatee.id_ : null, didEndSelector, contextInfo); } public bool canChooseDirectories () { return OS.objc_msgSend(this.id_, OS.sel_canChooseDirectories) !is null; } public bool canChooseFiles () { return OS.objc_msgSend(this.id_, OS.sel_canChooseFiles) !is null; } public NSArray filenames () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_filenames); return result !is null ? new NSArray(result) : null; } public static NSOpenPanel openPanel () { objc.id result = OS.objc_msgSend(OS.class_NSOpenPanel, OS.sel_openPanel); return result !is null ? new NSOpenPanel(result) : null; } public bool resolvesAliases () { return OS.objc_msgSend(this.id_, OS.sel_resolvesAliases) !is null; } public NSInteger runModalForDirectory (NSString path, NSString name, NSArray fileTypes) { return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_runModalForDirectory_1file_1types_1, path !is null ? path.id_ : null, name !is null ? name.id_ : null, fileTypes !is null ? fileTypes.id_ : null); } public NSInteger runModalForTypes (NSArray fileTypes) { return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_runModalForTypes_1, fileTypes !is null ? fileTypes.id_ : null); } public void setAllowsMultipleSelection (bool flag) { OS.objc_msgSend(this.id_, OS.sel_setAllowsMultipleSelection_1, flag); } public void setCanChooseDirectories (bool flag) { OS.objc_msgSend(this.id_, OS.sel_setCanChooseDirectories_1, flag); } public void setCanChooseFiles (bool flag) { OS.objc_msgSend(this.id_, OS.sel_setCanChooseFiles_1, flag); } public void setResolvesAliases (bool flag) { OS.objc_msgSend(this.id_, OS.sel_setResolvesAliases_1, flag); } }