Class SwipeTracker.Builder<B extends SwipeTracker.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
Orientable.Builder<B>, BuilderInterface
Enclosing class:
SwipeTracker

public static class SwipeTracker.Builder<B extends SwipeTracker.Builder<B>> extends GObject.Builder<B> implements Orientable.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public SwipeTracker build()
      Finish building the SwipeTracker object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to SwipeTracker.
      Overrides:
      build in class GObject.Builder<B extends SwipeTracker.Builder<B>>
      Returns:
      a new instance of SwipeTracker with the properties that were set in the Builder object.
    • setAllowLongSwipes

      public B setAllowLongSwipes(boolean allowLongSwipes)

      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:
      allowLongSwipes - the value for the allow-long-swipes property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setAllowMouseDrag

      public B setAllowMouseDrag(boolean allowMouseDrag)
      Whether to allow dragging with mouse pointer.
      Parameters:
      allowMouseDrag - the value for the allow-mouse-drag property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setAllowWindowHandle

      public B setAllowWindowHandle(boolean allowWindowHandle)

      Whether to allow touchscreen swiping from GtkWindowHandle.

      This will make dragging the window impossible.

      Parameters:
      allowWindowHandle - the value for the allow-window-handle property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.5
    • setEnabled

      public B setEnabled(boolean enabled)

      Whether the swipe tracker is enabled.

      When it's not enabled, no events will be processed. Usually widgets will want to expose this via a property.

      Parameters:
      enabled - the value for the enabled property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setLowerOvershoot

      public B setLowerOvershoot(boolean lowerOvershoot)
      Whether to allow swiping past the first available snap point.
      Parameters:
      lowerOvershoot - the value for the lower-overshoot property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.4
    • setReversed

      public B setReversed(boolean reversed)

      Whether to reverse the swipe direction.

      If the swipe tracker is horizontal, it can be used for supporting RTL text direction.

      Parameters:
      reversed - the value for the reversed property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSwipeable

      public B setSwipeable(Swipeable swipeable)
      The widget the swipe tracker is attached to.
      Parameters:
      swipeable - the value for the swipeable property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setUpperOvershoot

      public B setUpperOvershoot(boolean upperOvershoot)
      Whether to allow swiping past the last available snap point.
      Parameters:
      upperOvershoot - the value for the upper-overshoot property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.4
    • onBeginSwipe

      public B onBeginSwipe(SwipeTracker.BeginSwipeCallback handler)
      This signal is emitted right before a swipe will be started, after the drag threshold has been passed.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onEndSwipe

      public B onEndSwipe(SwipeTracker.EndSwipeCallback handler)

      This signal is emitted as soon as the gesture has stopped.

      The user is expected to animate the deceleration from the current progress value to to with an animation using velocity as the initial velocity, provided in pixels per second. SpringAnimation is usually a good fit for this.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onPrepare

      public B onPrepare(SwipeTracker.PrepareCallback handler)

      This signal is emitted when a possible swipe is detected.

      The direction value can be used to restrict the swipe to a certain direction.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onUpdateSwipe

      public B onUpdateSwipe(SwipeTracker.UpdateSwipeCallback handler)
      This signal is emitted every time the progress value changes.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also: