Mercurial > projects > dwt-mac
comparison dwt/dnd/DragSourceEvent.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | 1a8b3cb347e0 |
children | d5f4a7c8aa74 |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 *******************************************************************************/ | 10 *******************************************************************************/ |
11 module dwt.dnd; | 11 module dwt.dnd.DragSourceEvent; |
12 | |
13 import dwt.dwthelper.utils; | |
12 | 14 |
13 import dwt.events.TypedEvent; | 15 import dwt.events.TypedEvent; |
14 import dwt.graphics.*; | 16 import dwt.graphics.Image; |
15 | 17 |
16 /** | 18 /** |
17 * The DragSourceEvent contains the event information passed in the methods of the DragSourceListener. | 19 * The DragSourceEvent contains the event information passed in the methods of the DragSourceListener. |
18 * | 20 * |
19 * @see DragSourceListener | 21 * @see DragSourceListener |
22 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> | |
20 */ | 23 */ |
21 public class DragSourceEvent : TypedEvent { | 24 public class DragSourceEvent extends TypedEvent { |
22 /** | 25 /** |
23 * The operation that was performed. | 26 * The operation that was performed. |
24 * @see DND#DROP_NONE | 27 * @see DND#DROP_NONE |
25 * @see DND#DROP_MOVE | 28 * @see DND#DROP_MOVE |
26 * @see DND#DROP_COPY | 29 * @see DND#DROP_COPY |
46 public bool doit; | 49 public bool doit; |
47 | 50 |
48 /** | 51 /** |
49 * In dragStart, the x coordinate (relative to the control) of the | 52 * In dragStart, the x coordinate (relative to the control) of the |
50 * position the mouse went down to start the drag. | 53 * position the mouse went down to start the drag. |
54 * | |
51 * @since 3.2 | 55 * @since 3.2 |
52 */ | 56 */ |
53 public int x; | 57 public int x; |
54 /** | 58 /** |
55 * In dragStart, the y coordinate (relative to the control) of the | 59 * In dragStart, the y coordinate (relative to the control) of the |
56 * position the mouse went down to start the drag . | 60 * position the mouse went down to start the drag. |
61 * | |
57 * @since 3.2 | 62 * @since 3.2 |
58 */ | 63 */ |
59 public int y; | 64 public int y; |
60 | 65 |
61 /** | 66 /** |
71 * | 76 * |
72 * @since 3.3 | 77 * @since 3.3 |
73 */ | 78 */ |
74 public Image image; | 79 public Image image; |
75 | 80 |
81 /** | |
82 * In dragStart, the x offset (relative to the image) where the drag source image will be displayed. | |
83 * | |
84 * @since 3.5 | |
85 */ | |
86 public int offsetX; | |
87 /** | |
88 * In dragStart, the y offset (relative to the image) where the drag source image will be displayed. | |
89 * | |
90 * @since 3.5 | |
91 */ | |
92 public int offsetY; | |
93 | |
76 static final long serialVersionUID = 3257002142513770808L; | 94 static final long serialVersionUID = 3257002142513770808L; |
77 | 95 |
78 /** | 96 /** |
79 * Constructs a new instance of this class based on the | 97 * Constructs a new instance of this class based on the |
80 * information in the given untyped event. | 98 * information in the given untyped event. |
81 * | 99 * |
82 * @param e the untyped event containing the information | 100 * @param e the untyped event containing the information |
83 */ | 101 */ |
84 public this(DNDEvent e) { | 102 public DragSourceEvent(DNDEvent e) { |
85 super(e); | 103 super(e); |
86 this.data = e.data; | 104 this.data = e.data; |
87 this.detail = e.detail; | 105 this.detail = e.detail; |
88 this.doit = e.doit; | 106 this.doit = e.doit; |
89 this.dataType = e.dataType; | 107 this.dataType = e.dataType; |
90 this.x = e.x; | 108 this.x = e.x; |
91 this.y = e.y; | 109 this.y = e.y; |
92 this.image = e.image; | 110 this.image = e.image; |
111 this.offsetX = e.offsetX; | |
112 this.offsetY = e.offsetY; | |
93 } | 113 } |
94 void updateEvent(DNDEvent e) { | 114 void updateEvent(DNDEvent e) { |
95 e.widget = this.widget; | 115 e.widget = this.widget; |
96 e.time = this.time; | 116 e.time = this.time; |
97 e.data = this.data; | 117 e.data = this.data; |
99 e.doit = this.doit; | 119 e.doit = this.doit; |
100 e.dataType = this.dataType; | 120 e.dataType = this.dataType; |
101 e.x = this.x; | 121 e.x = this.x; |
102 e.y = this.y; | 122 e.y = this.y; |
103 e.image = this.image; | 123 e.image = this.image; |
124 e.offsetX = this.offsetX; | |
125 e.offsetY = this.offsetY; | |
126 } | |
127 /** | |
128 * Returns a string containing a concise, human-readable | |
129 * description of the receiver. | |
130 * | |
131 * @return a string representation of the event | |
132 */ | |
133 public String toString() { | |
134 String string = super.toString (); | |
135 return string.substring (0, string.length() - 1) // remove trailing '}' | |
136 + " operation=" + detail | |
137 + " type=" + (dataType !is null ? dataType.type : 0) | |
138 + " doit=" + doit | |
139 + "}"; | |
104 } | 140 } |
105 } | 141 } |