DropTargetAsync

open class DropTargetAsync(pointer: <Error class: unknown class><<Error class: unknown class>>) : EventController

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 class@Gtk.DropTarget, 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 method@Gtk.Widget.add_controller.

During a drag operation, the first signal that a GtkDropTargetAsync emits is signal@Gtk.DropTargetAsync::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 signal@Gtk.DropTargetAsync::drag-enter signal, followed by signal@Gtk.DropTargetAsync::drag-motion signals as the pointer moves, optionally a signal@Gtk.DropTargetAsync::drop signal when a drop happens, and finally a signal@Gtk.DropTargetAsync::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 method@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

Link copied to clipboard
constructor(formats: <Error class: unknown class>? = null, actions: <Error class: unknown class>)

Creates a new GtkDropTargetAsync object.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open var actions: <Error class: unknown class>

The GdkDragActions that this drop target supports.

Link copied to clipboard
open var formats: <Error class: unknown class>?

The GdkContentFormats that determines the supported data formats.

Link copied to clipboard
val gtkDropTargetAsyncPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
val gtkEventControllerPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open var name: String?

The name for this controller, typically used for debugging purposes.

Link copied to clipboard

The limit for which events this controller will handle.

Link copied to clipboard

The propagation phase at which this controller will handle events.

Link copied to clipboard
open val widget: Widget?

The widget receiving the GdkEvents that the controller will handle.

Functions

Link copied to clipboard
fun connectAccept(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>) -> Boolean): <Error class: unknown class>

Emitted on the drop site when a drop operation is about to begin.

Link copied to clipboard
fun connectDragEnter(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>, x: Double, y: Double) -> <Error class: unknown class>): <Error class: unknown class>

Emitted on the drop site when the pointer enters the widget.

Link copied to clipboard
fun connectDragLeave(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>) -> Unit): <Error class: unknown class>

Emitted on the drop site when the pointer leaves the widget.

Link copied to clipboard
fun connectDragMotion(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>, x: Double, y: Double) -> <Error class: unknown class>): <Error class: unknown class>

Emitted while the pointer is moving over the drop target.

Link copied to clipboard
fun connectDrop(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>, x: Double, y: Double) -> Boolean): <Error class: unknown class>

Emitted on the drop site when the user drops the data onto the widget.

Link copied to clipboard
open fun getActions(): <Error class: unknown class>

Gets the actions that this drop target supports.

Link copied to clipboard
open fun getCurrentEvent(): <Error class: unknown class>?

Returns the event that is currently being handled by the controller.

Link copied to clipboard
open fun getCurrentEventDevice(): <Error class: unknown class>?

Returns the device of the event that is currently being handled by the controller.

Link copied to clipboard
open fun getCurrentEventState(): <Error class: unknown class>

Returns the modifier state of the event that is currently being handled by the controller.

Link copied to clipboard
open fun getCurrentEventTime(): <Error class: unknown class>

Returns the timestamp of the event that is currently being handled by the controller.

Link copied to clipboard
open fun getFormats(): <Error class: unknown class>?

Gets the data formats that this drop target accepts.

Link copied to clipboard
open fun getName(): String?

Gets the name of @controller.

Link copied to clipboard

Gets the propagation limit of the event controller.

Link copied to clipboard

Gets the propagation phase at which @controller handles events.

Link copied to clipboard
open fun getWidget(): Widget?

Returns the GtkWidget this controller relates to.

Link copied to clipboard
open fun rejectDrop(drop: <Error class: unknown class>)

Sets the @drop as not accepted on this drag site.

Link copied to clipboard
open fun reset()

Resets the @controller to a clean state.

Link copied to clipboard
open fun setActions(actions: <Error class: unknown class>)

Sets the actions that this drop target supports.

Link copied to clipboard
open fun setFormats(formats: <Error class: unknown class>? = null)

Sets the data formats that this drop target will accept.

Link copied to clipboard
open fun setName(name: String? = null)

Sets a name on the controller that can be used for debugging.

Link copied to clipboard

Sets the event propagation limit on the event controller.

Link copied to clipboard

Sets the propagation phase at which a controller handles events.

Link copied to clipboard
open fun setStaticName(name: String? = null)

Sets a name on the controller that can be used for debugging.