Changeset 213:36f5cb12e1a2 for dwt/dnd/DragSource.d
- Timestamp:
- 05/17/08 11:34:28 (8 months ago)
- Files:
-
- dwt/dnd/DragSource.d (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwt/dnd/DragSource.d
r212 r213 143 143 144 144 static const String DEFAULT_DRAG_SOURCE_EFFECT = "DEFAULT_DRAG_SOURCE_EFFECT"; //$NON-NLS-1$ 145 static const String DRAGSOURCEID = "DragSource"; //$NON-NLS-1$146 145 static const int CFSTR_PERFORMEDDROPEFFECT; 147 146 static final TCHAR[] WindowClass = "#32770\0"; … … 181 180 super(control, checkStyle(style)); 182 181 this.control = control; 183 if (control.getData(D RAGSOURCEID) !is null) {182 if (control.getData(DND.DRAG_SOURCE_KEY) !is null) { 184 183 DND.error(DND.ERROR_CANNOT_INIT_DRAG); 185 184 } 186 control.setData(D RAGSOURCEID, this);185 control.setData(DND.DRAG_SOURCE_KEY, this); 187 186 createCOMInterfaces(); 188 187 this.AddRef(); … … 252 251 * 253 252 * @see DragSourceListener 253 * @see #getDragListeners 254 254 * @see #removeDragListener 255 255 * @see DragSourceEvent … … 303 303 String key = "dwt.internal.win32.runMessagesInIdle"; //$NON-NLS-1$ 304 304 Object oldValue = display.getData(key); 305 display.setData(key, new ValueWrapperBool(true));305 display.setData(key, new Boolean(true)); 306 306 ImageList imagelist = null; 307 307 Image image = event.image; … … 476 476 477 477 /** 478 * Returns an array of listeners who will be notified when a drag and drop 479 * operation is in progress, by sending it one of the messages defined in 480 * the <code>DragSourceListener</code> interface. 481 * 482 * @exception DWTException <ul> 483 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 484 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 485 * </ul> 486 * 487 * @see DragSourceListener 488 * @see #addDragListener 489 * @see #removeDragListener 490 * @see DragSourceEvent 491 * 492 * @since 3.4 493 */ 494 public DragSourceListener[] getDragListeners() { 495 Listener[] listeners = getListeners(DND.DragStart); 496 int length = listeners.length; 497 DragSourceListener[] dragListeners = new DragSourceListener[length]; 498 int count = 0; 499 for (int i = 0; i < length; i++) { 500 Listener listener = listeners[i]; 501 if ( auto l = cast(DNDListener)listener ) { 502 dragListeners[count] = cast(DragSourceListener) (l.getEventListener()); 503 count++; 504 } 505 } 506 if (count is length) return dragListeners; 507 DragSourceListener[] result = new DragSourceListener[count]; 508 SimpleType!(DragSourceListener).arraycopy(dragListeners, 0, result, 0, count); 509 return result; 510 } 511 512 /** 478 513 * Returns the drag effect that is registered for this DragSource. This drag 479 514 * effect will be used during a drag and drop operation. … … 537 572 } 538 573 controlListener = null; 539 control.setData(D RAGSOURCEID, null);574 control.setData(DND.DRAG_SOURCE_KEY, null); 540 575 control = null; 541 576 transferAgents = null; … … 636 671 * @see DragSourceListener 637 672 * @see #addDragListener 673 * @see #getDragListeners 638 674 */ 639 675 public void removeDragListener(DragSourceListener listener) { … … 651 687 STGMEDIUM* stgmedium = new STGMEDIUM(); 652 688 COM.MoveMemory(stgmedium, pmedium,STGMEDIUM.sizeof); 689 //TODO - this should be GlobalLock() 653 690 int[1] ptrEffect; 654 691 OS.MoveMemory(ptrEffect.ptr, stgmedium.unionField,4);
