diff 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
line wrap: on
line diff
--- a/dwt/dnd/DragSourceEvent.d	Tue Oct 21 15:20:04 2008 +0200
+++ b/dwt/dnd/DragSourceEvent.d	Mon Dec 01 17:07:00 2008 +0100
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -8,17 +8,20 @@
  * Contributors:
  *     IBM Corporation - initial API and implementation
  *******************************************************************************/
-module dwt.dnd;
+module dwt.dnd.DragSourceEvent;
+
+import dwt.dwthelper.utils;
 
 import dwt.events.TypedEvent;
-import dwt.graphics.*;
+import dwt.graphics.Image;
 
 /**
  * The DragSourceEvent contains the event information passed in the methods of the DragSourceListener.
  * 
  * @see DragSourceListener
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
  */
-public class DragSourceEvent : TypedEvent {
+public class DragSourceEvent extends TypedEvent {
     /**
      * The operation that was performed.
      * @see DND#DROP_NONE
@@ -48,12 +51,14 @@
     /**
      * In dragStart, the x coordinate (relative to the control) of the 
      * position the mouse went down to start the drag.
+     * 
      * @since 3.2
      */
     public int x;
     /**
      * In dragStart, the y coordinate (relative to the control) of the 
-     * position the mouse went down to start the drag .
+     * position the mouse went down to start the drag.
+     * 
      * @since 3.2
      */
     public int y;
@@ -73,6 +78,19 @@
      */
     public Image image;
 
+    /**
+     * In dragStart, the x offset (relative to the image) where the drag source image will be displayed.
+     * 
+     * @since 3.5
+     */
+    public int offsetX;
+    /**
+     * In dragStart, the y offset (relative to the image) where the drag source image will be displayed.
+     * 
+     * @since 3.5
+     */
+    public int offsetY;
+
     static final long serialVersionUID = 3257002142513770808L;
     
 /**
@@ -81,7 +99,7 @@
  *
  * @param e the untyped event containing the information
  */
-public this(DNDEvent e) {
+public DragSourceEvent(DNDEvent e) {
     super(e);
     this.data = e.data;
     this.detail = e.detail;
@@ -90,6 +108,8 @@
     this.x = e.x;
     this.y = e.y;
     this.image = e.image;
+    this.offsetX = e.offsetX;
+    this.offsetY = e.offsetY;
 }
 void updateEvent(DNDEvent e) {
     e.widget = this.widget;
@@ -101,5 +121,21 @@
     e.x = this.x;
     e.y = this.y;
     e.image = this.image;
+    e.offsetX = this.offsetX;
+    e.offsetY = this.offsetY;
+}
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the event
+ */
+public String toString() {
+    String string = super.toString ();
+    return string.substring (0, string.length() - 1) // remove trailing '}'
+        + " operation=" + detail
+        + " type=" + (dataType !is null ? dataType.type : 0)
+        + " doit=" + doit
+        + "}";
 }
 }