Package: gtk
Class gtk:drop-target-async
Superclassesgtk:event-controller, gobject:object, common-lisp:standard-object, common-lisp:t Documented Subclasses
None
Direct SlotsDetails The gtk:drop-target-async object is an auxiliary object that can be
used to receive Drag-and-Drop operations.
It is the more complete but also more complex method of handling drop
operations compared to GtkDropTarget and you should only use it if gtk:drop-target object does not provide all the features you need. To use a gtk:drop-target-async object to receive drops on a widget, you create a gtk:drop-target-async object, configure which data formats and actions you support, connect to its signals, and then attach it to the widget with the gtk:widget-add-controller function. During a drag operation, the first signal that a gtk:drop-target-async object emits is the "accept" signal, 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 "drag-enter" signal, followed by "drag-motion" signals as the pointer moves, optionally a "drop" signal when a drop happens, and finally a "drag-leave" signal when the pointer moves off the widget. The "drag-enter" and "drag-motion" handler return a gdk:drag-action value to update the status of the ongoing operation. The "drop" signal 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 the gdk:drop-finish function. Between the "drag-enter" and "drag-leave" signals the widget is a current drop target, and will receive the :drop-active state of the gtk:state-flags flags, which can be used by themes to style the widget as a drop target. Signal DetailsThe "accept" signallambda (target drop) :run-last
The "drag-enter" signallambda (target drop x y) :run-last
The "drag-leave" signallambda (target drop) :run-lastThe signal is emitted on the drop site when the pointer leaves the widget. Its main purpose it to undo things done in the "drag-enter" signal handler.
The "drag-motion" signallambda (target drop x y) :run-lastThe signal is emitted while the pointer is moving over the drop target.
The "drop" signallambda (target drop x y) :run-lastThe signal is emitted on the drop site when the user drops the data onto the widget. The signal handler must determine whether the pointer position is in a drop zone or not. If it is not in a drop zone, it returns false and no further processing is necessary. Otherwise, the handler returns true. In this case, this handler will accept the drop. The handler must ensure that the gdk:drop-finish function is called to let the source know that the drop is done. The call to the gdk:drop-finish function must only be done when all data has been received. To receive the data, use one of the read functions provides by the gdk:drop object such as the gdk:drop-read-async or gdk:drop-read-value-async functions.
| Returned bySlot Access FunctionsInherited Slot Access Functions
See also |
2024-11-2