Mercurial > projects > dwt-win
comparison dwt/dnd/FileTransfer.d @ 212:ab60f3309436
reverted the char[] to String and use the an alias.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 05 May 2008 00:12:38 +0200 |
parents | b479f7e2f431 |
children | fd9c62a2998e |
comparison
equal
deleted
inserted
replaced
211:ff59aeb96cac | 212:ab60f3309436 |
---|---|
44 * </code></pre> | 44 * </code></pre> |
45 */ | 45 */ |
46 public class FileTransfer : ByteArrayTransfer { | 46 public class FileTransfer : ByteArrayTransfer { |
47 | 47 |
48 private static FileTransfer _instance; | 48 private static FileTransfer _instance; |
49 private static final char[] CF_HDROP = "CF_HDROP "; //$NON-NLS-1$ | 49 private static final String CF_HDROP = "CF_HDROP "; //$NON-NLS-1$ |
50 private static final int CF_HDROPID = COM.CF_HDROP; | 50 private static final int CF_HDROPID = COM.CF_HDROP; |
51 private static final char[] CF_HDROP_SEPARATOR = "\0"; //$NON-NLS-1$ | 51 private static final String CF_HDROP_SEPARATOR = "\0"; //$NON-NLS-1$ |
52 | 52 |
53 private this() {} | 53 private this() {} |
54 | 54 |
55 /** | 55 /** |
56 * Returns the singleton instance of the FileTransfer class. | 56 * Returns the singleton instance of the FileTransfer class. |
82 */ | 82 */ |
83 public void javaToNative(Object object, TransferData transferData) { | 83 public void javaToNative(Object object, TransferData transferData) { |
84 if (!checkFile(object) || !isSupportedType(transferData)) { | 84 if (!checkFile(object) || !isSupportedType(transferData)) { |
85 DND.error(DND.ERROR_INVALID_DATA); | 85 DND.error(DND.ERROR_INVALID_DATA); |
86 } | 86 } |
87 char[][] fileNames; | 87 String[] fileNames; |
88 if( auto strs = cast(ArrayWrapperString2) object ){ | 88 if( auto strs = cast(ArrayWrapperString2) object ){ |
89 fileNames = strs.array; | 89 fileNames = strs.array; |
90 } | 90 } |
91 StringBuffer allFiles = new StringBuffer(); | 91 StringBuffer allFiles = new StringBuffer(); |
92 for (int i = 0; i < fileNames.length; i++) { | 92 for (int i = 0; i < fileNames.length; i++) { |
140 transferData.result = dataObject.GetData(formatetc, stgmedium); | 140 transferData.result = dataObject.GetData(formatetc, stgmedium); |
141 dataObject.Release(); | 141 dataObject.Release(); |
142 if (transferData.result !is COM.S_OK) return null; | 142 if (transferData.result !is COM.S_OK) return null; |
143 // How many files are there? | 143 // How many files are there? |
144 int count = OS.DragQueryFile(stgmedium.unionField, 0xFFFFFFFF, null, 0); | 144 int count = OS.DragQueryFile(stgmedium.unionField, 0xFFFFFFFF, null, 0); |
145 char[][] fileNames = new char[][](count); | 145 String[] fileNames = new String[](count); |
146 for (int i = 0; i < count; i++) { | 146 for (int i = 0; i < count; i++) { |
147 // How long is the name ? | 147 // How long is the name ? |
148 int size = OS.DragQueryFile(stgmedium.unionField, i, null, 0) + 1; | 148 int size = OS.DragQueryFile(stgmedium.unionField, i, null, 0) + 1; |
149 TCHAR[] lpszFile = NewTCHARs(0, size); | 149 TCHAR[] lpszFile = NewTCHARs(0, size); |
150 // Get file name and append it to string | 150 // Get file name and append it to string |
157 | 157 |
158 protected int[] getTypeIds(){ | 158 protected int[] getTypeIds(){ |
159 return [CF_HDROPID]; | 159 return [CF_HDROPID]; |
160 } | 160 } |
161 | 161 |
162 protected char[][] getTypeNames(){ | 162 protected String[] getTypeNames(){ |
163 return [CF_HDROP]; | 163 return [CF_HDROP]; |
164 } | 164 } |
165 bool checkFile(Object object) { | 165 bool checkFile(Object object) { |
166 char[][] strings; | 166 String[] strings; |
167 if( auto strs = cast(ArrayWrapperString2)object ){ | 167 if( auto strs = cast(ArrayWrapperString2)object ){ |
168 strings = strs.array; | 168 strings = strs.array; |
169 } | 169 } |
170 if (!strings) return false; | 170 if (!strings) return false; |
171 for (int i = 0; i < strings.length; i++) { | 171 for (int i = 0; i < strings.length; i++) { |