DropProtocol
public protocol DropProtocol : ObjectProtocol
The DropProtocol protocol exposes the methods and properties of an underlying GdkDrop instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see Drop.
Alternatively, use DropRef as a lighweight, unowned reference if you already have an instance you just want to use.
The GdkDrop object represents the target of an ongoing DND operation.
Possible drop sites get informed about the status of the ongoing drag
operation with events of type GDK_DRAG_ENTER, GDK_DRAG_LEAVE,
GDK_DRAG_MOTION and GDK_DROP_START. The GdkDrop object can be obtained
from these [classGdk.Event] types using [methodGdk.DNDEvent.get_drop].
The actual data transfer is initiated from the target side via an async
read, using one of the GdkDrop methods for this purpose:
[methodGdk.Drop.read_async] or [methodGdk.Drop.read_value_async].
GTK provides a higher level abstraction based on top of these functions, and so they are not normally needed in GTK applications. See the “Drag and Drop” section of the GTK documentation for more information.
-
Untyped pointer to the underlying
GdkDropinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
drop_ptrDefault implementationTyped pointer to the underlying
GdkDropinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GdkDropinstance.Declaration
Swift
var drop_ptr: UnsafeMutablePointer<GdkDrop>! { get } -
Required Initialiser for types conforming to
DropProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
DropPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: DropPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocolParameters
source_propertythe source property to bind
targetthe target object to bind to
target_propertythe target property to bind to
flagsthe flags to pass to the
Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a Drop property
Declaration
Swift
@inlinable func get(property: DropPropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) Set the value of a Drop property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: DropPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
finish(action:Extension method) Ends the drag operation after a drop.
The
actionmust be a single action selected from the actions available via [methodGdk.Drop.get_actions].Declaration
Swift
@inlinable func finish(action: DragAction) -
getActions()Extension methodReturns the possible actions for this
GdkDrop.If this value contains multiple actions - i.e. [func
Gdk.DragAction.is_unique] returnsfalsefor the result - [methodGdk.Drop.finish] must choose the action to use when accepting the drop. This will only happen if you passedGDK_ACTION_ASKas one of the possible actions in [methodGdk.Drop.status].GDK_ACTION_ASKitself will not be included in the actions returned by this function.This value may change over the lifetime of the [class
Gdk.Drop] both as a response to source side actions as well as to calls to [methodGdk.Drop.status] or [methodGdk.Drop.finish]. The source side will not change this value anymore once a drop has started.Declaration
Swift
@inlinable func getActions() -> DragAction -
getDevice()Extension methodReturns the
GdkDeviceperforming the drop.Declaration
Swift
@inlinable func getDevice() -> DeviceRef! -
getDisplay()Extension methodGets the
GdkDisplaythatselfwas created for.Declaration
Swift
@inlinable func getDisplay() -> DisplayRef! -
getDrag()Extension methodIf this is an in-app drag-and-drop operation, returns the
GdkDragthat corresponds to this drop.If it is not,
nilis returned.Declaration
Swift
@inlinable func getDrag() -> DragRef! -
getFormats()Extension methodReturns the
GdkContentFormatsthat the drop offers the data to be read in.Declaration
Swift
@inlinable func getFormats() -> ContentFormatsRef! -
getSurface()Extension methodReturns the
GdkSurfaceperforming the drop.Declaration
Swift
@inlinable func getSurface() -> SurfaceRef! -
readAsync(mimeTypes:Extension methodioPriority: cancellable: callback: userData: ) Asynchronously read the dropped data from a
GdkDropin a format that complies with one of the mime types.Declaration
Swift
@inlinable func readAsync(mimeTypes: UnsafeMutablePointer<UnsafePointer<CChar>?>!, ioPriority: Int, cancellable: GIO.CancellableRef? = nil, callback: GAsyncReadyCallback? = nil, userData: gpointer! = nil) -
readAsync(mimeTypes:Extension methodioPriority: cancellable: callback: userData: ) Asynchronously read the dropped data from a
GdkDropin a format that complies with one of the mime types.Declaration
Swift
@inlinable func readAsync<CancellableT>(mimeTypes: UnsafeMutablePointer<UnsafePointer<CChar>?>!, ioPriority: Int, cancellable: CancellableT?, callback: GAsyncReadyCallback? = nil, userData: gpointer! = nil) where CancellableT : CancellableProtocol -
readFinish(result:Extension methodoutMimeType: ) Finishes an async drop read operation.
Note that you must not use blocking read calls on the returned stream in the GTK thread, since some platforms might require communication with GTK to complete the data transfer. You can use async APIs such as
g_input_stream_read_bytes_async().See [method
Gdk.Drop.read_async].Declaration
Swift
@inlinable func readFinish<AsyncResultT>(result: AsyncResultT, outMimeType: UnsafeMutablePointer<UnsafePointer<CChar>?>!) throws -> GIO.InputStreamRef! where AsyncResultT : AsyncResultProtocol -
readValueAsync(type:Extension methodioPriority: cancellable: callback: userData: ) Asynchronously request the drag operation’s contents converted to the given
type.When the operation is finished
callbackwill be called. You must then call [methodGdk.Drop.read_value_finish] to get the resultingGValue.For local drag'n'drop operations that are available in the given
GType, the value will be copied directly. Otherwise, GDK will try to use [funcGdk.content_deserialize_async] to convert the data.Declaration
Swift
@inlinable func readValueAsync(type: GType, ioPriority: Int, cancellable: GIO.CancellableRef? = nil, callback: GAsyncReadyCallback? = nil, userData: gpointer! = nil) -
readValueAsync(type:Extension methodioPriority: cancellable: callback: userData: ) Asynchronously request the drag operation’s contents converted to the given
type.When the operation is finished
callbackwill be called. You must then call [methodGdk.Drop.read_value_finish] to get the resultingGValue.For local drag'n'drop operations that are available in the given
GType, the value will be copied directly. Otherwise, GDK will try to use [funcGdk.content_deserialize_async] to convert the data.Declaration
Swift
@inlinable func readValueAsync<CancellableT>(type: GType, ioPriority: Int, cancellable: CancellableT?, callback: GAsyncReadyCallback? = nil, userData: gpointer! = nil) where CancellableT : CancellableProtocol -
readValueFinish(result:Extension method) Finishes an async drop read.
See [method
Gdk.Drop.read_value_async].Declaration
Swift
@inlinable func readValueFinish<AsyncResultT>(result: AsyncResultT) throws -> GLibObject.ValueRef! where AsyncResultT : AsyncResultProtocol -
status(actions:Extension methodpreferred: ) Selects all actions that are potentially supported by the destination.
When calling this function, do not restrict the passed in actions to the ones provided by [method
Gdk.Drop.get_actions]. Those actions may change in the future, even depending on the actions you provide here.The
preferredaction is a hint to the drag'n'drop mechanism about which action to use when multiple actions are possible.This function should be called by drag destinations in response to
GDK_DRAG_ENTERorGDK_DRAG_MOTIONevents. If the destination does not yet know the exact actions it supports, it should set any possible actions first and then later call this function again.Declaration
Swift
@inlinable func status(actions: DragAction, preferred: DragAction) -
actionsExtension methodThe possible actions for this drop
Declaration
Swift
@inlinable var actions: DragAction { get } -
deviceExtension methodThe
GdkDeviceperforming the dropDeclaration
Swift
@inlinable var device: DeviceRef! { get } -
displayExtension methodThe
GdkDisplaythat the drop belongs to.Declaration
Swift
@inlinable var display: DisplayRef! { get } -
dragExtension methodThe
GdkDragthat initiated this dropDeclaration
Swift
@inlinable var drag: DragRef! { get } -
formatsExtension methodThe possible formats that the drop can provide its data in.
Declaration
Swift
@inlinable var formats: ContentFormatsRef! { get } -
surfaceExtension methodThe
GdkSurfacethe drop happens onDeclaration
Swift
@inlinable var surface: SurfaceRef! { get }
View on GitHub
Install in Dash
DropProtocol Protocol Reference