Class TouchSource

java.lang.Object
org.eclipse.swt.widgets.TouchSource

public final class TouchSource extends Object
Instances of this class represent sources of touch input that generate Touch objects. They also provide information about the input source, which is important for interpreting the information in the Touch object.

Instances of this class can be marked as direct or indirect:

  • When an instance is direct, the touch source is a touch-sensitive digitizer surface such as a tablet or a touch screen. There is a one-to-one mapping between a touch point and a location in a window.
  • When an instance is indirect (more precisely, not direct), the touch source is a track pad or other device that normally moves the cursor, but is also able to interpret multiple touches on its surface. In this case there is not a one-to-one mapping between the location of the touch on the device and a location on the display because the user can remove their finger or stylus and touch another part of the device and resume what they were doing.
Since:
3.7
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) Rectangle
     
    (package private) boolean
     
    (package private) long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    TouchSource(long handle, boolean direct, Rectangle bounds)
    Constructs a new touch source from the given inputs.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the bounding rectangle of the device.
    boolean
    Returns the type of touch input this source generates, true for direct or false for indirect.
    Returns a string containing a concise, human-readable description of the receiver.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • handle

      long handle
    • direct

      boolean direct
    • bounds

      Rectangle bounds
  • Constructor Details

    • TouchSource

      TouchSource(long handle, boolean direct, Rectangle bounds)
      Constructs a new touch source from the given inputs.
      Parameters:
      direct - Is the touch source direct or indirect?
      height - height of the source in points.
      width - width of the source in points.
  • Method Details

    • isDirect

      public boolean isDirect()
      Returns the type of touch input this source generates, true for direct or false for indirect.
      Returns:
      true if the input source is direct, or false otherwise
    • getBounds

      public Rectangle getBounds()
      Returns the bounding rectangle of the device. For a direct source, this corresponds to the bounds of the display device in pixels. For an indirect source, this contains the size of the device in points.

      Note that the x and y values may not necessarily be 0 if the TouchSource is a direct source.

      Returns:
      the bounding rectangle of the input source
    • toString

      public String toString()
      Returns a string containing a concise, human-readable description of the receiver.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the event