1 /******************************************************************************* 2 * Copyright (c) 2000, 2003 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.swt.dnd; 12 13 import org.eclipse.swt.internal.SWTEventListener; 14 15 /** 16 * The <code>DragSourceListener</code> class provides event notification to the application for DragSource events. 17 * 18 * <p>When the user drops data on a <code>DropTarget</code>, the application which defines the <code>DragSource</code> 19 * must provide the dropped data by implementing <code>dragSetData</code>. In the dragSetData, the application 20 * must support all the data types that were specified in the DragSource#setTransfer method.</p> 21 * 22 * <p>After the drop has completed successfully or has been aborted, the application which defines the 23 * <code>DragSource</code> is required to take the appropriate cleanup action. In the case of a successful 24 * <b>move</b> operation, the application must remove the data that was transferred.</p> 25 * 26 */ 27 public interface DragSourceListener extends SWTEventListener { 28 29 /** 30 * The user has begun the actions required to drag the widget. This event gives the application 31 * the chance to decide if a drag should be started. 32 * 33 * <p>The following fields in the DragSourceEvent apply: 34 * <ul> 35 * <li>(in)widget 36 * <li>(in)time 37 * <li>(in,out)doit 38 * </ul></p> 39 * 40 * @param event the information associated with the drag start event 41 * 42 * @see DragSourceEvent 43 */ 44 public void dragStart(DragSourceEvent event); 45 46 /** 47 * The data is required from the drag source. 48 * 49 * <p>The following fields in the DragSourceEvent apply: 50 * <ul> 51 * <li>(in)widget 52 * <li>(in)time 53 * <li>(in)dataType - the type of data requested. 54 * <li>(out)data - the application inserts the actual data here (must match the dataType) 55 * </ul></p> 56 * 57 * @param event the information associated with the drag set data event 58 * 59 * @see DragSourceEvent 60 */ 61 public void dragSetData(DragSourceEvent event); 62 63 /** 64 * The drop has successfully completed(mouse up over a valid target) or has been terminated (such as hitting 65 * the ESC key). Perform cleanup such as removing data from the source side on a successful move operation. 66 * 67 * <p>The following fields in the DragSourceEvent apply: 68 * <ul> 69 * <li>(in)widget 70 * <li>(in)time 71 * <li>(in)doit 72 * <li>(in)detail 73 * </ul></p> 74 * 75 * @param event the information associated with the drag finished event 76 * 77 * @see DragSourceEvent 78 */ 79 public void dragFinished(DragSourceEvent event); 80 } 81