108
|
1 /*******************************************************************************
|
259
|
2 * Copyright (c) 2000, 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.DragSourceEvent;
|
|
14
|
|
15
|
|
16 import dwt.events.TypedEvent;
|
|
17 import dwt.widgets.Event;
|
|
18 import dwt.graphics.Image;
|
|
19 import dwt.dnd.TransferData;
|
|
20 import dwt.dnd.DNDEvent;
|
|
21
|
|
22 /**
|
|
23 * The DragSourceEvent contains the event information passed in the methods of the DragSourceListener.
|
|
24 *
|
|
25 * @see DragSourceListener
|
259
|
26 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
|
92
|
27 */
|
|
28 public class DragSourceEvent : TypedEvent {
|
|
29 /**
|
|
30 * The operation that was performed.
|
|
31 * @see DND#DROP_NONE
|
|
32 * @see DND#DROP_MOVE
|
|
33 * @see DND#DROP_COPY
|
|
34 * @see DND#DROP_LINK
|
|
35 * @see DND#DROP_TARGET_MOVE
|
|
36 */
|
|
37 public int detail;
|
|
38
|
|
39 /**
|
|
40 * In dragStart, the doit field determines if the drag and drop operation
|
|
41 * should proceed; in dragFinished, the doit field indicates whether
|
|
42 * the operation was performed successfully.
|
|
43 * <p></p>
|
|
44 * In dragStart:
|
|
45 * <p>Flag to determine if the drag and drop operation should proceed.
|
|
46 * The application can set this value to false to prevent the drag from starting.
|
|
47 * Set to true by default.</p>
|
|
48 *
|
|
49 * <p>In dragFinished:</p>
|
|
50 * <p>Flag to indicate if the operation was performed successfully.
|
|
51 * True if the operation was performed successfully.</p>
|
|
52 */
|
|
53 public bool doit;
|
|
54
|
|
55 /**
|
|
56 * In dragStart, the x coordinate (relative to the control) of the
|
|
57 * position the mouse went down to start the drag.
|
|
58 * @since 3.2
|
|
59 */
|
|
60 public int x;
|
|
61 /**
|
|
62 * In dragStart, the y coordinate (relative to the control) of the
|
|
63 * position the mouse went down to start the drag .
|
|
64 * @since 3.2
|
|
65 */
|
|
66 public int y;
|
|
67
|
|
68 /**
|
|
69 * The type of data requested.
|
|
70 * Data provided in the data field must be of the same type.
|
|
71 */
|
|
72 public TransferData dataType;
|
|
73
|
|
74 /**
|
|
75 * The drag source image to be displayed during the drag.
|
|
76 * <p>A value of null indicates that no drag image will be displayed.</p>
|
|
77 * <p>The default value is null.</p>
|
|
78 *
|
|
79 * @since 3.3
|
|
80 */
|
|
81 public Image image;
|
|
82
|
|
83 static const long serialVersionUID = 3257002142513770808L;
|
|
84
|
|
85 /**
|
|
86 * Constructs a new instance of this class based on the
|
|
87 * information in the given untyped event.
|
|
88 *
|
|
89 * @param e the untyped event containing the information
|
|
90 */
|
|
91 public this(DNDEvent e) {
|
|
92 super( cast(Event) e );
|
|
93 this.data = e.data;
|
|
94 this.detail = e.detail;
|
|
95 this.doit = e.doit;
|
|
96 this.dataType = e.dataType;
|
|
97 this.x = e.x;
|
|
98 this.y = e.y;
|
|
99 this.image = e.image;
|
|
100 }
|
|
101 void updateEvent(DNDEvent e) {
|
|
102 e.widget = this.widget;
|
|
103 e.time = this.time;
|
|
104 e.data = this.data;
|
|
105 e.detail = this.detail;
|
|
106 e.doit = this.doit;
|
|
107 e.dataType = this.dataType;
|
|
108 e.x = this.x;
|
|
109 e.y = this.y;
|
|
110 e.image = this.image;
|
|
111 }
|
|
112 }
|