comparison dwt/dnd/DropTargetEvent.d @ 135:242e33c0e383

Added dnd source, ByteArrayTransfer,Clipboard completed
author Frank Benoit <benoit@tionex.de>
date Wed, 13 Feb 2008 04:51:22 +0100
parents
children fd9c62a2998e
comparison
equal deleted inserted replaced
134:fa7d7d66b9ed 135:242e33c0e383
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 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
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.
24 */
25 public class DropTargetEvent : TypedEvent {
26 /**
27 * The x-cordinate of the cursor relative to the <code>Display</code>
28 */
29 public int x;
30
31 /**
32 * The y-cordinate of the cursor relative to the <code>Display</code>
33 */
34 public int y;
35
36 /**
37 * The operation being performed.
38 * @see DND#DROP_NONE
39 * @see DND#DROP_MOVE
40 * @see DND#DROP_COPY
41 * @see DND#DROP_LINK
42 */
43 public int detail;
44
45 /**
46 * A bitwise OR'ing of the operations that the DragSource can support
47 * (e.g. DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK).
48 * The detail value must be a member of this list or DND.DROP_NONE.
49 * @see DND#DROP_NONE
50 * @see DND#DROP_MOVE
51 * @see DND#DROP_COPY
52 * @see DND#DROP_LINK
53 */
54 public int operations;
55
56 /**
57 * A bitwise OR'ing of the drag under effect feedback to be displayed to the user
58 * (e.g. DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND).
59 * <p>A value of DND.FEEDBACK_NONE indicates that no drag under effect will be displayed.</p>
60 * <p>Feedback effects will only be applied if they are applicable.</p>
61 * <p>The default value is DND.FEEDBACK_SELECT.</p>
62 * @see DND#FEEDBACK_NONE
63 * @see DND#FEEDBACK_SELECT
64 * @see DND#FEEDBACK_INSERT_BEFORE
65 * @see DND#FEEDBACK_INSERT_AFTER
66 * @see DND#FEEDBACK_SCROLL
67 * @see DND#FEEDBACK_EXPAND
68 */
69 public int feedback;
70
71 /**
72 * If the associated control is a table or tree, this field contains the item located
73 * at the cursor coordinates.
74 */
75 public Widget item;
76
77 /**
78 * The type of data that will be dropped.
79 */
80 public TransferData currentDataType;
81
82 /**
83 * A list of the types of data that the DragSource is capable of providing.
84 * The currentDataType must be a member of this list.
85 */
86 public TransferData[] dataTypes;
87
88 static const long serialVersionUID = 3256727264573338678L;
89
90 /**
91 * Constructs a new instance of this class based on the
92 * information in the given untyped event.
93 *
94 * @param e the untyped event containing the information
95 */
96 public this(DNDEvent e) {
97 super(cast(Event)e);
98 this.data = e.data;
99 this.x = e.x;
100 this.y = e.y;
101 this.detail = e.detail;
102 this.currentDataType = e.dataType;
103 this.dataTypes = e.dataTypes;
104 this.operations = e.operations;
105 this.feedback = e.feedback;
106 this.item = e.item;
107 }
108 void updateEvent(DNDEvent e) {
109 e.widget = this.widget;
110 e.time = this.time;
111 e.data = this.data;
112 e.x = this.x;
113 e.y = this.y;
114 e.detail = this.detail;
115 e.dataType = this.currentDataType;
116 e.dataTypes = this.dataTypes;
117 e.operations = this.operations;
118 e.feedback = this.feedback;
119 e.item = this.item;
120 }
121 }