1 /*******************************************************************************
2 * Copyright (c) 2007, 2008 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 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/13 moduleorg.eclipse.swt.dnd.DragSourceEffect;
14 15 importjava.lang.all;
16 17 18 importorg.eclipse.swt.SWT;
19 importorg.eclipse.swt.widgets.Control;
20 importorg.eclipse.swt.dnd.DragSourceAdapter;
21 22 /**
23 * This class provides default implementations to display a drag source
24 * effect during a drag and drop operation. The current implementation
25 * does not provide any visual feedback.
26 *
27 * <p>The drag source effect has the same API as the
28 * <code>DragSourceAdapter</code> so that it can provide custom visual
29 * feedback when a <code>DragSourceEvent</code> occurs.
30 * </p>
31 *
32 * <p>Classes that wish to provide their own drag source effect such as
33 * displaying a default source image during a drag can extend the <code>DragSourceEffect</code>
34 * class, override the <code>DragSourceAdapter.dragStart</code> method and set
35 * the field <code>DragSourceEvent.image</code> with their own image.
36 * The image should be disposed when <code>DragSourceAdapter.dragFinished</code> is called.
37 * </p>
38 *
39 * @see DragSourceAdapter
40 * @see DragSourceEvent
41 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
42 *
43 * @since 3.3
44 */45 publicclassDragSourceEffect : DragSourceAdapter {
46 Controlcontrol = null;
47 48 /**
49 * Creates a new <code>DragSourceEffect</code> to handle drag effect from the specified <code>Control</code>.
50 *
51 * @param control the <code>Control</code> that the user clicks on to initiate the drag
52 *
53 * @exception IllegalArgumentException <ul>
54 * <li>ERROR_NULL_ARGUMENT - if the control is null</li>
55 * </ul>
56 */57 publicthis(Controlcontrol) {
58 if (controlisnull) SWT.error(SWT.ERROR_NULL_ARGUMENT);
59 this.control = control;
60 }
61 62 /**
63 * Returns the Control which is registered for this DragSourceEffect. This is the control that the
64 * user clicks in to initiate dragging.
65 *
66 * @return the Control which is registered for this DragSourceEffect
67 */68 publicControlgetControl() {
69 returncontrol;
70 }
71 }