Class SwipeTracker

All Implemented Interfaces:
PointerInterface

public class SwipeTracker extends Object
A swipe tracker used in [class@Carousel], [class@Flap] and [class@Leaflet].

The `AdwSwipeTracker` object can be used for implementing widgets with swipe
gestures. It supports touch-based swipes, pointer dragging, and touchpad
scrolling.

The widgets will probably want to expose the [property@SwipeTracker:enabled]
property. If they expect to use horizontal orientation,
[property@SwipeTracker:reversed] can be used for supporting RTL text
direction.

https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.SwipeTracker.html

  • Field Details

  • Constructor Details

    • SwipeTracker

      public SwipeTracker(PointerContainer pointer)
    • SwipeTracker

      public SwipeTracker(@Nonnull Swipeable swipeable)
      Creates a new `AdwSwipeTracker` for @widget.
      Parameters:
      swipeable - a widget to add the tracker on
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getAllowLongSwipes

      public boolean getAllowLongSwipes()
      Gets whether to allow swiping for more than one snap point at a time.
      Returns:
      whether long swipes are allowed
    • getAllowMouseDrag

      public boolean getAllowMouseDrag()
      Gets whether @self can be dragged with mouse pointer.
      Returns:
      whether mouse dragging is allowed
    • getEnabled

      public boolean getEnabled()
      Gets whether @self is enabled.
      Returns:
      whether @self is enabled
    • getReversed

      public boolean getReversed()
      Gets whether @self is reversing the swipe direction.
      Returns:
      whether the direction is reversed
    • getSwipeable

      public Swipeable getSwipeable()
      Get the widget @self is attached to.
      Returns:
      the swipeable widget
    • setAllowLongSwipes

      public void setAllowLongSwipes(boolean allow_long_swipes)
      Sets whether to allow swiping for more than one snap point at a time.

      If the value is `FALSE`, each swipe can only move to the adjacent snap
      points.
      Parameters:
      allow_long_swipes - whether to allow long swipes
    • setAllowMouseDrag

      public void setAllowMouseDrag(boolean allow_mouse_drag)
      Sets whether @self can be dragged with mouse pointer.
      Parameters:
      allow_mouse_drag - whether to allow mouse dragging
    • setEnabled

      public void setEnabled(boolean enabled)
      Sets whether @self is enabled.

      When it's not enabled, no events will be processed. Usually widgets will want
      to expose this via a property.
      Parameters:
      enabled - whether @self is enabled
    • setReversed

      public void setReversed(boolean reversed)
      Sets whether to reverse the swipe direction.

      If the swipe tracker is horizontal, it can be used for supporting RTL text
      direction.
      Parameters:
      reversed - whether to reverse the swipe direction
    • shiftPosition

      public void shiftPosition(double delta)
      Moves the current progress value by @delta.

      This can be used to adjust the current position if snap points move during
      the gesture.
      Parameters:
      delta - the position delta
    • onBeginSwipe

      public SignalHandler onBeginSwipe(SwipeTracker.OnBeginSwipe signal)
      Connect to signal "begin-swipe".
      See SwipeTracker.OnBeginSwipe.onBeginSwipe() for signal description.
      Field SIGNAL_ON_BEGIN_SWIPE contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • onEndSwipe

      public SignalHandler onEndSwipe(SwipeTracker.OnEndSwipe signal)
      Connect to signal "end-swipe".
      See SwipeTracker.OnEndSwipe.onEndSwipe(double, double) for signal description.
      Field SIGNAL_ON_END_SWIPE contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • onPrepare

      public SignalHandler onPrepare(SwipeTracker.OnPrepare signal)
      Connect to signal "prepare".
      See SwipeTracker.OnPrepare.onPrepare(int) for signal description.
      Field SIGNAL_ON_PREPARE contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • onUpdateSwipe

      public SignalHandler onUpdateSwipe(SwipeTracker.OnUpdateSwipe signal)
      Connect to signal "update-swipe".
      See SwipeTracker.OnUpdateSwipe.onUpdateSwipe(double) for signal description.
      Field SIGNAL_ON_UPDATE_SWIPE contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • asOrientable

      public Orientable asOrientable()
      Implements interface Orientable. Call this to get access to interface functions.
      Returns:
      Orientable
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()