1 /*******************************************************************************
2 * Copyright (c) 2007, 2008 IBM Corporation and others.
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
9 * SPDX-License-Identifier: EPL-2.0
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.dnd;
16 import org.eclipse.swt.*;
17 import org.eclipse.swt.widgets.*;
20 * This class provides default implementations to display a drag source
21 * effect during a drag and drop operation. The current implementation
22 * does not provide any visual feedback.
24 * <p>The drag source effect has the same API as the
25 * <code>DragSourceAdapter</code> so that it can provide custom visual
26 * feedback when a <code>DragSourceEvent</code> occurs.
29 * <p>Classes that wish to provide their own drag source effect such as
30 * displaying a default source image during a drag can extend the <code>DragSourceEffect</code>
31 * class, override the <code>DragSourceAdapter.dragStart</code> method and set
32 * the field <code>DragSourceEvent.image</code> with their own image.
33 * The image should be disposed when <code>DragSourceAdapter.dragFinished</code> is called.
36 * @see DragSourceAdapter
37 * @see DragSourceEvent
38 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
42 public class DragSourceEffect extends DragSourceAdapter {
43 Control control = null;
46 * Creates a new <code>DragSourceEffect</code> to handle drag effect from the specified <code>Control</code>.
48 * @param control the <code>Control</code> that the user clicks on to initiate the drag
50 * @exception IllegalArgumentException <ul>
51 * <li>ERROR_NULL_ARGUMENT - if the control is null</li>
54 public DragSourceEffect(Control control) {
55 if (control == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
56 this.control = control;
60 * Returns the Control which is registered for this DragSourceEffect. This is the control that the
61 * user clicks in to initiate dragging.
63 * @return the Control which is registered for this DragSourceEffect
65 public Control getControl() {