Package org.eclipse.swt.events

# Class GestureEvent

java.lang.Object
java.util.EventObject
org.eclipse.swt.events.TypedEvent
org.eclipse.swt.events.GestureEvent

All Implemented Interfaces:
  `Serializable`

public class GestureEvent extends TypedEvent
Instances of this class are sent in response to touch-based gestures that are triggered by the user.

Since:
  3.7
See Also:
  - `GestureListener`
  - Sample code and further information
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`int`
`detail`
The gesture type.
`boolean`
`doit`
This flag indicates whether the operation should be allowed.
`double`
`magnification`
This field is valid when the `detail` field is set to `GESTURE_MAGNIFY`.
`double`
`rotation`
This field is valid when the `detail` field is set to `GESTURE_ROTATE`.
`int`
`stateMask`
The state of the keyboard modifier keys and mouse masks at the time the event was generated.
`int`
`x`
The meaning of this field is dependent on the value of the `detail` field and the platform.
`int`
`xDirection`
This field is valid when the `detail` field is set to `GESTURE_SWIPE` or `GESTURE_PAN`.
`int`
`y`
The meaning of this field is dependent on the value of the `detail` field and the platform.
`int`
`yDirection`
This field is valid when the `detail` field is set to `GESTURE_SWIPE` or `GESTURE_PAN`.

### Fields inherited from class org.eclipse.swt.events.TypedEvent

`data, display, time, widget`

### Fields inherited from class java.util.EventObject

`source`

## Constructor Summary

Constructors
Constructor
Description
`GestureEvent(Event e)`
Constructs a new instance of this class based on the information in the given untyped event.

## Method Summary

Modifier and Type
Method
Description
`String`
`toString()`
Returns a string containing a concise, human-readable description of the receiver.

### Methods inherited from class java.util.EventObject

`getSource`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### stateMask

public int stateMask
The state of the keyboard modifier keys and mouse masks at the time the event was generated.

See Also:
  - `SWT.MODIFIER_MASK`
  - `SWT.BUTTON_MASK`

### detail

public int detail
The gesture type.

- `SWT.GESTURE_BEGIN`
- `SWT.GESTURE_END`
- `SWT.GESTURE_MAGNIFY`
- `SWT.GESTURE_PAN`
- `SWT.GESTURE_ROTATE`
- `SWT.GESTURE_SWIPE`

This field determines the `GestureEvent` fields that contain valid data.

### x

public int x
The meaning of this field is dependent on the value of the `detail` field and the platform. It can represent either the x coordinate of the centroid of the touches that make up the gesture, or the x coordinate of the cursor at the time the gesture was performed.

### y

public int y
The meaning of this field is dependent on the value of the `detail` field and the platform. It can represent either the y coordinate of the centroid of the touches that make up the gesture, or the y coordinate of the cursor at the time the gesture was performed.

### rotation

public double rotation
This field is valid when the `detail` field is set to `GESTURE_ROTATE`. It specifies the number of degrees rotated on the device since the gesture started. Positive values indicate counter-clockwise rotation, and negative values indicate clockwise rotation.

### xDirection

public int xDirection
This field is valid when the `detail` field is set to `GESTURE_SWIPE` or `GESTURE_PAN`. Both `xDirection` and `yDirection` can be valid for an individual gesture. The meaning of this field is dependent on the value of the `detail` field.

If `detail` is `GESTURE_SWIPE` then a positive value indicates a swipe to the right and a negative value indicates a swipe to the left. If `detail` is `GESTURE_PAN` then a positive value indicates a pan to the right by this field's count of points and a negative value indicates a pan to the left by this field's count of points.

### yDirection

public int yDirection
This field is valid when the `detail` field is set to `GESTURE_SWIPE` or `GESTURE_PAN`. Both `xDirection` and `yDirection` can be valid for an individual gesture. The meaning of this field is dependent on the value of the `detail` field. If `detail` is `GESTURE_SWIPE` then a positive value indicates a downward swipe and a negative value indicates an upward swipe. If `detail` is `GESTURE_PAN` then a positive value indicates a downward pan by this field's count of points and a negative value indicates an upward pan by this field's count of points.

### magnification

public double magnification
This field is valid when the `detail` field is set to `GESTURE_MAGNIFY`. This is the scale factor to be applied. This value will be 1.0 in the first received event with `GESTURE_MAGNIFY`, and will then fluctuate in subsequent events as the user moves their fingers.

### doit

public boolean doit
This flag indicates whether the operation should be allowed. Setting it to `false` will cancel the operation.

## Constructor Details

### GestureEvent

public GestureEvent(Event e)
Constructs a new instance of this class based on the information in the given untyped event.

Parameters:
  `e` - the untyped event containing the information

## Method Details

### toString

public String toString()
Returns a string containing a concise, human-readable description of the receiver.

Overrides:
  `toString` in class `TypedEvent`
Returns:
  a string representation of the event