diff dwt/internal/cocoa/NSOpenPanel.d @ 0:380af2bdd8e5

Upload of whole dwt tree
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sat, 09 Aug 2008 17:00:02 +0200
parents
children 8b48be5454ce
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/cocoa/NSOpenPanel.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * 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.NSInteger;
+import dwt.internal.cocoa.NSSavePanel;
+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);
+    }
+
+}