Mercurial > projects > dwt-mac
comparison dwt/dnd/DropTargetEvent.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 | 1c12673c65ca |
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.DropTargetEvent; |
12 | |
13 import dwt.dwthelper.utils; | |
12 | 14 |
13 import dwt.events.TypedEvent; | 15 import dwt.events.TypedEvent; |
14 import dwt.widgets.Widget; | 16 import dwt.widgets.Widget; |
15 | 17 |
16 /** | 18 /** |
17 * The DropTargetEvent contains the event information passed in the methods of the DropTargetListener. | 19 * The DropTargetEvent contains the event information passed in the methods of the DropTargetListener. |
20 * | |
21 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> | |
18 */ | 22 */ |
19 public class DropTargetEvent : TypedEvent { | 23 public class DropTargetEvent extends TypedEvent { |
20 /** | 24 /** |
21 * The x-cordinate of the cursor relative to the <code>Display</code> | 25 * The x-cordinate of the cursor relative to the <code>Display</code> |
22 */ | 26 */ |
23 public int x; | 27 public int x; |
24 | 28 |
85 * Constructs a new instance of this class based on the | 89 * Constructs a new instance of this class based on the |
86 * information in the given untyped event. | 90 * information in the given untyped event. |
87 * | 91 * |
88 * @param e the untyped event containing the information | 92 * @param e the untyped event containing the information |
89 */ | 93 */ |
90 public this(DNDEvent e) { | 94 public DropTargetEvent(DNDEvent e) { |
91 super(e); | 95 super(e); |
92 this.data = e.data; | 96 this.data = e.data; |
93 this.x = e.x; | 97 this.x = e.x; |
94 this.y = e.y; | 98 this.y = e.y; |
95 this.detail = e.detail; | 99 this.detail = e.detail; |
110 e.dataTypes = this.dataTypes; | 114 e.dataTypes = this.dataTypes; |
111 e.operations = this.operations; | 115 e.operations = this.operations; |
112 e.feedback = this.feedback; | 116 e.feedback = this.feedback; |
113 e.item = this.item; | 117 e.item = this.item; |
114 } | 118 } |
119 /** | |
120 * Returns a string containing a concise, human-readable | |
121 * description of the receiver. | |
122 * | |
123 * @return a string representation of the event | |
124 */ | |
125 public String toString() { | |
126 String string = super.toString (); | |
127 StringBuffer sb = new StringBuffer(); | |
128 sb.append(string.substring (0, string.length() - 1)); // remove trailing '}' | |
129 sb.append(" x="); sb.append(x); | |
130 sb.append(" y="); sb.append(y); | |
131 sb.append(" item="); sb.append(item); | |
132 sb.append(" operations="); sb.append(operations); | |
133 sb.append(" operation="); sb.append(detail); | |
134 sb.append(" feedback="); sb.append(feedback); | |
135 sb.append(" dataTypes={ "); | |
136 if (dataTypes !is null) { | |
137 for (int i = 0; i < dataTypes.length; i++) { | |
138 sb.append(dataTypes[i].type); sb.append(' '); | |
139 } | |
140 } | |
141 sb.append('}'); | |
142 sb.append(" currentDataType="); sb.append(currentDataType !is null ? currentDataType.type : '0'); | |
143 sb.append('}'); | |
144 return sb.toString(); | |
115 } | 145 } |
146 } |