KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > swt > dnd > DragSourceEvent


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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  *******************************************************************************/

11 package org.eclipse.swt.dnd;
12
13 import org.eclipse.swt.events.TypedEvent;
14 import org.eclipse.swt.graphics.*;
15
16 /**
17  * The DragSourceEvent contains the event information passed in the methods of the DragSourceListener.
18  *
19  * @see DragSourceListener
20  */

21 public class DragSourceEvent extends TypedEvent {
22     /**
23      * The operation that was performed.
24      * @see DND#DROP_NONE
25      * @see DND#DROP_MOVE
26      * @see DND#DROP_COPY
27      * @see DND#DROP_LINK
28      * @see DND#DROP_TARGET_MOVE
29      */

30     public int detail;
31     
32     /**
33      * In dragStart, the doit field determines if the drag and drop operation
34      * should proceed; in dragFinished, the doit field indicates whether
35      * the operation was performed successfully.
36      * <p></p>
37      * In dragStart:
38      * <p>Flag to determine if the drag and drop operation should proceed.
39      * The application can set this value to false to prevent the drag from starting.
40      * Set to true by default.</p>
41      *
42      * <p>In dragFinished:</p>
43      * <p>Flag to indicate if the operation was performed successfully.
44      * True if the operation was performed successfully.</p>
45      */

46     public boolean doit;
47
48     /**
49      * In dragStart, the x coordinate (relative to the control) of the
50      * position the mouse went down to start the drag.
51      * @since 3.2
52      */

53     public int x;
54     /**
55      * In dragStart, the y coordinate (relative to the control) of the
56      * position the mouse went down to start the drag .
57      * @since 3.2
58      */

59     public int y;
60     
61     /**
62      * The type of data requested.
63      * Data provided in the data field must be of the same type.
64      */

65     public TransferData dataType;
66     
67     /**
68      * The drag source image to be displayed during the drag.
69      * <p>A value of null indicates that no drag image will be displayed.</p>
70      * <p>The default value is null.</p>
71      *
72      * @since 3.3
73      */

74     public Image image;
75
76     static final long serialVersionUID = 3257002142513770808L;
77     
78 /**
79  * Constructs a new instance of this class based on the
80  * information in the given untyped event.
81  *
82  * @param e the untyped event containing the information
83  */

84 public DragSourceEvent(DNDEvent e) {
85     super(e);
86     this.data = e.data;
87     this.detail = e.detail;
88     this.doit = e.doit;
89     this.dataType = e.dataType;
90     this.x = e.x;
91     this.y = e.y;
92     this.image = e.image;
93 }
94 void updateEvent(DNDEvent e) {
95     e.widget = this.widget;
96     e.time = this.time;
97     e.data = this.data;
98     e.detail = this.detail;
99     e.doit = this.doit;
100     e.dataType = this.dataType;
101     e.x = this.x;
102     e.y = this.y;
103     e.image = this.image;
104 }
105 }
106
Popular Tags