Mercurial > projects > dwt-mac
comparison dwt/widgets/DirectoryDialog.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | 1a8b3cb347e0 |
children | 906145852b63 |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
31 * </dl> | 31 * </dl> |
32 * <p> | 32 * <p> |
33 * IMPORTANT: This class is intended to be subclassed <em>only</em> | 33 * IMPORTANT: This class is intended to be subclassed <em>only</em> |
34 * within the DWT implementation. | 34 * within the DWT implementation. |
35 * </p> | 35 * </p> |
36 * | |
37 * @see <a href="http://www.eclipse.org/swt/snippets/#directorydialog">DirectoryDialog snippets</a> | |
38 * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Example: ControlExample, Dialog tab</a> | |
39 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> | |
36 */ | 40 */ |
37 public class DirectoryDialog : Dialog { | 41 public class DirectoryDialog : Dialog { |
38 String message = "", filterPath = ""; | 42 String message = "", filterPath = ""; |
39 | 43 |
40 /** | 44 /** |
77 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> | 81 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> |
78 * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li> | 82 * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li> |
79 * </ul> | 83 * </ul> |
80 */ | 84 */ |
81 public this (Shell parent, int style) { | 85 public this (Shell parent, int style) { |
82 super (parent, style); | 86 super (parent, checkStyle (parent, style)); |
83 checkSubclass (); | 87 checkSubclass (); |
84 } | 88 } |
85 | 89 |
86 /** | 90 /** |
87 * Returns the path which the dialog will use to filter | 91 * Returns the path which the dialog will use to filter |
124 panel.setAllowsMultipleSelection((style & DWT.MULTI) !is 0); | 128 panel.setAllowsMultipleSelection((style & DWT.MULTI) !is 0); |
125 if (filterPath !is null) panel.setDirectory(NSString.stringWith(filterPath)); | 129 if (filterPath !is null) panel.setDirectory(NSString.stringWith(filterPath)); |
126 panel.setTitle(NSString.stringWith(title !is null ? title : "")); | 130 panel.setTitle(NSString.stringWith(title !is null ? title : "")); |
127 panel.setCanChooseFiles(false); | 131 panel.setCanChooseFiles(false); |
128 panel.setCanChooseDirectories(true); | 132 panel.setCanChooseDirectories(true); |
129 int response = panel.runModal(); | 133 int /*long*/ response = panel.runModal(); |
130 if (response is OS.NSFileHandlingPanelOKButton) { | 134 if (response is OS.NSFileHandlingPanelOKButton) { |
131 NSString filename = panel.filename(); | 135 NSString filename = panel.filename(); |
132 char[] buffer = new char[filename.length()]; | 136 directoryPath = filterPath = filename.getString(); |
133 filename.getCharacters_(buffer); | |
134 directoryPath = filterPath = new String(buffer); | |
135 } | 137 } |
136 // options.optionFlags = OS.kNavSupportPackages | OS.kNavAllowOpenPackages | OS.kNavAllowInvisibleFiles; | 138 // options.optionFlags = OS.kNavSupportPackages | OS.kNavAllowOpenPackages | OS.kNavAllowInvisibleFiles; |
137 return directoryPath; | 139 return directoryPath; |
138 } | 140 } |
139 | 141 |