annotate dwt/widgets/DirectoryDialog.d @ 259:c0d810de7093

Update SWT 3.4M7 to 3.4
author Frank Benoit <benoit@tionex.de>
date Sun, 29 Jun 2008 14:33:38 +0200
parents 5a30aa9820f3
children 07d9ed8927b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
126
73b4c55700ec Fix in DirectoryDialog string convertion
Frank Benoit <benoit@tionex.de>
parents: 108
diff changeset
1 /*******************************************************************************
259
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
2 * Copyright (c) 2000, 2008 IBM Corporation and others.
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3 * All rights reserved. This program and the accompanying materials
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4 * are made available under the terms of the Eclipse Public License v1.0
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
5 * which accompanies this distribution, and is available at
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
6 * http://www.eclipse.org/legal/epl-v10.html
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
7 *
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
8 * Contributors:
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
9 * IBM Corporation - initial API and implementation
108
0f12f6bb9739 author notice
Frank Benoit <benoit@tionex.de>
parents: 78
diff changeset
10 * Port to the D programming language:
0f12f6bb9739 author notice
Frank Benoit <benoit@tionex.de>
parents: 78
diff changeset
11 * Frank Benoit <benoit@tionex.de>
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
12 *******************************************************************************/
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
13 module dwt.widgets.DirectoryDialog;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
14
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 126
diff changeset
15 import dwt.dwthelper.utils;
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 126
diff changeset
16
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
17
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
18
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
19 import dwt.DWT;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
20 import dwt.DWTException;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
21 import dwt.internal.gtk.OS;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
22 import dwt.widgets.Dialog;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
23 import dwt.widgets.Shell;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
24 import dwt.widgets.Display;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
25
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
26 static import tango.io.FileConst;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
27 static import tango.text.Util;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
28
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
29 /**
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
30 * Instances of this class allow the user to navigate
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
31 * the file system and select a directory.
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
32 * <dl>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
33 * <dt><b>Styles:</b></dt>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
34 * <dd>(none)</dd>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
35 * <dt><b>Events:</b></dt>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
36 * <dd>(none)</dd>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
37 * </dl>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
38 * <p>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
39 * IMPORTANT: This class is intended to be subclassed <em>only</em>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
40 * within the DWT implementation.
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
41 * </p>
259
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
42 *
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
43 * @see <a href="http://www.eclipse.org/swt/snippets/#directorydialog">DirectoryDialog snippets</a>
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
44 * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Example: ControlExample, Dialog tab</a>
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
45 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
46 */
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
47 public class DirectoryDialog : Dialog {
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 126
diff changeset
48 String message = "", filterPath = "";
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 126
diff changeset
49 static const String SEPARATOR = tango.io.FileConst.FileConst.PathSeparatorString;;
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
50
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
51 /**
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
52 * Constructs a new instance of this class given only its parent.
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
53 *
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
54 * @param parent a shell which will be the parent of the new instance
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
55 *
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
56 * @exception IllegalArgumentException <ul>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
57 * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
58 * </ul>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
59 * @exception DWTException <ul>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
60 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
61 * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
62 * </ul>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
63 */
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
64 public this (Shell parent) {
240
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
65 this (parent, DWT.APPLICATION_MODAL);
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
66 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
67 /**
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
68 * Constructs a new instance of this class given its parent
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
69 * and a style value describing its behavior and appearance.
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
70 * <p>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
71 * The style value is either one of the style constants defined in
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
72 * class <code>DWT</code> which is applicable to instances of this
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
73 * class, or must be built by <em>bitwise OR</em>'ing together
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
74 * (that is, using the <code>int</code> "|" operator) two or more
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
75 * of those <code>DWT</code> style constants. The class description
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
76 * lists the style constants that are applicable to the class.
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
77 * Style bits are also inherited from superclasses.
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
78 * </p>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
79 *
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
80 * @param parent a shell which will be the parent of the new instance
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
81 * @param style the style of dialog to construct
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
82 *
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
83 * @exception IllegalArgumentException <ul>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
84 * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
85 * </ul>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
86 * @exception DWTException <ul>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
87 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
88 * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
89 * </ul>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
90 */
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
91 public this (Shell parent, int style) {
240
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
92 super (parent, checkStyle (parent, style));
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
93 checkSubclass ();
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
94 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
95 /**
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
96 * Returns the path which the dialog will use to filter
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
97 * the directories it shows.
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
98 *
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
99 * @return the filter path
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
100 *
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
101 * @see #setFilterPath
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
102 */
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 126
diff changeset
103 public String getFilterPath () {
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
104 return filterPath;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
105 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
106 /**
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
107 * Returns the dialog's message, which is a description of
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
108 * the purpose for which it was opened. This message will be
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
109 * visible on the dialog while it is open.
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
110 *
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
111 * @return the message
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
112 */
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 126
diff changeset
113 public String getMessage () {
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
114 return message;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
115 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
116 /**
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
117 * Makes the dialog visible and brings it to the front
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
118 * of the display.
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
119 *
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
120 * @return a string describing the absolute path of the selected directory,
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
121 * or null if the dialog was cancelled or an error occurred
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
122 *
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
123 * @exception DWTException <ul>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
124 * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
125 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
126 * </ul>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
127 */
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 126
diff changeset
128 public String open () {
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
129 bool useChooserDialog = OS.GTK_VERSION >= OS.buildVERSION (2, 4, 10);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
130 if (useChooserDialog) {
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
131 return openChooserDialog ();
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
132 } else {
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
133 return openClassicDialog ();
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
134 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
135 }
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 126
diff changeset
136 String openChooserDialog () {
255
5a30aa9820f3 removed tango.stdc.stringz imports and allow null for arrays and string arguments.
Frank Benoit <benoit@tionex.de>
parents: 240
diff changeset
137 char* titleBytes = toStringz(title);
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
138 auto shellHandle = parent.topHandle ();
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
139 auto handle = OS.gtk_file_chooser_dialog_new2 (
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
140 titleBytes,
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
141 shellHandle,
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
142 OS.GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
143 OS.GTK_STOCK_CANCEL (), OS.GTK_RESPONSE_CANCEL,
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
144 OS.GTK_STOCK_OK (), OS.GTK_RESPONSE_OK );
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
145 auto pixbufs = OS.gtk_window_get_icon_list (shellHandle);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
146 if (pixbufs !is null) {
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
147 OS.gtk_window_set_icon_list (handle, pixbufs);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
148 OS.g_list_free (pixbufs);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
149 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
150 if (filterPath !is null && filterPath.length > 0) {
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 126
diff changeset
151 String p;
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
152 /* filename must be a full path */
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
153 if ( filterPath[ 0 .. SEPARATOR.length ] != SEPARATOR ) {
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
154 p ~= SEPARATOR;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
155 p ~= filterPath;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
156 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
157 else{
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
158 p = filterPath;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
159 }
255
5a30aa9820f3 removed tango.stdc.stringz imports and allow null for arrays and string arguments.
Frank Benoit <benoit@tionex.de>
parents: 240
diff changeset
160 char* buffer = toStringz(p);
240
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
161 /*
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
162 * Bug in GTK. GtkFileChooser may crash on GTK versions 2.4.10 to 2.6
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
163 * when setting a file name that is not a true canonical path.
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
164 * The fix is to use the canonical path.
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
165 */
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
166 char* ptr = OS.realpath (buffer, null);
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
167 if (ptr !is null) {
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
168 OS.gtk_file_chooser_set_current_folder (handle, ptr);
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
169 OS.g_free (ptr);
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
170 }
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
171 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
172 if (message.length > 0) {
255
5a30aa9820f3 removed tango.stdc.stringz imports and allow null for arrays and string arguments.
Frank Benoit <benoit@tionex.de>
parents: 240
diff changeset
173 char* buffer = toStringz(message);
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
174 auto box = OS.gtk_hbox_new (false, 0);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
175 if (box is null) error (DWT.ERROR_NO_HANDLES);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
176 auto label = OS.gtk_label_new (buffer);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
177 if (label is null) error (DWT.ERROR_NO_HANDLES);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
178 OS.gtk_container_add (box, label);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
179 OS.gtk_widget_show (label);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
180 OS.gtk_label_set_line_wrap (label, true);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
181 OS.gtk_label_set_justify (label, OS.GTK_JUSTIFY_CENTER);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
182 OS.gtk_file_chooser_set_extra_widget (handle, box);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
183 }
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 126
diff changeset
184 String answer = null;
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
185 Display display = parent !is null ? parent.getDisplay (): Display.getCurrent ();
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
186 display.addIdleProc ();
240
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
187 Dialog oldModal = null;
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
188 if (OS.gtk_window_get_modal (handle)) {
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
189 oldModal = display.getModalDialog ();
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
190 display.setModalDialog (this);
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
191 }
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
192 int signalId = 0;
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
193 int /*long*/ hookId = 0;
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
194 CallbackData emissionData;
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
195 emissionData.display = display;
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
196 emissionData.data = handle;
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
197 if ((style & DWT.RIGHT_TO_LEFT) !is 0) {
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
198 signalId = OS.g_signal_lookup (OS.map.ptr, OS.GTK_TYPE_WIDGET());
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
199 hookId = OS.g_signal_add_emission_hook (signalId, 0, &Display.emissionFunc, &emissionData, null);
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
200 }
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
201 int response = OS.gtk_dialog_run (handle);
240
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
202 if ((style & DWT.RIGHT_TO_LEFT) !is 0) {
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
203 OS.g_signal_remove_emission_hook (signalId, hookId);
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
204 }
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
205 if (OS.gtk_window_get_modal (handle)) {
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
206 display.setModalDialog (oldModal);
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
207 }
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
208 if (response is OS.GTK_RESPONSE_OK) {
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
209 auto path = OS.gtk_file_chooser_get_filename (handle);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
210 if (path !is null) {
126
73b4c55700ec Fix in DirectoryDialog string convertion
Frank Benoit <benoit@tionex.de>
parents: 108
diff changeset
211 uint items_written;
73b4c55700ec Fix in DirectoryDialog string convertion
Frank Benoit <benoit@tionex.de>
parents: 108
diff changeset
212 auto utf8Ptr = OS.g_filename_to_utf8 (path, -1, null, &items_written, null);
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
213 OS.g_free (path);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
214 if (utf8Ptr !is null) {
126
73b4c55700ec Fix in DirectoryDialog string convertion
Frank Benoit <benoit@tionex.de>
parents: 108
diff changeset
215 answer = utf8Ptr[ 0 .. items_written ].dup;
240
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
216 filterPath = answer;
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
217 OS.g_free (utf8Ptr);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
218 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
219 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
220 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
221 display.removeIdleProc ();
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
222 OS.gtk_widget_destroy (handle);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
223 return answer;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
224 }
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 126
diff changeset
225 String openClassicDialog () {
255
5a30aa9820f3 removed tango.stdc.stringz imports and allow null for arrays and string arguments.
Frank Benoit <benoit@tionex.de>
parents: 240
diff changeset
226 char* titleBytes = toStringz(title);
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
227 auto handle = OS.gtk_file_selection_new (titleBytes);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
228 if (parent !is null) {
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
229 auto shellHandle = parent.topHandle ();
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
230 OS.gtk_window_set_transient_for (handle, shellHandle);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
231 auto pixbufs = OS.gtk_window_get_icon_list (shellHandle);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
232 if (pixbufs !is null) {
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
233 OS.gtk_window_set_icon_list (handle, pixbufs);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
234 OS.g_list_free (pixbufs);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
235 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
236 }
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 126
diff changeset
237 String answer = null;
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
238 if (filterPath !is null) {
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 126
diff changeset
239 String path = filterPath;
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
240 if (path.length > 0 && path[ $-1 .. $ ] != SEPARATOR ) {
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
241 path ~= SEPARATOR;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
242 }
255
5a30aa9820f3 removed tango.stdc.stringz imports and allow null for arrays and string arguments.
Frank Benoit <benoit@tionex.de>
parents: 240
diff changeset
243 char* fileNamePtr = OS.g_filename_from_utf8 (toStringz(path), -1, null, null, null);
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
244 OS.gtk_file_selection_set_filename (handle, fileNamePtr);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
245 OS.g_free (fileNamePtr);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
246 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
247 GtkFileSelection* selection = cast(GtkFileSelection*)handle;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
248 OS.gtk_file_selection_hide_fileop_buttons (handle);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
249 auto fileListParent = OS.gtk_widget_get_parent (selection.file_list);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
250 OS.gtk_widget_hide (selection.file_list);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
251 OS.gtk_widget_hide (fileListParent);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
252 if (message.length > 0) {
255
5a30aa9820f3 removed tango.stdc.stringz imports and allow null for arrays and string arguments.
Frank Benoit <benoit@tionex.de>
parents: 240
diff changeset
253 auto labelHandle = OS.gtk_label_new (toStringz(message));
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
254 OS.gtk_label_set_line_wrap (labelHandle, true);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
255 OS.gtk_misc_set_alignment (labelHandle, 0.0f, 0.0f);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
256 OS.gtk_container_add (selection.main_vbox, labelHandle);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
257 OS.gtk_box_set_child_packing (
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
258 selection.main_vbox, labelHandle, false, false, 0, OS.GTK_PACK_START);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
259 OS.gtk_widget_show (labelHandle);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
260 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
261 Display display = parent !is null ? parent.getDisplay (): Display.getCurrent ();
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
262 display.addIdleProc ();
240
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
263 Dialog oldModal = null;
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
264 if (OS.gtk_window_get_modal (handle)) {
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
265 oldModal = display.getModalDialog ();
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
266 display.setModalDialog (this);
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
267 }
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
268 int signalId = 0;
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
269 int /*long*/ hookId = 0;
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
270 CallbackData emissionData;
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
271 emissionData.display = display;
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
272 emissionData.data = handle;
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
273 if ((style & DWT.RIGHT_TO_LEFT) !is 0) {
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
274 signalId = OS.g_signal_lookup (OS.map.ptr, OS.GTK_TYPE_WIDGET());
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
275 hookId = OS.g_signal_add_emission_hook (signalId, 0, &Display.emissionFunc, &emissionData, null);
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
276 }
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
277 int response = OS.gtk_dialog_run (handle);
240
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
278 if ((style & DWT.RIGHT_TO_LEFT) !is 0) {
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
279 OS.g_signal_remove_emission_hook (signalId, hookId);
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
280 }
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
281 if (OS.gtk_window_get_modal (handle)) {
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
282 display.setModalDialog (oldModal);
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
283 }
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
284 if (response is OS.GTK_RESPONSE_OK) {
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
285 char* fileNamePtr = OS.gtk_file_selection_get_filename (handle);
126
73b4c55700ec Fix in DirectoryDialog string convertion
Frank Benoit <benoit@tionex.de>
parents: 108
diff changeset
286 uint items_written;
73b4c55700ec Fix in DirectoryDialog string convertion
Frank Benoit <benoit@tionex.de>
parents: 108
diff changeset
287 char* utf8Ptr = OS.g_filename_to_utf8 (fileNamePtr, -1, null, &items_written, null);
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
288 if (utf8Ptr !is null) {
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 126
diff changeset
289 String osAnswer = utf8Ptr[ 0 .. items_written ];
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
290 if (osAnswer.length !is 0) {
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
291 /* remove trailing separator, unless root directory */
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
292 if ( osAnswer != SEPARATOR && osAnswer[ $-1 .. $ ] == SEPARATOR ) {
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
293 osAnswer = osAnswer[ 0 .. $ - 1 ];
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
294 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
295 answer = filterPath = osAnswer.dup;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
296 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
297 OS.g_free (utf8Ptr);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
298 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
299 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
300 display.removeIdleProc ();
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
301 OS.gtk_widget_destroy (handle);
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
302 return answer;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
303 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
304 /**
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
305 * Sets the path that the dialog will use to filter
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
306 * the directories it shows to the argument, which may
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
307 * be null. If the string is null, then the operating
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
308 * system's default filter path will be used.
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
309 * <p>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
310 * Note that the path string is platform dependent.
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
311 * For convenience, either '/' or '\' can be used
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
312 * as a path separator.
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
313 * </p>
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
314 *
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
315 * @param string the filter path
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
316 */
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 126
diff changeset
317 public void setFilterPath (String string) {
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
318 filterPath = string.dup;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
319 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
320 /**
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
321 * Sets the dialog's message, which is a description of
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
322 * the purpose for which it was opened. This message will be
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
323 * visible on the dialog while it is open.
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
324 *
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
325 * @param string the message
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
326 *
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
327 */
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 126
diff changeset
328 public void setMessage (String string) {
255
5a30aa9820f3 removed tango.stdc.stringz imports and allow null for arrays and string arguments.
Frank Benoit <benoit@tionex.de>
parents: 240
diff changeset
329 // DWT extension: allow null for zero length string
5a30aa9820f3 removed tango.stdc.stringz imports and allow null for arrays and string arguments.
Frank Benoit <benoit@tionex.de>
parents: 240
diff changeset
330 //if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
78
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
331 message = string.dup;
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
332 }
3acb1029ed5c DirectoryDialog
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
333 }