]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/events/GestureEvent.java
Remove invalid SHA-256-Digests
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / events / GestureEvent.java
1 /*******************************************************************************
2  * Copyright (c) 2010, 2018 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.events;
15
16
17 import org.eclipse.swt.widgets.*;
18
19 /**
20  * Instances of this class are sent in response to
21  * touch-based gestures that are triggered by the user.
22  *
23  * @see GestureListener
24  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
25  *
26  * @since 3.7
27  */
28 public class GestureEvent extends TypedEvent {
29
30         /**
31          * The state of the keyboard modifier keys and mouse masks
32          * at the time the event was generated.
33          *
34          * @see org.eclipse.swt.SWT#MODIFIER_MASK
35          * @see org.eclipse.swt.SWT#BUTTON_MASK
36          */
37         public int stateMask;
38
39         /**
40          * The gesture type.
41          * <ul>
42          * <li>{@link org.eclipse.swt.SWT#GESTURE_BEGIN}</li>
43          * <li>{@link org.eclipse.swt.SWT#GESTURE_END}</li>
44          * <li>{@link org.eclipse.swt.SWT#GESTURE_MAGNIFY}</li>
45          * <li>{@link org.eclipse.swt.SWT#GESTURE_PAN}</li>
46          * <li>{@link org.eclipse.swt.SWT#GESTURE_ROTATE}</li>
47          * <li>{@link org.eclipse.swt.SWT#GESTURE_SWIPE}</li>
48          * </ul>
49          *
50          * This field determines the <code>GestureEvent</code> fields that contain valid data.
51          */
52         public int detail;
53
54         /**
55          * The meaning of this field is dependent on the value of the <code>detail</code> field
56          * and the platform.  It can represent either the x coordinate of the centroid of the
57          * touches that make up the gesture, or the x coordinate of the cursor at the time the
58          * gesture was performed.
59          */
60         public int x;
61
62         /**
63          * The meaning of this field is dependent on the value of the <code>detail</code> field
64          * and the platform.  It can represent either the y coordinate of the centroid of the
65          * touches that make up the gesture, or the y coordinate of the cursor at the time the
66          * gesture was performed.
67          */
68         public int y;
69
70         /**
71          * This field is valid when the <code>detail</code> field is set to <code>GESTURE_ROTATE</code>.
72          * It specifies the number of degrees rotated on the device since the gesture started. Positive
73          * values indicate counter-clockwise rotation, and negative values indicate clockwise rotation.
74          */
75         public double rotation;
76
77         /**
78          * This field is valid when the <code>detail</code> field is set to <code>GESTURE_SWIPE</code>
79          * or <code>GESTURE_PAN</code>.  Both <code>xDirection</code> and <code>yDirection</code>
80          * can be valid for an individual gesture.  The meaning of this field is dependent on the value
81          * of the <code>detail</code> field.
82          * <p>
83          * If <code>detail</code> is <code>GESTURE_SWIPE</code> then a positive value indicates a swipe
84          * to the right and a negative value indicates a swipe to the left.
85          *
86          * If <code>detail</code> is <code>GESTURE_PAN</code> then a positive value indicates a pan to
87          * the right by this field's count of points and a negative value indicates a pan to the left
88          * by this field's count of points.
89          */
90         public int xDirection;
91
92         /**
93          * This field is valid when the <code>detail</code> field is set to <code>GESTURE_SWIPE</code>
94          * or <code>GESTURE_PAN</code>.  Both <code>xDirection</code> and <code>yDirection</code>
95          * can be valid for an individual gesture.  The meaning of this field is dependent on the value
96          * of the <code>detail</code> field.
97          *
98          * If <code>detail</code> is <code>GESTURE_SWIPE</code> then a positive value indicates a downward
99          * swipe and a negative value indicates an upward swipe.
100          *
101          * If <code>detail</code> is <code>GESTURE_PAN</code> then a positive value indicates a downward
102          * pan by this field's count of points and a negative value indicates an upward pan by this
103          * field's count of points.
104          */
105         public int yDirection;
106
107         /**
108          * This field is valid when the <code>detail</code> field is set to <code>GESTURE_MAGNIFY</code>.
109          * This is the scale factor to be applied. This value will be 1.0 in the first received event with
110          * <code>GESTURE_MAGNIFY</code>, and will then fluctuate in subsequent events as the user moves
111          * their fingers.
112          */
113         public double magnification;
114
115         /**
116          * This flag indicates whether the operation should be allowed.
117          * Setting it to <code>false</code> will cancel the operation.
118          */
119         public boolean doit;
120
121         static final long serialVersionUID = -8348741538373572182L;
122
123 /**
124  * Constructs a new instance of this class based on the
125  * information in the given untyped event.
126  *
127  * @param e the untyped event containing the information
128  */
129 public GestureEvent(Event e) {
130         super(e);
131         this.stateMask = e.stateMask;
132         this.x = e.x;
133         this.y = e.y;
134         this.detail = e.detail;
135         this.rotation = e.rotation;
136         this.xDirection = e.xDirection;
137         this.yDirection = e.yDirection;
138         this.magnification = e.magnification;
139         this.doit = e.doit;
140 }
141
142 /**
143  * Returns a string containing a concise, human-readable
144  * description of the receiver.
145  *
146  * @return a string representation of the event
147  */
148 @Override
149 public String toString() {
150         String string = super.toString ();
151         return string.substring (0, string.length() - 1) // remove trailing '}'
152                 + " stateMask=0x" + Integer.toHexString(stateMask)
153                 + " detail=" + detail
154                 + " x=" + x
155                 + " y=" + y
156                 + " rotation=" + rotation
157                 + " xDirection=" + xDirection
158                 + " yDirection=" + yDirection
159                 + " magnification=" + magnification
160                 + "}";
161 }
162 }