]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/events/GestureEvent.java
Work around SWT 4.13 - 4.18 Win32 DnD bug 567422
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / events / GestureEvent.java
diff --git a/bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/events/GestureEvent.java b/bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/events/GestureEvent.java
new file mode 100644 (file)
index 0000000..05837da
--- /dev/null
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2018 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.events;
+
+
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Instances of this class are sent in response to
+ * touch-based gestures that are triggered by the user.
+ *
+ * @see GestureListener
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
+ *
+ * @since 3.7
+ */
+public class GestureEvent extends TypedEvent {
+
+       /**
+        * The state of the keyboard modifier keys and mouse masks
+        * at the time the event was generated.
+        *
+        * @see org.eclipse.swt.SWT#MODIFIER_MASK
+        * @see org.eclipse.swt.SWT#BUTTON_MASK
+        */
+       public int stateMask;
+
+       /**
+        * The gesture type.
+        * <ul>
+        * <li>{@link org.eclipse.swt.SWT#GESTURE_BEGIN}</li>
+        * <li>{@link org.eclipse.swt.SWT#GESTURE_END}</li>
+        * <li>{@link org.eclipse.swt.SWT#GESTURE_MAGNIFY}</li>
+        * <li>{@link org.eclipse.swt.SWT#GESTURE_PAN}</li>
+        * <li>{@link org.eclipse.swt.SWT#GESTURE_ROTATE}</li>
+        * <li>{@link org.eclipse.swt.SWT#GESTURE_SWIPE}</li>
+        * </ul>
+        *
+        * This field determines the <code>GestureEvent</code> fields that contain valid data.
+        */
+       public int detail;
+
+       /**
+        * The meaning of this field is dependent on the value of the <code>detail</code> field
+        * and the platform.  It can represent either the x coordinate of the centroid of the
+        * touches that make up the gesture, or the x coordinate of the cursor at the time the
+        * gesture was performed.
+        */
+       public int x;
+
+       /**
+        * The meaning of this field is dependent on the value of the <code>detail</code> field
+        * and the platform.  It can represent either the y coordinate of the centroid of the
+        * touches that make up the gesture, or the y coordinate of the cursor at the time the
+        * gesture was performed.
+        */
+       public int y;
+
+       /**
+        * This field is valid when the <code>detail</code> field is set to <code>GESTURE_ROTATE</code>.
+        * It specifies the number of degrees rotated on the device since the gesture started. Positive
+        * values indicate counter-clockwise rotation, and negative values indicate clockwise rotation.
+        */
+       public double rotation;
+
+       /**
+        * This field is valid when the <code>detail</code> field is set to <code>GESTURE_SWIPE</code>
+        * or <code>GESTURE_PAN</code>.  Both <code>xDirection</code> and <code>yDirection</code>
+        * can be valid for an individual gesture.  The meaning of this field is dependent on the value
+        * of the <code>detail</code> field.
+        * <p>
+        * If <code>detail</code> is <code>GESTURE_SWIPE</code> then a positive value indicates a swipe
+        * to the right and a negative value indicates a swipe to the left.
+        *
+        * If <code>detail</code> is <code>GESTURE_PAN</code> then a positive value indicates a pan to
+        * the right by this field's count of points and a negative value indicates a pan to the left
+        * by this field's count of points.
+        */
+       public int xDirection;
+
+       /**
+        * This field is valid when the <code>detail</code> field is set to <code>GESTURE_SWIPE</code>
+        * or <code>GESTURE_PAN</code>.  Both <code>xDirection</code> and <code>yDirection</code>
+        * can be valid for an individual gesture.  The meaning of this field is dependent on the value
+        * of the <code>detail</code> field.
+        *
+        * If <code>detail</code> is <code>GESTURE_SWIPE</code> then a positive value indicates a downward
+        * swipe and a negative value indicates an upward swipe.
+        *
+        * If <code>detail</code> is <code>GESTURE_PAN</code> then a positive value indicates a downward
+        * pan by this field's count of points and a negative value indicates an upward pan by this
+        * field's count of points.
+        */
+       public int yDirection;
+
+       /**
+        * This field is valid when the <code>detail</code> field is set to <code>GESTURE_MAGNIFY</code>.
+        * This is the scale factor to be applied. This value will be 1.0 in the first received event with
+        * <code>GESTURE_MAGNIFY</code>, and will then fluctuate in subsequent events as the user moves
+        * their fingers.
+        */
+       public double magnification;
+
+       /**
+        * This flag indicates whether the operation should be allowed.
+        * Setting it to <code>false</code> will cancel the operation.
+        */
+       public boolean doit;
+
+       static final long serialVersionUID = -8348741538373572182L;
+
+/**
+ * Constructs a new instance of this class based on the
+ * information in the given untyped event.
+ *
+ * @param e the untyped event containing the information
+ */
+public GestureEvent(Event e) {
+       super(e);
+       this.stateMask = e.stateMask;
+       this.x = e.x;
+       this.y = e.y;
+       this.detail = e.detail;
+       this.rotation = e.rotation;
+       this.xDirection = e.xDirection;
+       this.yDirection = e.yDirection;
+       this.magnification = e.magnification;
+       this.doit = e.doit;
+}
+
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the event
+ */
+@Override
+public String toString() {
+       String string = super.toString ();
+       return string.substring (0, string.length() - 1) // remove trailing '}'
+               + " stateMask=0x" + Integer.toHexString(stateMask)
+               + " detail=" + detail
+               + " x=" + x
+               + " y=" + y
+               + " rotation=" + rotation
+               + " xDirection=" + xDirection
+               + " yDirection=" + yDirection
+               + " magnification=" + magnification
+               + "}";
+}
+}