Skip to main content
summaryrefslogtreecommitdiffstats
blob: b4075892e5c8bc76c599b986e553d83725022d7c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package org.eclipse.swt.dnd;

/*
 * (c) Copyright IBM Corp. 2000, 2001.
 * All Rights Reserved
 */
import org.eclipse.swt.events.TypedEvent;
import org.eclipse.swt.widgets.Widget;

/**
 * The DropTargetEvent contains the event information passed in the methods of the DropTargetListener.
 * 
 * <p>When in dragEnter(), dragOver(), dragLeave(), dragOperationChanged(), dropAccept(), 
 * the following fields apply:
 * <ul>
 * <li>(in)widget        - the object on which the data will be dropped if the mouse is released
 * <li>(in)time          - the time the drop occurred
 * <li>(in)x             - the x-cordinate of the cursor relative to the DropTarget <code>Control</code>
 * <li>(in)y             - the y-cordinate of the cursor relative to the DropTarget <code>Control</code>
 * <li>(in)dataTypes     - a list of the types of data that the DragSource can support
 * <li>(in,out)currentDataType - the specific type of data that will be provided on a drop
 * <li>(in)operations    - a list of the operations that the DragSource can support (e.g. DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK)
 * <li>(in,out)detail   - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
 * </ul>
 * The application can change the operation that will be performed by modifying the <code>detail</code> field 
 * but the choice must be one of the values in the <code>operations</code> field.  
 * The application can also change the type of data being requested by modifying the <code>currentDataTypes</code>
 * field  but the value must be one of the values in the <code>dataTypes list</code>.</p>
 *
 * <p>When in drop(), the following fields apply:
 * <ul>
 * <li>(in)widget   - the object on which the data was dropped
 * <li>(in)time     - the time the drop occurred
 * <li>(in)x        - the x-cordinate of the cursor relative to the DropTarget <code>Control</code>
 * <li>(in)y        - the y-cordinate of the cursor relative to the DropTarget <code>Control</code>
 * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
 * <li>(in)currentDataType - the specific type of data that is be contained in the <code>data</code> field
 * <li>(in)data     - the data (which is of type currentDataType); the type Java Object contained in this field is
 *						dependant on the Transfer subclass.  For example, the TextTransfer subclass provides a
 *						String with the text in the String.  The FileTransfer object provides an array of String with
 *						each String in the array containing the full path of the file.
 * </ul>
 * The application can cancel the drop operation by setting the detail field to DND.DROP_NONE.</p>
 *
 */
public class DropTargetEvent extends TypedEvent {
	public int x;
	public int y;
	public int detail;
	/**
	 * A list of the operations that the DragSource can support 
	 * (e.g. DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK).
	 */
	public int operations;
	public int feedback;
	public Widget item;
	
	/*
	 * Platform specfic data.
	 */
	/**
	 * The type of data that will be dropped.
	 */
	public TransferData currentDataType;
	/**
	 * A list of the types of data that the DragSource is capable of providing.
	 * The currentDataType must be a member of this list.
	 */
	public TransferData[] dataTypes;

	
public DropTargetEvent(DNDEvent e) {
	super(e);
	this.data = e.data;
	this.x = e.x;
	this.y = e.y;
	this.detail = e.detail;
	this.currentDataType = e.dataType;
	this.dataTypes = e.dataTypes;
	this.operations = e.operations;
	this.feedback = e.feedback;
	this.item = e.item;
}
void updateEvent(DNDEvent e) {
	e.widget = this.widget;
	e.time = this.time;
	e.data = this.data;
	e.x = this.x;
	e.y = this.y;
	e.detail = this.detail;
	e.dataType = this.currentDataType;
	e.dataTypes = this.dataTypes;
	e.operations = this.operations;
	e.feedback = this.feedback;
	e.item = this.item;
}
}

Back to the top