Gnome::Gtk4::DragIcon
Description
Gnome::Gtk4::DragIcon is a Gnome::Gtk4::R-Root implementation for drag icons.
A drag icon moves with the pointer during a Drag-and-Drop operation and is destroyed when the drag ends.
To set up a drag icon and associate it with an ongoing drag operation, use .DragIcon.get-for-drag()
to get the icon for a drag. You can then use it like any other widget and use .set-child()
to set whatever widget should be used for the drag icon.
Keep in mind that drag icons do not allow user input.
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-child
Gets the widget currently used as drag icon.
method get-child (--> N-Object )
Return value; The drag icon.
set-child
Sets the widget to display as the drag icon.
method set-child ( N-Object() $child )
$child; a Gnome::Gtk4::Widget.
Functions
create-widget-for-value
Creates a widget that can be used as a drag icon for the given $value
.
Supported types include strings, Gnome::Gdk4::N-RGBA and Gnome::Gtk4::TextBuffer. If GTK does not know how to create a widget for a given value, it will return undefined.
This method is used to set the default drag icon on drag-and-drop operations started by Gnome::Gtk4::DragSource, so you don't need to set a drag icon using this function there.
method create-widget-for-value ( N-Object $value --> N-Object )
$value; a Gnome::GObject::N-Value
Return value; A new Gnome::Gtk4::Widget for displaying $value
as a drag icon..
get-for-drag
Gets the Gnome::Gtk4::DragIcon in use with $drag
.
If no drag icon exists yet, a new one will be created and shown.
method get-for-drag ( N-Object() $drag --> N-Object )
$drag; a Gnome::Gdk4::Drag.
Return value; the Gnome::Gtk4::DragIcon.
set-from-paintable
Creates a Gnome::Gtk4::DragIcon that shows $paintable
, and associates it with the drag operation.
The hotspot position on the paintable is aligned with the hotspot of the cursor.
method set-from-paintable ( N-Object() $drag, N-Object() $paintable, Int() $hot-x, Int() $hot-y )
$drag; a Gnome::Gdk4::Drag.
$paintable; a Gnome::Gdk4::R-Paintable to display.
$hot-x; X coordinate of the hotspot.
$hot-y; Y coordinate of the hotspot.