Class
GtkDropTargetAsync
Description [src]
final class Gtk.DropTargetAsync : Gtk.EventController {
/* No available fields */
}
GtkDropTargetAsync is an event controller to receive Drag-and-Drop
operations, asynchronously.
It is the more complete but also more complex method of handling drop
operations compared to GtkDropTarget, and you should only use
it if GtkDropTarget doesn’t provide all the features you need.
To use a GtkDropTargetAsync to receive drops on a widget, you create
a GtkDropTargetAsync object, configure which data formats and actions
you support, connect to its signals, and then attach it to the widget
with gtk_widget_add_controller().
During a drag operation, the first signal that a GtkDropTargetAsync
emits is GtkDropTargetAsync::accept, which is meant to determine
whether the target is a possible drop site for the ongoing drop. The
default handler for the ::accept signal accepts the drop if it finds
a compatible data format and an action that is supported on both sides.
If it is, and the widget becomes a target, you will receive a
GtkDropTargetAsync::drag-enter signal, followed by
GtkDropTargetAsync::drag-motion signals as the pointer moves,
optionally a GtkDropTargetAsync::drop signal when a drop happens,
and finally a GtkDropTargetAsync::drag-leave signal when the
pointer moves off the widget.
The ::drag-enter and ::drag-motion handler return a GdkDragAction
to update the status of the ongoing operation. The ::drop handler
should decide if it ultimately accepts the drop and if it does, it
should initiate the data transfer and finish the operation by calling
gdk_drop_finish().
Between the ::drag-enter and ::drag-leave signals the widget is a
current drop target, and will receive the GTK_STATE_FLAG_DROP_ACTIVE
state, which can be used by themes to style the widget as a drop target.
Constructors
gtk_drop_target_async_new
Creates a new GtkDropTargetAsync object.
Instance methods
gtk_drop_target_async_get_actions
Gets the actions that this drop target supports.
gtk_drop_target_async_get_formats
Gets the data formats that this drop target accepts.
gtk_drop_target_async_reject_drop
Sets the drop as not accepted on this drag site.
gtk_drop_target_async_set_actions
Sets the actions that this drop target supports.
gtk_drop_target_async_set_formats
Sets the data formats that this drop target will accept.
Methods inherited from GtkEventController (13)
gtk_event_controller_get_current_event
Returns the event that is currently being handled by the controller.
gtk_event_controller_get_current_event_device
Returns the device of the event that is currently being handled by the controller.
gtk_event_controller_get_current_event_state
Returns the modifier state of the event that is currently being handled by the controller.
gtk_event_controller_get_current_event_time
Returns the timestamp of the event that is currently being handled by the controller.
gtk_event_controller_get_name
Gets the name of controller.
gtk_event_controller_get_propagation_limit
Gets the propagation limit of the event controller.
gtk_event_controller_get_propagation_phase
Gets the propagation phase at which controller handles events.
gtk_event_controller_get_widget
Returns the GtkWidget this controller relates to.
gtk_event_controller_reset
Resets the controller to a clean state.
gtk_event_controller_set_name
Sets a name on the controller that can be used for debugging.
gtk_event_controller_set_propagation_limit
Sets the event propagation limit on the event controller.
gtk_event_controller_set_propagation_phase
Sets the propagation phase at which a controller handles events.
gtk_event_controller_set_static_name
Sets a name on the controller that can be used for debugging.
Available since: 4.8
Properties
Gtk.DropTargetAsync:actions
The GdkDragActions that this drop target supports.
Gtk.DropTargetAsync:formats
The GdkContentFormats that determines the supported data formats.
Properties inherited from GtkEventController (4)
Gtk.EventController:name
The name for this controller, typically used for debugging purposes.
Gtk.EventController:propagation-limit
The limit for which events this controller will handle.
Gtk.EventController:propagation-phase
The propagation phase at which this controller will handle events.
Gtk.EventController:widget
The widget receiving the GdkEvents that the controller will handle.
Signals
Gtk.DropTargetAsync::accept
Emitted on the drop site when a drop operation is about to begin.
Gtk.DropTargetAsync::drag-enter
Emitted on the drop site when the pointer enters the widget.
Gtk.DropTargetAsync::drag-leave
Emitted on the drop site when the pointer leaves the widget.
Gtk.DropTargetAsync::drag-motion
Emitted while the pointer is moving over the drop target.
Gtk.DropTargetAsync::drop
Emitted on the drop site when the user drops the data onto the widget.
Signals inherited from GObject (1)
GObject.Object::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.