]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/dnd/DragSourceEffect.java
Work around SWT 4.13 - 4.18 Win32 DnD bug 567422
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / dnd / DragSourceEffect.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2008 IBM Corporation and others.
3  *
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/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.dnd;
15
16 import org.eclipse.swt.*;
17 import org.eclipse.swt.widgets.*;
18
19 /**
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.
23  *
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.
27  * </p>
28  *
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.
34  * </p>
35  *
36  * @see DragSourceAdapter
37  * @see DragSourceEvent
38  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
39  *
40  * @since 3.3
41  */
42 public class DragSourceEffect extends DragSourceAdapter {
43         Control control = null;
44
45         /**
46          * Creates a new <code>DragSourceEffect</code> to handle drag effect from the specified <code>Control</code>.
47          *
48          * @param control the <code>Control</code> that the user clicks on to initiate the drag
49          *
50          * @exception IllegalArgumentException <ul>
51          *    <li>ERROR_NULL_ARGUMENT - if the control is null</li>
52          * </ul>
53          */
54         public DragSourceEffect(Control control) {
55                 if (control == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
56                 this.control = control;
57         }
58
59         /**
60          * Returns the Control which is registered for this DragSourceEffect.  This is the control that the
61          * user clicks in to initiate dragging.
62          *
63          * @return the Control which is registered for this DragSourceEffect
64          */
65         public Control getControl() {
66                 return control;
67         }
68 }