]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/widgets/TouchSource.java
Remove invalid SHA-256-Digests
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / widgets / TouchSource.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.widgets;
15
16
17 import org.eclipse.swt.graphics.*;
18
19 /**
20  * Instances of this class represent sources of touch input that generate <code>Touch</code> objects.
21  * They also provide information about the input source, which is important for interpreting the
22  * information in the <code>Touch</code> object.
23  * <p>
24  * Instances of this class can be marked as direct or indirect:
25  * <ul>
26  * <li>When an instance is <em>direct</em>, the touch source is a touch-sensitive digitizer surface such
27  * as a tablet or a touch screen. There is a one-to-one mapping between a touch point and a location in
28  * a window.
29  * </li><li>
30  * When an instance is <em>indirect</em> (more precisely, not direct), the touch source is a track pad or
31  * other device that normally moves the cursor, but is also able to interpret multiple touches on its surface.
32  * In this case there is not a one-to-one mapping between the location of the touch on the device and a
33  * location on the display because the user can remove their finger or stylus and touch another part of
34  * the device and resume what they were doing.
35  * </li>
36  * </ul>
37  *
38  * @see Touch
39  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
40  *
41  * @since 3.7
42  */
43 public final class TouchSource {
44         long handle;
45         boolean direct;
46         Rectangle bounds;
47
48 /**
49  * Constructs a new touch source from the given inputs.
50  *
51  * @param direct Is the touch source direct or indirect?
52  * @param height height of the source in points.
53  * @param width width of the source in points.
54  */
55 TouchSource (long handle, boolean direct, Rectangle bounds) {
56         this.handle = handle;
57         this.direct = direct;
58         this.bounds = bounds;
59 }
60
61 /**
62  * Returns the type of touch input this source generates, <code>true</code> for direct or <code>false</code> for indirect.
63  *
64  * @return <code>true</code> if the input source is direct, or <code>false</code> otherwise
65  */
66 public boolean isDirect () {
67         return direct;
68 }
69
70 /**
71  * Returns the bounding rectangle of the device. For a direct source, this corresponds to the bounds of
72  * the display device in pixels. For an indirect source, this contains the size of the device in points.
73  * <p>
74  * Note that the x and y values may not necessarily be 0 if the TouchSource is a direct source.
75  *
76  * @return the bounding rectangle of the input source
77  */
78 public Rectangle getBounds () {
79         return new Rectangle (bounds.x, bounds.y, bounds.width, bounds.height);
80 }
81
82 /**
83  * Returns a string containing a concise, human-readable
84  * description of the receiver.
85  *
86  * @return a string representation of the event
87  */
88 @Override
89 public String toString () {
90         return "TouchSource {handle=" + handle + " direct=" + direct + " bounds=" + bounds + "}";
91 }
92
93 }