]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/events/TouchEvent.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 / TouchEvent.java
1 /*******************************************************************************
2  * Copyright (c) 2010, 2011 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  * a touch-based input source being touched.
22  *
23  * @see TouchListener
24  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
25  *
26  * @since 3.7
27  */
28 public class TouchEvent extends TypedEvent {
29
30         /**
31          * The set of touches representing the state of all contacts with touch input
32          * device at the time the event was generated.
33          *
34          * @see org.eclipse.swt.widgets.Touch
35          */
36         public Touch[] touches;
37
38         /**
39          * The state of the keyboard modifier keys and mouse masks
40          * at the time the event was generated.
41          *
42          * @see org.eclipse.swt.SWT#MODIFIER_MASK
43          * @see org.eclipse.swt.SWT#BUTTON_MASK
44          */
45         public int stateMask;
46
47         /**
48          * The widget-relative x coordinate of the pointer
49          * at the time the touch occurred.
50          */
51         public int x;
52
53         /**
54          * The widget-relative y coordinate of the pointer
55          * at the time the touch occurred.
56          */
57         public int y;
58
59         static final long serialVersionUID = -8348741538373572182L;
60
61 /**
62  * Constructs a new instance of this class based on the
63  * information in the given untyped event.
64  *
65  * @param e the untyped event containing the information
66  */
67 public TouchEvent(Event e) {
68         super(e);
69         this.touches = e.touches;
70         this.stateMask = e.stateMask;
71         this.x = e.x;
72         this.y = e.y;
73 }
74
75 /**
76  * Returns a string containing a concise, human-readable
77  * description of the receiver.
78  *
79  * @return a string representation of the event
80  */
81 @Override
82 public String toString() {
83         String string = super.toString();
84         string = string.substring (0, string.length() - 1); // remove trailing '}'
85         string += " stateMask=0x" + Integer.toHexString(stateMask)
86                         + " x=" + x
87                         + " y=" + y;
88         if (touches != null) {
89                 for (int i = 0; i < touches.length; i++) {
90                         string += "\n     " + touches[i].toString();
91                 }
92                 string += "\n";
93         }
94         string += "}";
95         return string;
96 }
97 }