Gnome::Gtk4::GestureDrag
#------------------------------------------------------------------------------- #--[Class Description]---------------------------------------------------------- #-------------------------------------------------------------------------------
Description
Gnome::Gtk4::GestureDrag is a Gnome::Gtk4::Gesture implementation for drags.
The drag operation itself can be tracked throughout the drag-begin, drag-update and drag-end signals, and the relevant coordinates can be extracted through .get-offset() and .get-start-point().
Uml Diagram =for image :src<asset_files/images/plantuml/GestureDrag.png> :width<70%> :class<inline>
#------------------------------------------------------------------------------- #--[Class Initialization]------------------------------------------------------- #-------------------------------------------------------------------------------
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! )
#-------------------------------------------------------------------------------
new-gesturedrag
Returns a newly created Gnome::Gtk4::Gesture that recognizes drags.
method new-gesturedrag ( --> Gnome::Gtk4::GestureDrag )
#------------------------------------------------------------------------------- #--[Methods]-------------------------------------------------------------------- #-------------------------------------------------------------------------------
Methods
#-------------------------------------------------------------------------------
get-offset
Gets the offset from the start point.
If the $gesture is active, this function returns True and
fills in $x and $y with the coordinates of the current point,
as an offset to the starting drag point.
method get-offset ( Num() $x, Num() $y --> Bool )
$x; (transfer ownership: full) X offset for the current point.
$y; (transfer ownership: full) Y offset for the current point.
Return value; True if the gesture is active.
#-------------------------------------------------------------------------------
get-start-point
Gets the point where the drag started.
If the $gesture is active, this function returns True
and fills in $x and $y with the drag start coordinates,
in widget-relative coordinates.
method get-start-point ( Num() $x, Num() $y --> Bool )
$x; (transfer ownership: full) X coordinate for the drag start point.
$y; (transfer ownership: full) Y coordinate for the drag start point.
Return value; True if the gesture is active.
#------------------------------------------------------------------------------- #--[Signal Documentation]------------------------------------------------------- #-------------------------------------------------------------------------------
Signals
drag-begin
Emitted whenever dragging starts.
method handler (
gdouble $start-x,
gdouble $start-y,
Int :$_handle_id,
N-GObject :$_native-object,
Gnome::Gtk4::GestureDrag :$_widget,
*%user-options
)
$start-x; X coordinate, relative to the widget allocation.
$start-y; Y coordinate, relative to the widget allocation.
$_handle_id; The registered event handler id.
$_native-object; The native object provided by the Raku object which registered this event. This is a native Gnome::Gtk4::GestureDrag object.
%user-options; A list of named arguments provided by .register-signal() in class Object.
drag-end
Emitted whenever the dragging is finished.
method handler (
gdouble $offset-x,
gdouble $offset-y,
Int :$_handle_id,
N-GObject :$_native-object,
Gnome::Gtk4::GestureDrag :$_widget,
*%user-options
)
$offset-x; X offset, relative to the start point.
$offset-y; Y offset, relative to the start point.
$_handle_id; The registered event handler id.
$_native-object; The native object provided by the Raku object which registered this event. This is a native Gnome::Gtk4::GestureDrag object.
%user-options; A list of named arguments provided by .register-signal() in class Object.
drag-update
Emitted whenever the dragging point moves.
method handler (
gdouble $offset-x,
gdouble $offset-y,
Int :$_handle_id,
N-GObject :$_native-object,
Gnome::Gtk4::GestureDrag :$_widget,
*%user-options
)
$offset-x; X offset, relative to the start point.
$offset-y; Y offset, relative to the start point.
$_handle_id; The registered event handler id.
$_native-object; The native object provided by the Raku object which registered this event. This is a native Gnome::Gtk4::GestureDrag object.
%user-options; A list of named arguments provided by .register-signal() in class Object.