Mercurial > projects > dwt-win
comparison dwt/dnd/DND.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 | 242e33c0e383 |
children | 36f5cb12e1a2 |
comparison
equal
deleted
inserted
replaced
211:ff59aeb96cac | 212:ab60f3309436 |
---|---|
16 import dwt.DWT; | 16 import dwt.DWT; |
17 import dwt.DWTError; | 17 import dwt.DWTError; |
18 import dwt.DWTException; | 18 import dwt.DWTException; |
19 | 19 |
20 import tango.util.Convert; | 20 import tango.util.Convert; |
21 import dwt.dwthelper.utils; | |
21 | 22 |
22 /** | 23 /** |
23 * | 24 * |
24 * Class DND contains all the constants used in defining a | 25 * Class DND contains all the constants used in defining a |
25 * DragSource or a DropTarget. | 26 * DragSource or a DropTarget. |
198 * @since 3.1 | 199 * @since 3.1 |
199 */ | 200 */ |
200 public static const int ERROR_INVALID_DATA = 2003; | 201 public static const int ERROR_INVALID_DATA = 2003; |
201 | 202 |
202 | 203 |
203 static const char[] INIT_DRAG_MESSAGE = "Cannot initialize Drag"; //$NON-NLS-1$ | 204 static const String INIT_DRAG_MESSAGE = "Cannot initialize Drag"; //$NON-NLS-1$ |
204 static const char[] INIT_DROP_MESSAGE = "Cannot initialize Drop"; //$NON-NLS-1$ | 205 static const String INIT_DROP_MESSAGE = "Cannot initialize Drop"; //$NON-NLS-1$ |
205 static const char[] CANNOT_SET_CLIPBOARD_MESSAGE = "Cannot set data in clipboard"; //$NON-NLS-1$ | 206 static const String CANNOT_SET_CLIPBOARD_MESSAGE = "Cannot set data in clipboard"; //$NON-NLS-1$ |
206 static const char[] INVALID_DATA_MESSAGE = "Data does not have correct format for type"; //$NON-NLS-1$ | 207 static const String INVALID_DATA_MESSAGE = "Data does not have correct format for type"; //$NON-NLS-1$ |
207 | 208 |
208 /** | 209 /** |
209 * Throws an appropriate exception based on the passed in error code. | 210 * Throws an appropriate exception based on the passed in error code. |
210 * | 211 * |
211 * @param code the DND error code | 212 * @param code the DND error code |
241 */ | 242 */ |
242 public static void error (int code, int hresult) { | 243 public static void error (int code, int hresult) { |
243 switch (code) { | 244 switch (code) { |
244 /* OS Failure/Limit (fatal, may occur only on some platforms) */ | 245 /* OS Failure/Limit (fatal, may occur only on some platforms) */ |
245 case DND.ERROR_CANNOT_INIT_DRAG:{ | 246 case DND.ERROR_CANNOT_INIT_DRAG:{ |
246 char[] msg = DND.INIT_DRAG_MESSAGE; | 247 String msg = DND.INIT_DRAG_MESSAGE; |
247 if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult); //$NON-NLS-1$ | 248 if (hresult !is 0) msg ~= " result = "~to!(String)(hresult); //$NON-NLS-1$ |
248 throw new DWTError (code, msg); | 249 throw new DWTError (code, msg); |
249 } | 250 } |
250 case DND.ERROR_CANNOT_INIT_DROP:{ | 251 case DND.ERROR_CANNOT_INIT_DROP:{ |
251 char[] msg = DND.INIT_DROP_MESSAGE; | 252 String msg = DND.INIT_DROP_MESSAGE; |
252 if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult); //$NON-NLS-1$ | 253 if (hresult !is 0) msg ~= " result = "~to!(String)(hresult); //$NON-NLS-1$ |
253 throw new DWTError (code, msg); | 254 throw new DWTError (code, msg); |
254 } | 255 } |
255 case DND.ERROR_CANNOT_SET_CLIPBOARD:{ | 256 case DND.ERROR_CANNOT_SET_CLIPBOARD:{ |
256 char[] msg = DND.CANNOT_SET_CLIPBOARD_MESSAGE; | 257 String msg = DND.CANNOT_SET_CLIPBOARD_MESSAGE; |
257 if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult); //$NON-NLS-1$ | 258 if (hresult !is 0) msg ~= " result = "~to!(String)(hresult); //$NON-NLS-1$ |
258 throw new DWTError (code, msg); | 259 throw new DWTError (code, msg); |
259 } | 260 } |
260 case DND.ERROR_INVALID_DATA:{ | 261 case DND.ERROR_INVALID_DATA:{ |
261 char[] msg = DND.INVALID_DATA_MESSAGE; | 262 String msg = DND.INVALID_DATA_MESSAGE; |
262 if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult); //$NON-NLS-1$ | 263 if (hresult !is 0) msg ~= " result = "~to!(String)(hresult); //$NON-NLS-1$ |
263 throw new DWTException (code, msg); | 264 throw new DWTException (code, msg); |
264 } | 265 } |
265 default: | 266 default: |
266 } | 267 } |
267 | 268 |