DragSource


Object Hierarchy:

Object hierarchy for DragSource

Description:

[ CCode ( type_id = "gtk_drag_source_get_type ()" ) ]
public class DragSource : GestureSingle

GtkDragSource is an auxiliary object that is used to initiate Drag-And-Drop operations.

It can be set up with the necessary ingredients for a DND operation ahead of time. This includes the source for the data that is being transferred, in the form of a ContentProvider, the desired action, and the icon to use during the drag operation. After setting it up, the drag source must be added to a widget as an event controller, using add_controller.

Setting up the content provider and icon ahead of time only makes sense when the data does not change. More commonly, you will want to set them up just in time. To do so, DragSource has prepare and drag_begin signals. The prepare signal is emitted before a drag is started, and can be used to set the content provider and actions that the drag should be started with. The drag_begin signal is emitted after the Drag object has been created, and can be used to set up the drag icon.

During the DND operation, GtkDragSource emits signals that can be used to obtain updates about the status of the operation, but it is not normally necessary to connect to any signals, except for one case: when the supported actions include gdk_action_move , you need to listen for the drag_end signal and delete the data after it has been transferred.


Namespace: Gtk
Package: gtk4

Content:

Properties:

Creation methods:

Methods:

Signals:

Inherited Members: