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