Added
Link Here
|
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2010 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
7 |
* |
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.swt.widgets; |
12 |
|
13 |
import org.eclipse.swt.graphics.*; |
14 |
|
15 |
|
16 |
/** |
17 |
* Instances of this class represent a source of touch input. It is used to identify which input source |
18 |
* generated a <code>Touch</code> object. It also provides information about the input source, which is important |
19 |
* when deciding how to interpret the information in the <code>Touch</code> object. |
20 |
* <p> |
21 |
* Instances of this class can be marked as direct or indirect: |
22 |
* <ul> |
23 |
* <li>When an instance is marked as <em>direct</em> the touch source is a touch-sensitive digitizer surface such |
24 |
* as a tablet or a touch screen. There is a one-to-one mapping between a touch point and a location in a window. |
25 |
* </li><li> |
26 |
* When an instance is marked as <em>indirect</em> (or, more precisely, not direct) the touch source is a track pad |
27 |
* or other device that normally moves the cursor, but can also interpret multiple touches on its surface. In this |
28 |
* case, there is not a one-to-one map between the location of the touch on the device and a location on the display |
29 |
* because the user can remove their finger or stylus and touch another part of the device and resume what they were |
30 |
* doing. |
31 |
* </li> |
32 |
* </ul> |
33 |
* <p> |
34 |
* IMPORTANT: This class is not intended to be subclassed. |
35 |
* </p> |
36 |
* |
37 |
* @see Touch |
38 |
* @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> |
39 |
* |
40 |
* @since 3.7 |
41 |
*/ |
42 |
|
43 |
public final class TouchSource { |
44 |
|
45 |
/** |
46 |
* the type of touch input this source generates; true for direct, false for indirect. |
47 |
*/ |
48 |
public boolean direct; |
49 |
|
50 |
/** |
51 |
* Bounding rectangle of the device. For a direct source, corresponds to the bounds of the display |
52 |
* device in pixels. For an indirect source, contains the size of the device in pixels. |
53 |
*/ |
54 |
public Rectangle bounds; |
55 |
|
56 |
/** |
57 |
* Constructs a new touch source from the given inputs. |
58 |
* |
59 |
* @param direct Is the touch source direct or indirect? |
60 |
* @param height height of the source in pixels. |
61 |
* @param width width of the source in pixels. |
62 |
*/ |
63 |
public TouchSource(boolean direct, Rectangle bounds) { |
64 |
this.direct = direct; |
65 |
this.bounds = bounds; |
66 |
} |
67 |
|
68 |
/** |
69 |
* Returns a string containing a concise, human-readable |
70 |
* description of the receiver. |
71 |
* |
72 |
* @return a string representation of the event |
73 |
*/ |
74 |
public String toString() { |
75 |
return "{direct=" + direct |
76 |
+ " bounds=" + bounds; |
77 |
} |
78 |
} |