Class GestureSwipe

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class GestureSwipe extends GestureSingle

Recognizes swipe gestures.

After a press/move/.../move/release sequence happens, the Gtk.GestureSwipe::swipe signal will be emitted, providing the velocity and directionality of the sequence at the time it was lifted.

If the velocity is desired in intermediate points, getVelocity(Out, Out) can be called in a Gtk.Gesture::update handler.

All velocities are reported in pixels/sec units.

  • Constructor Details

    • GestureSwipe

      public GestureSwipe(MemorySegment address)
      Create a GestureSwipe instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • GestureSwipe

      public GestureSwipe()
      Create a new GestureSwipe.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the GestureSwipe class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected GestureSwipe asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GestureSingle
      Returns:
      the instance as if it were its parent type
    • getVelocity

      public boolean getVelocity(Out<Double> velocityX, Out<Double> velocityY)

      Gets the current velocity.

      If the gesture is recognized, this function returns true and fills in velocityX and velocityY with the recorded velocity, as per the last events processed.

      Parameters:
      velocityX - return value for the velocity in the X axis, in pixels/sec
      velocityY - return value for the velocity in the Y axis, in pixels/sec
      Returns:
      whether velocity could be calculated
    • onSwipe

      Emitted when the recognized gesture is finished.

      Velocity and direction are a product of previously recorded events.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitSwipe

      public void emitSwipe(double velocityX, double velocityY)
      Emits the "swipe" signal. See onSwipe(GestureSwipe.SwipeCallback).
    • builder

      public static GestureSwipe.Builder<? extends GestureSwipe.Builder> builder()
      A GestureSwipe.Builder object constructs a GestureSwipe with the specified properties. Use the various set...() methods to set properties, and finish construction with GestureSwipe.Builder.build().
      Returns:
      the builder object