DragProtocol
public protocol DragProtocol : ObjectProtocol
The DragProtocol protocol exposes the methods and properties of an underlying GdkDrag 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 Drag.
Alternatively, use DragRef as a lighweight, unowned reference if you already have an instance you just want to use.
The GdkDrag object represents the source of an ongoing DND operation.
A GdkDrag is created when a drag is started, and stays alive for duration of
the DND operation. After a drag has been started with [funcGdk.Drag.begin],
the caller gets informed about the status of the ongoing drag operation
with signals on the GdkDrag object.
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
GdkDraginstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
drag_ptrDefault implementationTyped pointer to the underlying
GdkDraginstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GdkDraginstance.Declaration
Swift
var drag_ptr: UnsafeMutablePointer<GdkDrag>! { get } -
Required Initialiser for types conforming to
DragProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
DragPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: DragPropertyName, 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 Drag property
Declaration
Swift
@inlinable func get(property: DragPropertyName) -> 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 Drag property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: DragPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
connect(signal:Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
DragSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: DragSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatahandlerThe Swift signal handler (function or callback) to invoke on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
connect(signal:Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
DragSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: DragSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatasignalHandlerThe C function to be called on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
onCancel(flags:Extension methodhandler: ) Emitted when the drag operation is cancelled.
Note
This represents the underlyingcancelsignalDeclaration
Swift
@discardableResult @inlinable func onCancel(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef, _ reason: DragCancelReason) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
reasonThe reason the drag was cancelled
handlerThe signal handler to call Run the given callback whenever the
cancelsignal is emitted -
cancelSignalExtension methodTyped
cancelsignal for using theconnect(signal:)methodsDeclaration
Swift
static var cancelSignal: DragSignalName { get } -
onDndFinished(flags:Extension methodhandler: ) Emitted when the destination side has finished reading all data.
The drag object can now free all miscellaneous data.
Note
This represents the underlyingdnd-finishedsignalDeclaration
Swift
@discardableResult @inlinable func onDndFinished(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
dndFinishedsignal is emitted -
dndFinishedSignalExtension methodTyped
dnd-finishedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var dndFinishedSignal: DragSignalName { get } -
onDropPerformed(flags:Extension methodhandler: ) Emitted when the drop operation is performed on an accepting client.
Note
This represents the underlyingdrop-performedsignalDeclaration
Swift
@discardableResult @inlinable func onDropPerformed(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
dropPerformedsignal is emitted -
dropPerformedSignalExtension methodTyped
drop-performedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var dropPerformedSignal: DragSignalName { get } -
onNotifyActions(flags:Extension methodhandler: ) 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.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this: (C Language Example):g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::actionssignalDeclaration
Swift
@discardableResult @inlinable func onNotifyActions(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyActionssignal is emitted -
notifyActionsSignalExtension methodTyped
notify::actionssignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyActionsSignal: DragSignalName { get } -
onNotifyContent(flags:Extension methodhandler: ) 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.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this: (C Language Example):g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::contentsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyContent(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyContentsignal is emitted -
notifyContentSignalExtension methodTyped
notify::contentsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyContentSignal: DragSignalName { get } -
onNotifyDevice(flags:Extension methodhandler: ) 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.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this: (C Language Example):g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::devicesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyDevice(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyDevicesignal is emitted -
notifyDeviceSignalExtension methodTyped
notify::devicesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyDeviceSignal: DragSignalName { get } -
onNotifyDisplay(flags:Extension methodhandler: ) 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.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this: (C Language Example):g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::displaysignalDeclaration
Swift
@discardableResult @inlinable func onNotifyDisplay(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyDisplaysignal is emitted -
notifyDisplaySignalExtension methodTyped
notify::displaysignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyDisplaySignal: DragSignalName { get } -
onNotifyFormats(flags:Extension methodhandler: ) 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.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this: (C Language Example):g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::formatssignalDeclaration
Swift
@discardableResult @inlinable func onNotifyFormats(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyFormatssignal is emitted -
notifyFormatsSignalExtension methodTyped
notify::formatssignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyFormatsSignal: DragSignalName { get } -
onNotifySelectedAction(flags:Extension methodhandler: ) 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.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this: (C Language Example):g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::selected-actionsignalDeclaration
Swift
@discardableResult @inlinable func onNotifySelectedAction(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifySelectedActionsignal is emitted -
notifySelectedActionSignalExtension methodTyped
notify::selected-actionsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifySelectedActionSignal: DragSignalName { get } -
onNotifySurface(flags:Extension methodhandler: ) 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.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this: (C Language Example):g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::surfacesignalDeclaration
Swift
@discardableResult @inlinable func onNotifySurface(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifySurfacesignal is emitted -
notifySurfaceSignalExtension methodTyped
notify::surfacesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifySurfaceSignal: DragSignalName { get }
-
dropDone(success:Extension method) Informs GDK that the drop ended.
Passing
falseforsuccessmay trigger a drag cancellation animation.This function is called by the drag source, and should be the last call before dropping the reference to the
drag.The
GdkDragwill only take the first [methodGdk.Drag.drop_done] call as effective, if this function is called multiple times, all subsequent calls will be ignored.Declaration
Swift
@inlinable func dropDone(success: Bool) -
getActions()Extension methodDetermines the bitmask of possible actions proposed by the source.
Declaration
Swift
@inlinable func getActions() -> DragAction -
getContent()Extension methodReturns the
GdkContentProviderassociated to theGdkDragobject.Declaration
Swift
@inlinable func getContent() -> ContentProviderRef! -
getDevice()Extension methodReturns the
GdkDeviceassociated to theGdkDragobject.Declaration
Swift
@inlinable func getDevice() -> DeviceRef! -
getDisplay()Extension methodGets the
GdkDisplaythat the drag object was created for.Declaration
Swift
@inlinable func getDisplay() -> DisplayRef! -
getDragSurface()Extension methodReturns the surface on which the drag icon should be rendered during the drag operation.
Note that the surface may not be available until the drag operation has begun. GDK will move the surface in accordance with the ongoing drag operation. The surface is owned by
dragand will be destroyed when the drag operation is over.Declaration
Swift
@inlinable func getDragSurface() -> SurfaceRef! -
getFormats()Extension methodRetrieves the formats supported by this
GdkDragobject.Declaration
Swift
@inlinable func getFormats() -> ContentFormatsRef! -
getSelectedAction()Extension methodDetermines the action chosen by the drag destination.
Declaration
Swift
@inlinable func getSelectedAction() -> DragAction -
getSurface()Extension methodReturns the
GdkSurfacewhere the drag originates.Declaration
Swift
@inlinable func getSurface() -> SurfaceRef! -
setHotspot(hotX:Extension methodhotY: ) Sets the position of the drag surface that will be kept under the cursor hotspot.
Initially, the hotspot is at the top left corner of the drag surface.
Declaration
Swift
@inlinable func setHotspot(hotX: Int, hotY: Int) -
actionsExtension methodThe possible actions of this drag.
Declaration
Swift
@inlinable var actions: DragAction { get } -
contentExtension methodThe
GdkContentProvider.Declaration
Swift
@inlinable var content: ContentProviderRef! { get } -
deviceExtension methodThe
GdkDevicethat is performing the drag.Declaration
Swift
@inlinable var device: DeviceRef! { get } -
displayExtension methodThe
GdkDisplaythat the drag belongs to.Declaration
Swift
@inlinable var display: DisplayRef! { get } -
dragSurfaceExtension methodReturns the surface on which the drag icon should be rendered during the drag operation.
Note that the surface may not be available until the drag operation has begun. GDK will move the surface in accordance with the ongoing drag operation. The surface is owned by
dragand will be destroyed when the drag operation is over.Declaration
Swift
@inlinable var dragSurface: SurfaceRef! { get } -
formatsExtension methodThe possible formats that the drag can provide its data in.
Declaration
Swift
@inlinable var formats: ContentFormatsRef! { get } -
selectedActionExtension methodDetermines the action chosen by the drag destination.
Declaration
Swift
@inlinable var selectedAction: DragAction { get } -
surfaceExtension methodThe surface where the drag originates.
Declaration
Swift
@inlinable var surface: SurfaceRef! { get }
View on GitHub
Install in Dash
DragProtocol Protocol Reference