About my projects, examples and tutorials
Gnome::Gtk4::EventController

Gnome::Gtk4::EventController

Description§

Gnome::Gtk4::EventController 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 .add-controller() in class Widget. It is rarely necessary to explicitly remove a controller with .remove-controller() in class Widget.

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

Uml Diagram§

UNKNOWN image§

=for image :class<inline> :src<asset_files/images/plantuml/EventController.png> :width<70\%>

Class initialization§

new§

:native-object§

Create an object using a native object from an object of the same type found elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object() :$native-object! )
Code

Methods§

get-current-event§

Returns the event that is currently being handled by the controller.

At other times, undefined is returned.

method get-current-event (--> N-Object )
Code

Return value; the event that is currently handled by $controller.

get-current-event-device§

Returns the device of the event that is currently being handled by the controller.

At other times, undefined is returned.

method get-current-event-device (--> N-Object )
Code

Return value; device of the event is currently handled by $controller.

get-current-event-state§

Returns the modifier state of the event that is currently being handled by the controller.

At other times, 0 is returned.

method get-current-event-state (--> UInt )
Code

Return value; modifier state of the event is currently handled by $controller.

get-current-event-time§

Returns the timestamp of the event that is currently being handled by the controller.

At other times, 0 is returned.

method get-current-event-time (--> UInt )
Code

Return value; timestamp of the event is currently handled by $controller.

get-name§

Gets the name of $controller.

method get-name (--> Str )
Code

Return value; The controller name.

get-propagation-limit§

Gets the propagation limit of the event controller.

method get-propagation-limit (--> GtkPropagationLimit )
Code

Return value; the propagation limit.

get-propagation-phase§

Gets the propagation phase at which $controller handles events.

method get-propagation-phase (--> GtkPropagationPhase )
Code

Return value; the propagation phase.

get-widget§

Returns the Gnome::Gtk4::Widget this controller relates to.

method get-widget (--> N-Object )
Code

Return value; a Gnome::Gtk4::Widget.

reset§

Resets the $controller to a clean state.

method reset ( )
Code

set-name§

Sets a name on the controller that can be used for debugging.

method set-name ( Str $name )
Code
  • $name; a name for $controller.

set-propagation-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.

method set-propagation-limit ( GtkPropagationLimit $limit )
Code
  • $limit; the propagation limit.

set-propagation-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.

method set-propagation-phase ( GtkPropagationPhase $phase )
Code
  • $phase; a propagation phase.

set-static-name§

Sets a name on the controller that can be used for debugging.

method set-static-name ( Str $name )
Code
  • $name; a name for $controller, must be a static string.