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.DropTargetEvent;
14 
15 import java.lang.all;
16 
17 
18 import org.eclipse.swt.events.TypedEvent;
19 import org.eclipse.swt.widgets.Widget;
20 import org.eclipse.swt.dnd.TransferData;
21 import org.eclipse.swt.dnd.DNDEvent;
22 import org.eclipse.swt.widgets.Event;
23 
24 /**
25  * The DropTargetEvent contains the event information passed in the methods of the DropTargetListener.
26  *
27  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
28  */
29 public class DropTargetEvent : TypedEvent {
30     /**
31      * The x-cordinate of the cursor relative to the <code>Display</code>
32      */
33     public int x;
34 
35     /**
36      * The y-cordinate of the cursor relative to the <code>Display</code>
37      */
38     public int y;
39 
40     /**
41      * The operation being performed.
42      * @see DND#DROP_NONE
43      * @see DND#DROP_MOVE
44      * @see DND#DROP_COPY
45      * @see DND#DROP_LINK
46      */
47     public int detail;
48 
49     /**
50      * A bitwise OR'ing of the operations that the DragSource can support
51      * (e.g. DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK).
52      * The detail value must be a member of this list or DND.DROP_NONE.
53      * @see DND#DROP_NONE
54      * @see DND#DROP_MOVE
55      * @see DND#DROP_COPY
56      * @see DND#DROP_LINK
57      */
58     public int operations;
59 
60     /**
61      * A bitwise OR'ing of the drag under effect feedback to be displayed to the user
62      * (e.g. DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND).
63      * <p>A value of DND.FEEDBACK_NONE indicates that no drag under effect will be displayed.</p>
64      * <p>Feedback effects will only be applied if they are applicable.</p>
65      * <p>The default value is DND.FEEDBACK_SELECT.</p>
66      * @see DND#FEEDBACK_NONE
67      * @see DND#FEEDBACK_SELECT
68      * @see DND#FEEDBACK_INSERT_BEFORE
69      * @see DND#FEEDBACK_INSERT_AFTER
70      * @see DND#FEEDBACK_SCROLL
71      * @see DND#FEEDBACK_EXPAND
72      */
73     public int feedback;
74 
75     /**
76      * If the associated control is a table or tree, this field contains the item located
77      * at the cursor coordinates.
78      */
79     public Widget item;
80 
81     /**
82      * The type of data that will be dropped.
83      */
84     public TransferData currentDataType;
85 
86     /**
87      * A list of the types of data that the DragSource is capable of providing.
88      * The currentDataType must be a member of this list.
89      */
90     public TransferData[] dataTypes;
91 
92     static const long serialVersionUID = 3256727264573338678L;
93 
94 /**
95  * Constructs a new instance of this class based on the
96  * information in the given untyped event.
97  *
98  * @param e the untyped event containing the information
99  */
100 public this(DNDEvent e) {
101     super(cast(Event)e);
102     this.data = e.data;
103     this.x = e.x;
104     this.y = e.y;
105     this.detail = e.detail;
106     this.currentDataType = e.dataType;
107     this.dataTypes = e.dataTypes;
108     this.operations = e.operations;
109     this.feedback = e.feedback;
110     this.item = e.item;
111 }
112 void updateEvent(DNDEvent e) {
113     e.widget = this.widget;
114     e.time = this.time;
115     e.data = this.data;
116     e.x = this.x;
117     e.y = this.y;
118     e.detail = this.detail;
119     e.dataType = this.currentDataType;
120     e.dataTypes = this.dataTypes;
121     e.operations = this.operations;
122     e.feedback = this.feedback;
123     e.item = this.item;
124 }
125 }