Class GestureSingle

All Implemented Interfaces:
PointerInterface
Direct Known Subclasses:
DragSource, GestureClick, GestureDrag, GestureLongPress, GestureStylus, GestureSwipe

public class GestureSingle extends Gesture
`GtkGestureSingle` is a `GtkGestures` subclass optimized for singe-touch
and mouse gestures.

Under interaction, these gestures stick to the first interacting sequence,
which is accessible through [method@Gtk.GestureSingle.get_current_sequence]
while the gesture is being interacted with.

By default gestures react to both %GDK_BUTTON_PRIMARY and touch events.
[method@Gtk.GestureSingle.set_touch_only] can be used to change the
touch behavior. Callers may also specify a different mouse button number
to interact with through [method@Gtk.GestureSingle.set_button], or react
to any mouse button by setting it to 0. While the gesture is active, the
button being currently pressed can be known through
[method@Gtk.GestureSingle.get_current_button].

https://docs.gtk.org/gtk4/class.GestureSingle.html

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getButton

      public int getButton()
      Returns the button number @gesture listens for.

      If this is 0, the gesture reacts to any button press.
      Returns:
      The button number, or 0 for any button
    • getCurrentButton

      public int getCurrentButton()
      Returns the button number currently interacting
      with @gesture, or 0 if there is none.
      Returns:
      The current button number
    • getCurrentSequence

      public EventSequence getCurrentSequence()
      Returns the event sequence currently interacting with @gesture.

      This is only meaningful if [method@Gtk.Gesture.is_active]
      returns %TRUE.
      Returns:
      the current sequence
    • getExclusive

      public boolean getExclusive()
      Gets whether a gesture is exclusive.

      For more information, see [method@Gtk.GestureSingle.set_exclusive].
      Returns:
      Whether the gesture is exclusive
    • getTouchOnly

      public boolean getTouchOnly()
      Returns %TRUE if the gesture is only triggered by touch events.
      Returns:
      %TRUE if the gesture only handles touch events
    • setButton

      public void setButton(int button)
      Sets the button number @gesture listens to.

      If non-0, every button press from a different button
      number will be ignored. Touch events implicitly match
      with button 1.
      Parameters:
      button - button number to listen to, or 0 for any button
    • setExclusive

      public void setExclusive(boolean exclusive)
      Sets whether @gesture is exclusive.

      An exclusive gesture will only handle pointer and "pointer emulated"
      touch events, so at any given time, there is only one sequence able
      to interact with those.
      Parameters:
      exclusive - %TRUE to make @gesture exclusive
    • setTouchOnly

      public void setTouchOnly(boolean touch_only)
      Sets whether to handle only touch events.

      If @touch_only is %TRUE, @gesture will only handle events of type
      %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE or %GDK_TOUCH_END. If %FALSE,
      mouse events will be handled too.
      Parameters:
      touch_only - whether @gesture handles only touch events
    • 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()