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