108
|
1 /*******************************************************************************
|
92
|
2 * Copyright (c) 2000, 2003 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
|
108
|
10 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
92
|
12 *******************************************************************************/
|
|
13 module dwt.dnd.DropTargetListener;
|
|
14
|
238
|
15 import dwt.dwthelper.utils;
|
|
16
|
92
|
17 import dwt.internal.DWTEventListener;
|
|
18 import dwt.dnd.DropTargetEvent;
|
|
19
|
|
20 /**
|
|
21 * The <code>DropTargetListener</code> class provides event notification to the application
|
|
22 * for DropTarget events.
|
|
23 *
|
|
24 * <p>As the user moves the cursor into, over and out of a Control that has been designated
|
|
25 * as a DropTarget, events indicate what operation can be performed and what data can be
|
|
26 * transferred if a drop where to occur at that point.
|
|
27 * The application can respond to these events and change the type of data that will
|
|
28 * be dropped by modifying event.currentDataType, or change the operation that will be performed
|
|
29 * by modifying the event.detail field or stop any drop from happening on the current target
|
|
30 * by setting the event.detail field to DND_DROP_NONE.</p>
|
|
31 *
|
|
32 * <p>When the user causes a drop to happen by releasing the mouse over a valid drop target,
|
|
33 * the application has one last chance to change the data type of the drop through the
|
|
34 * DropAccept event. If the drop is still allowed, the DropAccept event is immediately
|
|
35 * followed by the Drop event. In the Drop event, the application can still change the
|
|
36 * operation that is performed but the data type is fixed.</p>
|
|
37 *
|
|
38 * @see DropTargetEvent
|
|
39 *
|
|
40 */
|
|
41 public interface DropTargetListener : DWTEventListener {
|
|
42
|
|
43 /**
|
|
44 * The cursor has entered the drop target boundaries.
|
|
45 *
|
|
46 * <p>The following fields in the DropTargetEvent apply:
|
|
47 * <ul>
|
|
48 * <li>(in)widget
|
|
49 * <li>(in)time
|
|
50 * <li>(in)x
|
|
51 * <li>(in)y
|
|
52 * <li>(in)dataTypes
|
|
53 * <li>(in,out)currentDataType
|
|
54 * <li>(in)operations
|
|
55 * <li>(in,out)detail
|
|
56 * <li>(in,out)feedback
|
|
57 * </ul></p>
|
|
58 *
|
|
59 * <p>The <code>operation</code> value is determined by the modifier keys pressed by the user.
|
|
60 * If no keys are pressed the <code>event.detail</code> field is set to DND.DROP_DEFAULT.
|
|
61 * If the application does not set the <code>event.detail</code> to something other
|
|
62 * than <code>DND.DROP_DEFAULT</code> the operation will be set to the platform defined standard
|
|
63 * default.</p>
|
|
64 *
|
|
65 * <p>The <code>currentDataType</code> is determined by the first transfer agent specified in
|
|
66 * setTransfer() that matches a data type provided by the drag source.</p>
|
|
67 *
|
|
68 * <p>It is possible to get a DragEnter event when the drag source does not provide any matching data.
|
|
69 * In this case, the default operation is DND.DROP_NONE and the currentDataType is null.</p>
|
|
70 *
|
|
71 * <p>The application can change the operation that will be performed by modifying the
|
|
72 * <code>detail</code> field but the choice must be one of the values in the <code>operations</code>
|
|
73 * field or DND.DROP_NONE.</p>
|
|
74 *
|
|
75 * <p>The application can also change the type of data being requested by
|
|
76 * modifying the <code>currentDataTypes</code> field but the value must be one of the values
|
|
77 * in the <code>dataTypes</code> list.</p>
|
|
78 *
|
|
79 * @param event the information associated with the drag enter event
|
|
80 *
|
|
81 * @see DropTargetEvent
|
|
82 */
|
|
83 public void dragEnter(DropTargetEvent event);
|
|
84
|
|
85 /**
|
|
86 * The cursor has left the drop target boundaries OR the drop has been cancelled OR the data
|
|
87 * is about to be dropped.
|
|
88 *
|
|
89 * <p>The following fields in the DropTargetEvent apply:
|
|
90 * <ul>
|
|
91 * <li>(in)widget
|
|
92 * <li>(in)time
|
|
93 * <li>(in)x
|
|
94 * <li>(in)y
|
|
95 * <li>(in)dataTypes
|
|
96 * <li>(in)currentDataType
|
|
97 * <li>(in)operations
|
|
98 * <li>(in)detail
|
|
99 * </ul></p>
|
|
100 *
|
|
101 * @param event the information associated with the drag leave event
|
|
102 *
|
|
103 * @see DropTargetEvent
|
|
104 */
|
|
105 public void dragLeave(DropTargetEvent event);
|
|
106
|
|
107 /**
|
|
108 * The operation being performed has changed (usually due to the user changing the selected modifier key(s)
|
|
109 * while dragging).
|
|
110 *
|
|
111 * <p>The following fields in the DropTargetEvent apply:
|
|
112 * <ul>
|
|
113 * <li>(in)widget
|
|
114 * <li>(in)time
|
|
115 * <li>(in)x
|
|
116 * <li>(in)y
|
|
117 * <li>(in)dataTypes
|
|
118 * <li>(in,out)currentDataType
|
|
119 * <li>(in)operations
|
|
120 * <li>(in,out)detail
|
|
121 * <li>(in,out)feedback
|
|
122 * </ul></p>
|
|
123 *
|
|
124 * <p>The <code>operation</code> value is determined by the modifier keys pressed by the user.
|
|
125 * If no keys are pressed the <code>event.detail</code> field is set to DND.DROP_DEFAULT.
|
|
126 * If the application does not set the <code>event.detail</code> to something other than
|
|
127 * <code>DND.DROP_DEFAULT</code> the operation will be set to the platform defined standard default.</p>
|
|
128 *
|
|
129 * <p>The <code>currentDataType</code> value is determined by the value assigned to
|
|
130 * <code>currentDataType</code> in previous dragEnter and dragOver calls.</p>
|
|
131 *
|
|
132 * <p>The application can change the operation that will be performed by modifying the
|
|
133 * <code>detail</code> field but the choice must be one of the values in the <code>operations</code>
|
|
134 * field.</p>
|
|
135 *
|
|
136 * <p>The application can also change the type of data being requested by modifying
|
|
137 * the <code>currentDataTypes</code> field but the value must be one of the values in the
|
|
138 * <code>dataTypes</code> list.</p>
|
|
139 *
|
|
140 * @param event the information associated with the drag operation changed event
|
|
141 *
|
|
142 * @see DropTargetEvent
|
|
143 */
|
|
144 public void dragOperationChanged(DropTargetEvent event);
|
|
145
|
|
146 /**
|
|
147 * The cursor is moving over the drop target.
|
|
148 *
|
|
149 * <p>The following fields in the DropTargetEvent apply:
|
|
150 * <ul>
|
|
151 * <li>(in)widget
|
|
152 * <li>(in)time
|
|
153 * <li>(in)x
|
|
154 * <li>(in)y
|
|
155 * <li>(in)dataTypes
|
|
156 * <li>(in,out)currentDataType
|
|
157 * <li>(in)operations
|
|
158 * <li>(in,out)detail
|
|
159 * <li>(in,out)feedback
|
|
160 * </ul></p>
|
|
161 *
|
|
162 * <p>The <code>operation</code> value is determined by the value assigned to
|
|
163 * <code>currentDataType</code> in previous dragEnter and dragOver calls.</p>
|
|
164 *
|
|
165 * <p>The <code>currentDataType</code> value is determined by the value assigned to
|
|
166 * <code>currentDataType</code> in previous dragEnter and dragOver calls.</p>
|
|
167 *
|
|
168 * <p>The application can change the operation that will be performed by modifying the
|
|
169 * <code>detail</code> field but the choice must be one of the values in the <code>operations</code>
|
|
170 * field.</p>
|
|
171 *
|
|
172 * <p>The application can also change the type of data being requested by modifying the
|
|
173 * <code>currentDataTypes</code> field but the value must be one of the values in the
|
|
174 * <code>dataTypes</code> list.</p>
|
|
175 *
|
|
176 * <p>NOTE: At this point the <code>data</code> field is null. On some platforms, it is possible
|
|
177 * to obtain the data being transferred before the transfer occurs but in most platforms this is
|
|
178 * not possible. On those platforms where the data is available, the application can access the
|
|
179 * data as follows:</p>
|
|
180 *
|
|
181 * <pre><code>
|
|
182 * public void dragOver(DropTargetEvent event) {
|
|
183 * TextTransfer textTransfer = TextTransfer.getInstance();
|
|
184 * String data = (String)textTransfer.nativeToJava(event.currentDataType);
|
|
185 * if (data !is null) {
|
|
186 * System.out.println("Data to be dropped is (Text)"+data);
|
|
187 * }
|
|
188 * };
|
|
189 * </code></pre>
|
|
190 *
|
|
191 * @param event the information associated with the drag over event
|
|
192 *
|
|
193 * @see DropTargetEvent
|
|
194 */
|
|
195 public void dragOver(DropTargetEvent event);
|
|
196
|
|
197 /**
|
|
198 * The data is being dropped. The data field contains java format of the data being dropped.
|
|
199 * To determine the type of the data object, refer to the documentation for the Transfer subclass
|
|
200 * specified in event.currentDataType.
|
|
201 *
|
|
202 * <p>The following fields in DropTargetEvent apply:
|
|
203 * <ul>
|
|
204 * <li>(in)widget
|
|
205 * <li>(in)time
|
|
206 * <li>(in)x
|
|
207 * <li>(in)y
|
|
208 * <li>(in,out)detail
|
|
209 * <li>(in)currentDataType
|
|
210 * <li>(in)data
|
|
211 * </ul></p>
|
|
212 *
|
|
213 * <p>The application can refuse to perform the drop operation by setting the detail
|
|
214 * field to DND.DROP_NONE.</p>
|
|
215 *
|
|
216 * @param event the information associated with the drop event
|
|
217 *
|
|
218 * @see DropTargetEvent
|
|
219 */
|
|
220 public void drop(DropTargetEvent event);
|
|
221
|
|
222 /**
|
|
223 * The drop is about to be performed.
|
|
224 * The drop target is given a last chance to change the nature of the drop.
|
|
225 *
|
|
226 * <p>The following fields in the DropTargetEvent apply:
|
|
227 * <ul>
|
|
228 * <li>(in)widget
|
|
229 * <li>(in)time
|
|
230 * <li>(in)x
|
|
231 * <li>(in)y
|
|
232 * <li>(in)dataTypes
|
|
233 * <li>(in,out)currentDataType
|
|
234 * <li>(in)operations
|
|
235 * <li>(in,out)detail
|
|
236 * </ul></p>
|
|
237 *
|
|
238 * <p>The application can veto the drop by setting the <code>event.detail</code> field to
|
|
239 * <code>DND.DROP_NONE</code>.</p>
|
|
240 *
|
|
241 * <p>The application can change the operation that will be performed by modifying the
|
|
242 * <code>detail</code> field but the choice must be one of the values in the
|
|
243 * <code>operations</code> field.</p>
|
|
244 *
|
|
245 * <p>The application can also change the type of data being requested by modifying the
|
|
246 * <code>currentDataTypes</code> field but the value must be one of the values in the <
|
|
247 * code>dataTypes</code> list.</p>
|
|
248 *
|
|
249 * @param event the information associated with the drop accept event
|
|
250 *
|
|
251 * @see DropTargetEvent
|
|
252 */
|
|
253 public void dropAccept(DropTargetEvent event);
|
|
254
|
|
255 }
|