Object Hierarchy:

Object hierarchy for DropTarget


[ CCode ( type_id = "gtk_drop_target_get_type ()" ) ]
public class DropTarget : EventController

GtkDropTarget is an event controller implementing a simple way to receive Drag-and-Drop operations.

The most basic way to use a DropTarget to receive drops on a widget is to create it via DropTarget passing in the Type of the data you want to receive and connect to the GtkDropTarget: drop signal to receive the data.

DropTarget supports more options, such as:

* rejecting potential drops via the accept signal and the reject function to let other drop targets handle the drop * tracking an ongoing drag operation before the drop via the enter, motion and leave signals * configuring how to receive data by setting the preload property and listening for its availability via the value property

However, DropTarget is ultimately modeled in a synchronous way and only supports data transferred via Type. If you want full control over an ongoing drop, the DropTargetAsync object gives you this ability.

While a pointer is dragged over the drop target's widget and the drop has not been rejected, that widget will receive the gtk_state_flag_drop_active state, which can be used to style the widget.

Namespace: Gtk
Package: gtk4



Creation methods:



Inherited Members: