Changeset 213:36f5cb12e1a2 for dwt/dnd/DropTarget.d
- Timestamp:
- 05/17/08 11:34:28 (8 months ago)
- Files:
-
- dwt/dnd/DropTarget.d (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwt/dnd/DropTarget.d
r212 r213 16 16 import dwt.DWTError; 17 17 import dwt.DWTException; 18 import dwt.internal.C; 18 19 import dwt.internal.ole.win32.COM; 19 20 import dwt.internal.ole.win32.extras; … … 116 117 117 118 static final String DEFAULT_DROP_TARGET_EFFECT = "DEFAULT_DROP_TARGET_EFFECT"; //$NON-NLS-1$ 118 static final String DROPTARGETID = "DropTarget"; //$NON-NLS-1$119 119 120 120 /** … … 152 152 super (control, checkStyle(style)); 153 153 this.control = control; 154 if (control.getData(D ROPTARGETID) !is null) {154 if (control.getData(DND.DROP_TARGET_KEY) !is null) { 155 155 DND.error(DND.ERROR_CANNOT_INIT_DROP); 156 156 } 157 control.setData(D ROPTARGETID, this);157 control.setData(DND.DROP_TARGET_KEY, this); 158 158 createCOMInterfaces(); 159 159 this.AddRef(); … … 223 223 * 224 224 * @see DropTargetListener 225 * @see #getDropListeners 225 226 * @see #removeDropListener 226 227 * @see DropTargetEvent … … 260 261 } 261 262 263 int DragEnter_64(IDataObject pDataObject, DWORD grfKeyState, long pt, DWORD* pdwEffect) { 264 POINTL point; 265 OS.MoveMemory( &point, &pt, 8); 266 return DragEnter(pDataObject, grfKeyState, point, pdwEffect); 267 } 268 262 269 HRESULT DragEnter(IDataObject pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) { 263 270 selectedDataType = null; … … 319 326 } 320 327 328 int DragOver_64(int grfKeyState, long pt, DWORD* pdwEffect) { 329 POINTL point; 330 OS.MoveMemory(&point, &pt, 8); 331 return DragOver(grfKeyState, point, pdwEffect); 332 } 333 321 334 HRESULT DragOver(int grfKeyState, POINTL pt, DWORD* pdwEffect) { 322 335 if (iDataObject is null) return COM.S_FALSE; … … 363 376 *pdwEffect = opToOs(selectedOperation); 364 377 return COM.S_OK; 378 } 379 380 int Drop_64(IDataObject pDataObject, int grfKeyState, long pt, DWORD* pdwEffect) { 381 POINTL point; 382 OS.MoveMemory(&point, &pt, 8); 383 return Drop(pDataObject, grfKeyState, point, pdwEffect); 365 384 } 366 385 … … 451 470 452 471 /** 472 * Returns an array of listeners who will be notified when a drag and drop 473 * operation is in progress, by sending it one of the messages defined in 474 * the <code>DropTargetListener</code> interface. 475 * 476 * @exception DWTException <ul> 477 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 478 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 479 * </ul> 480 * 481 * @see DropTargetListener 482 * @see #addDropListener 483 * @see #removeDropListener 484 * @see DropTargetEvent 485 * 486 * @since 3.4 487 */ 488 public DropTargetListener[] getDropListeners() { 489 Listener[] listeners = getListeners(DND.DragEnter); 490 int length = listeners.length; 491 DropTargetListener[] dropListeners = new DropTargetListener[length]; 492 int count = 0; 493 for (int i = 0; i < length; i++) { 494 Listener listener = listeners[i]; 495 if (auto l = cast(DNDListener)listener ) { 496 dropListeners[count] = cast(DropTargetListener) (l.getEventListener()); 497 count++; 498 } 499 } 500 if (count is length) return dropListeners; 501 DropTargetListener[] result = new DropTargetListener[count]; 502 SimpleType!(DropTargetListener).arraycopy(dropListeners, 0, result, 0, count); 503 return result; 504 } 505 506 /** 453 507 * Returns the drop effect for this DropTarget. This drop effect will be 454 508 * used during a drag and drop to display the drag under effect on the … … 494 548 control.removeListener(DWT.Dispose, controlListener); 495 549 controlListener = null; 496 control.setData(D ROPTARGETID, null);550 control.setData(DND.DROP_TARGET_KEY, null); 497 551 transferAgents = null; 498 552 control = null; … … 589 643 * @see DropTargetListener 590 644 * @see #addDropListener 645 * @see #getDropListeners 591 646 */ 592 647 public void removeDropListener(DropTargetListener listener) {
