diff dwt/events/MouseEvent.d @ 34:5123b17c98ef

Ported dwt.events.*, dwt.graphics.GC, Region, dwt.internal.image.*
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sun, 14 Sep 2008 01:45:57 +0200
parents 1a8b3cb347e0
children 43be986a1372
line wrap: on
line diff
--- a/dwt/events/MouseEvent.d	Fri Sep 12 13:53:21 2008 +0200
+++ b/dwt/events/MouseEvent.d	Sun Sep 14 01:45:57 2008 +0200
@@ -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
@@ -7,6 +7,8 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
 module dwt.events.MouseEvent;
 
@@ -14,11 +16,14 @@
 
 
 import dwt.widgets.Event;
+import dwt.events.TypedEvent;
+
+import tango.text.convert.Format;
 
 /**
  * Instances of this class are sent whenever mouse
  * related actions occur. This includes mouse buttons
- * being pressed and released, the mouse pointer being 
+ * being pressed and released, the mouse pointer being
  * moved and the mouse pointer crossing widget boundaries.
  * <p>
  * Note: The <code>button</code> field is an integer that
@@ -29,46 +34,47 @@
  * @see MouseListener
  * @see MouseMoveListener
  * @see MouseTrackListener
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
  */
 
 public class MouseEvent : TypedEvent {
-    
+
     /**
      * the button that was pressed or released; 1 for the
      * first button, 2 for the second button, and 3 for the
      * third button, etc.
      */
     public int button;
-    
+
     /**
      * the state of the keyboard modifier keys at the time
      * the event was generated
      */
     public int stateMask;
-    
+
     /**
      * the widget-relative, x coordinate of the pointer
      * at the time the mouse button was pressed or released
      */
     public int x;
-    
+
     /**
      * the widget-relative, y coordinate of the pointer
      * at the time the mouse button was pressed or released
-     */ 
+     */
     public int y;
-    
+
     /**
      * the number times the mouse has been clicked, as defined
      * by the operating system; 1 for the first click, 2 for the
      * second click and so on.
-     * 
+     *
      * @since 3.3
      */
     public int count;
 
-    static final long serialVersionUID = 3257288037011566898L;
-    
+    //static final long serialVersionUID = 3257288037011566898L;
+
 /**
  * Constructs a new instance of this class based on the
  * information in the given untyped event.
@@ -90,14 +96,9 @@
  *
  * @return a string representation of the event
  */
-public String toString() {
-    String string = super.toString ();
-    return string.substring (0, string.length() - 1) // remove trailing '}'
-        + " button=" + button
-        + " stateMask=" + stateMask
-        + " x=" + x
-        + " y=" + y
-        + " count=" + count
-        + "}";
+public override String toString() {
+    return Format( "{} button={} stateMask={} x={} y={} count={}}",
+        super.toString[ 0 .. $-1 ],
+        button, stateMask, x, y, count );
 }
 }