Class EventController

All Implemented Interfaces:
PointerInterface
Direct Known Subclasses:
DropControllerMotion, DropTarget, DropTargetAsync, EventControllerFocus, EventControllerKey, EventControllerLegacy, EventControllerMotion, EventControllerScroll, Gesture, PadController, ShortcutController

public class EventController extends Object
`GtkEventController` is the base class for event controllers.

These are ancillary objects associated to widgets, which react
to `GdkEvents`, and possibly trigger actions as a consequence.

Event controllers are added to a widget with
[method@Gtk.Widget.add_controller]. It is rarely necessary to
explicitly remove a controller with [method@Gtk.Widget.remove_controller].

See the chapter on [input handling](input-handling.html) for
an overview of the basic concepts, such as the capture and bubble
phases of even propagation.

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

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getCurrentEvent

      public Event getCurrentEvent()
      Returns the event that is currently being handled by the controller.

      At other times, %NULL is returned.
      Returns:
      the event that is currently handled by @controller
    • getCurrentEventDevice

      public Device getCurrentEventDevice()
      Returns the device of the event that is currently being
      handled by the controller.

      At other times, %NULL is returned.
      Returns:
      device of the event is currently handled by @controller
    • getCurrentEventState

      public int getCurrentEventState()
      Returns the modifier state of the event that is currently being
      handled by the controller.

      At other times, 0 is returned.
      Returns:
      modifier state of the event is currently handled by @controller
    • getCurrentEventTime

      public int getCurrentEventTime()
      Returns the timestamp of the event that is currently being
      handled by the controller.

      At other times, 0 is returned.
      Returns:
      timestamp of the event is currently handled by @controller
    • getName

      public Str getName()
      Gets the name of @controller.
      Returns:
      The controller name
    • getPropagationLimit

      public int getPropagationLimit()
      Gets the propagation limit of the event controller.
      Returns:
      the propagation limit
    • getPropagationPhase

      public int getPropagationPhase()
      Gets the propagation phase at which @controller handles events.
      Returns:
      the propagation phase
    • getWidget

      public Widget getWidget()
      Returns the `GtkWidget` this controller relates to.
      Returns:
      a `GtkWidget`
    • reset

      public void reset()
      Resets the @controller to a clean state.
    • setName

      public void setName(@Nullable Str name)
      Sets a name on the controller that can be used for debugging.
      Parameters:
      name - a name for @controller
    • setName

      public void setName(String name)
      Sets a name on the controller that can be used for debugging.
      Parameters:
      name - a name for @controller
    • setPropagationLimit

      public void setPropagationLimit(int limit)
      Sets the event propagation limit on the event controller.

      If the limit is set to %GTK_LIMIT_SAME_NATIVE, the controller
      won't handle events that are targeted at widgets on a different
      surface, such as popovers.
      Parameters:
      limit - the propagation limit
    • setPropagationPhase

      public void setPropagationPhase(int phase)
      Sets the propagation phase at which a controller handles events.

      If @phase is %GTK_PHASE_NONE, no automatic event handling will be
      performed, but other additional gesture maintenance will.
      Parameters:
      phase - a propagation phase
    • setStaticName

      public void setStaticName(@Nullable Str name)
      Sets a name on the controller that can be used for debugging.
      Parameters:
      name - a name for @controller, must be a static string
    • setStaticName

      public void setStaticName(String name)
      Sets a name on the controller that can be used for debugging.
      Parameters:
      name - a name for @controller, must be a static string
    • 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()