annotate dwt/widgets/DirectoryDialog.d @ 255:5a30aa9820f3

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