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 Gnome::Gtk4::Widget
. It is rarely necessary to explicitly remove a controller with .remove-controller() in class Gnome::Gtk4::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.
Class initialization
new
:native-object
Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object :$native-object! )
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 )
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 )
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 )
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 )
Return value; timestamp of the event is currently handled by $controller
.
get-name
Gets the name of $controller
.
method get-name (--> Str )
Return value; The controller name.
get-propagation-limit
Gets the propagation limit of the event controller.
method get-propagation-limit (--> GtkPropagationLimit )
Return value; the propagation limit.
get-propagation-phase
Gets the propagation phase at which $controller
handles events.
method get-propagation-phase (--> GtkPropagationPhase )
Return value; the propagation phase.
get-widget
Returns the Gnome::Gtk4::Widget this controller relates to.
method get-widget (--> N-Object )
Return value; a Gnome::Gtk4::Widget.
reset
Resets the $controller
to a clean state.
method reset ( )
set-name
Sets a name on the controller that can be used for debugging.
method set-name ( Str $name )
$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 )
$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 )
$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 )
$name; a name for
$controller
, must be a static string.