DropTargetAsync
open class DropTargetAsync : EventController, DropTargetAsyncProtocol
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 [classGtk.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 [methodGtk.Widget.add_controller
].
During a drag operation, the first signal that a GtkDropTargetAsync
emits is [signalGtk.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
[signalGtk.DropTargetAsync::drag-enter
] signal, followed by
[signalGtk.DropTargetAsync::drag-motion
] signals as the pointer moves,
optionally a [signalGtk.DropTargetAsync::drop
] signal when a drop happens,
and finally a [signalGtk.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
[methodGdk.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.
The DropTargetAsync
type acts as a reference-counted owner of an underlying GtkDropTargetAsync
instance.
It provides the methods that can operate on this data type through DropTargetAsyncProtocol
conformance.
Use DropTargetAsync
as a strong reference or owner of a GtkDropTargetAsync
instance.
-
Designated initialiser from the underlying `C` data type.
This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the
DropTargetAsync
instance.Declaration
Swift
@inlinable public init(_ op: UnsafeMutablePointer<GtkDropTargetAsync>)
Parameters
op
pointer to the underlying object
-
Designated initialiser from a constant pointer to the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theDropTargetAsync
instance.Declaration
Swift
@inlinable public init(_ op: UnsafePointer<GtkDropTargetAsync>)
Parameters
op
pointer to the underlying object
-
Optional initialiser from a non-mutating
gpointer
to the underlyingC
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theDropTargetAsync
instance.Declaration
Swift
@inlinable override public init!(gpointer op: gpointer?)
Parameters
op
gpointer to the underlying object
-
Optional initialiser from a non-mutating
gconstpointer
to the underlyingC
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theDropTargetAsync
instance.Declaration
Swift
@inlinable override public init!(gconstpointer op: gconstpointer?)
Parameters
op
pointer to the underlying object
-
Optional initialiser from a constant pointer to the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theDropTargetAsync
instance.Declaration
Swift
@inlinable public init!(_ op: UnsafePointer<GtkDropTargetAsync>?)
Parameters
op
pointer to the underlying object
-
Optional initialiser from the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theDropTargetAsync
instance.Declaration
Swift
@inlinable public init!(_ op: UnsafeMutablePointer<GtkDropTargetAsync>?)
Parameters
op
pointer to the underlying object
-
Designated initialiser from the underlying
C
data type. Will retainGtkDropTargetAsync
. i.e., ownership is transferred to theDropTargetAsync
instance.Declaration
Swift
@inlinable public init(retaining op: UnsafeMutablePointer<GtkDropTargetAsync>)
Parameters
op
pointer to the underlying object
-
Reference intialiser for a related type that implements
DropTargetAsyncProtocol
Will retainGtkDropTargetAsync
.Declaration
Swift
@inlinable public init<T>(dropTargetAsync other: T) where T : DropTargetAsyncProtocol
Parameters
other
an instance of a related type that implements
DropTargetAsyncProtocol
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
DropTargetAsyncProtocol
.Declaration
Swift
@inlinable override public init<T>(cPointer p: UnsafeMutablePointer<T>)
Parameters
cPointer
pointer to the underlying object
-
Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
DropTargetAsyncProtocol
.Declaration
Swift
@inlinable override public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)
Parameters
cPointer
pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
DropTargetAsyncProtocol
.Declaration
Swift
@inlinable override public init(raw p: UnsafeRawPointer)
Parameters
p
raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
DropTargetAsyncProtocol
.Declaration
Swift
@inlinable override public init(retainingRaw raw: UnsafeRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
DropTargetAsyncProtocol
.Declaration
Swift
@inlinable public required init(raw p: UnsafeMutableRawPointer)
Parameters
p
mutable raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
DropTargetAsyncProtocol
.Declaration
Swift
@inlinable required public init(retainingRaw raw: UnsafeMutableRawPointer)
Parameters
raw
mutable raw pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
DropTargetAsyncProtocol
.Declaration
Swift
@inlinable override public init(opaquePointer p: OpaquePointer)
Parameters
p
opaque pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
DropTargetAsyncProtocol
.Declaration
Swift
@inlinable override public init(retainingOpaquePointer p: OpaquePointer)
Parameters
p
opaque pointer to the underlying object
-
Creates a new
GtkDropTargetAsync
object.Declaration
Swift
@inlinable public init<ContentFormatsT>(formats: ContentFormatsT?, actions: Gdk.DragAction) where ContentFormatsT : ContentFormatsProtocol