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