comparison dwt/dnd/DropTargetEvent.d @ 102:1c12673c65ca

Ported dwt.dnd.DropTargetEvent
author Jacob Carlborg <doob@me.com>
date Wed, 31 Dec 2008 13:24:24 +0100
parents d8635bb48c7c
children 2e671fa40eec
comparison
equal deleted inserted replaced
101:43123e716bda 102:1c12673c65ca
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 *
11 * Port to the D programming language:
12 * Jacob Carlborg <doob@me.com>
10 *******************************************************************************/ 13 *******************************************************************************/
11 module dwt.dnd.DropTargetEvent; 14 module dwt.dnd.DropTargetEvent;
12 15
13 import dwt.dwthelper.utils; 16 import dwt.dwthelper.utils;
14 17
15 import dwt.events.TypedEvent; 18 import dwt.events.TypedEvent;
16 import dwt.widgets.Widget; 19 import dwt.widgets.Widget;
17 20
21 import dwt.dnd.DNDEvent;
22 import dwt.dnd.TransferData;
23
18 /** 24 /**
19 * The DropTargetEvent contains the event information passed in the methods of the DropTargetListener. 25 * The DropTargetEvent contains the event information passed in the methods of the DropTargetListener.
20 * 26 *
21 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> 27 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
22 */ 28 */
23 public class DropTargetEvent extends TypedEvent { 29 public class DropTargetEvent : TypedEvent {
24 /** 30 /**
25 * The x-cordinate of the cursor relative to the <code>Display</code> 31 * The x-cordinate of the cursor relative to the <code>Display</code>
26 */ 32 */
27 public int x; 33 public int x;
28 34
81 * A list of the types of data that the DragSource is capable of providing. 87 * A list of the types of data that the DragSource is capable of providing.
82 * The currentDataType must be a member of this list. 88 * The currentDataType must be a member of this list.
83 */ 89 */
84 public TransferData[] dataTypes; 90 public TransferData[] dataTypes;
85 91
86 static final long serialVersionUID = 3256727264573338678L; 92 static const long serialVersionUID = 3256727264573338678L;
87 93
88 /** 94 /**
89 * Constructs a new instance of this class based on the 95 * Constructs a new instance of this class based on the
90 * information in the given untyped event. 96 * information in the given untyped event.
91 * 97 *
92 * @param e the untyped event containing the information 98 * @param e the untyped event containing the information
93 */ 99 */
94 public DropTargetEvent(DNDEvent e) { 100 public this(DNDEvent e) {
95 super(e); 101 super(e);
96 this.data = e.data; 102 this.data = e.data;
97 this.x = e.x; 103 this.x = e.x;
98 this.y = e.y; 104 this.y = e.y;
99 this.detail = e.detail; 105 this.detail = e.detail;
126 String string = super.toString (); 132 String string = super.toString ();
127 StringBuffer sb = new StringBuffer(); 133 StringBuffer sb = new StringBuffer();
128 sb.append(string.substring (0, string.length() - 1)); // remove trailing '}' 134 sb.append(string.substring (0, string.length() - 1)); // remove trailing '}'
129 sb.append(" x="); sb.append(x); 135 sb.append(" x="); sb.append(x);
130 sb.append(" y="); sb.append(y); 136 sb.append(" y="); sb.append(y);
131 sb.append(" item="); sb.append(item); 137 sb.append(" item="); sb.append(item.toString);
132 sb.append(" operations="); sb.append(operations); 138 sb.append(" operations="); sb.append(operations);
133 sb.append(" operation="); sb.append(detail); 139 sb.append(" operation="); sb.append(detail);
134 sb.append(" feedback="); sb.append(feedback); 140 sb.append(" feedback="); sb.append(feedback);
135 sb.append(" dataTypes={ "); 141 sb.append(" dataTypes={ ");
136 if (dataTypes !is null) { 142 if (dataTypes !is null) {