Class Gesture.Builder<B extends Gesture.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
BuilderInterface
Direct Known Subclasses:
GestureRotate.Builder, GestureSingle.Builder, GestureZoom.Builder
Enclosing class:
Gesture

public static class Gesture.Builder<B extends Gesture.Builder<B>> extends EventController.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 Gesture build()
      Finish building the Gesture object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to Gesture.
      Overrides:
      build in class EventController.Builder<B extends Gesture.Builder<B>>
      Returns:
      a new instance of Gesture with the properties that were set in the Builder object.
    • setNPoints

      public B setNPoints(int nPoints)
      The number of touch points that trigger recognition on this gesture.
      Parameters:
      nPoints - the value for the n-points property
      Returns:
      the Builder instance is returned, to allow method chaining
    • onBegin

      public B onBegin(Gesture.BeginCallback handler)

      Emitted when the gesture is recognized.

      This means the number of touch sequences matches Gtk.Gesture:n-points.

      Note: These conditions may also happen when an extra touch (eg. a third touch on a 2-touches gesture) is lifted, in that situation sequence won't pertain to the current set of active touches, so don't rely on this being true.

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

      public B onCancel(Gesture.CancelCallback handler)

      Emitted whenever a sequence is cancelled.

      This usually happens on active touches when EventController.reset() is called on gesture (manually, due to grabs...), or the individual sequence was claimed by parent widgets' controllers (see Gesture.setSequenceState(EventSequence, EventSequenceState)).

      gesture must forget everything about sequence as in response to this signal.

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

      public B onEnd(Gesture.EndCallback handler)

      Emitted when gesture either stopped recognizing the event sequences as something to be handled, or the number of touch sequences became higher or lower than Gtk.Gesture:n-points.

      Note: sequence might not pertain to the group of sequences that were previously triggering recognition on gesture (ie. a just pressed touch sequence that exceeds Gtk.Gesture:n-points). This situation may be detected by checking through Gesture.handlesSequence(EventSequence).

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

      public B onSequenceStateChanged(Gesture.SequenceStateChangedCallback handler)

      Emitted whenever a sequence state changes.

      See Gesture.setSequenceState(EventSequence, EventSequenceState) to know more about the expectable sequence lifetimes.

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

      public B onUpdate(Gesture.UpdateCallback handler)

      Emitted whenever an event is handled while the gesture is recognized.

      sequence is guaranteed to pertain to the set of active touches.

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