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
GdkDrag
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
drag_ptr
Default implementationTyped pointer to the underlying
GdkDrag
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GdkDrag
instance.Declaration
Swift
var drag_ptr: UnsafeMutablePointer<GdkDrag>! { get }
-
Required Initialiser for types conforming to
DragProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
DragPropertyName
source 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 : ObjectProtocol
Parameters
source_property
the source property to bind
target
the target object to bind to
target_property
the target property to bind to
flags
the flags to pass to the
Binding
transform_from
ValueTransformer
to use for forward transformationtransform_to
ValueTransformer
to use for backwards transformationReturn Value
binding reference or
nil
in case of an error -
get(property:
Extension method) Get the value of a Drag property
Declaration
Swift
@inlinable func get(property: DragPropertyName) -> GLibObject.Value
Parameters
property
the 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
property
the 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
DragSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: DragSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> Int
Parameters
signal
The signal to connect
flags
The connection flags to use
data
A pointer to user data to provide to the callback
destroyData
A
GClosureNotify
C function to destroy the data pointed to byuserData
handler
The 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
DragSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: DragSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> Int
Parameters
signal
The signal to connect
flags
The connection flags to use
data
A pointer to user data to provide to the callback
destroyData
A
GClosureNotify
C function to destroy the data pointed to byuserData
signalHandler
The 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 underlyingcancel
signalDeclaration
Swift
@discardableResult @inlinable func onCancel(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef, _ reason: DragCancelReason) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
reason
The reason the drag was cancelled
handler
The signal handler to call Run the given callback whenever the
cancel
signal is emitted -
cancelSignal
Extension methodTyped
cancel
signal 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-finished
signalDeclaration
Swift
@discardableResult @inlinable func onDndFinished(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
dndFinished
signal is emitted -
dndFinishedSignal
Extension methodTyped
dnd-finished
signal 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-performed
signalDeclaration
Swift
@discardableResult @inlinable func onDropPerformed(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
dropPerformed
signal is emitted -
dropPerformedSignal
Extension methodTyped
drop-performed
signal 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 innotify
being 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::actions
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyActions(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyActions
signal is emitted -
notifyActionsSignal
Extension methodTyped
notify::actions
signal 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 innotify
being 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::content
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyContent(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyContent
signal is emitted -
notifyContentSignal
Extension methodTyped
notify::content
signal 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 innotify
being 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::device
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyDevice(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyDevice
signal is emitted -
notifyDeviceSignal
Extension methodTyped
notify::device
signal 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 innotify
being 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::display
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyDisplay(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyDisplay
signal is emitted -
notifyDisplaySignal
Extension methodTyped
notify::display
signal 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 innotify
being 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::formats
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyFormats(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyFormats
signal is emitted -
notifyFormatsSignal
Extension methodTyped
notify::formats
signal 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 innotify
being 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-action
signalDeclaration
Swift
@discardableResult @inlinable func onNotifySelectedAction(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifySelectedAction
signal is emitted -
notifySelectedActionSignal
Extension methodTyped
notify::selected-action
signal 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 innotify
being 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::surface
signalDeclaration
Swift
@discardableResult @inlinable func onNotifySurface(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifySurface
signal is emitted -
notifySurfaceSignal
Extension methodTyped
notify::surface
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifySurfaceSignal: DragSignalName { get }
-
dropDone(success:
Extension method) Informs GDK that the drop ended.
Passing
false
forsuccess
may 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
GdkDrag
will 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
GdkContentProvider
associated to theGdkDrag
object.Declaration
Swift
@inlinable func getContent() -> ContentProviderRef!
-
getDevice()
Extension methodReturns the
GdkDevice
associated to theGdkDrag
object.Declaration
Swift
@inlinable func getDevice() -> DeviceRef!
-
getDisplay()
Extension methodGets the
GdkDisplay
that 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
drag
and will be destroyed when the drag operation is over.Declaration
Swift
@inlinable func getDragSurface() -> SurfaceRef!
-
getFormats()
Extension methodRetrieves the formats supported by this
GdkDrag
object.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
GdkSurface
where 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)
-
actions
Extension methodThe possible actions of this drag.
Declaration
Swift
@inlinable var actions: DragAction { get }
-
content
Extension methodThe
GdkContentProvider
.Declaration
Swift
@inlinable var content: ContentProviderRef! { get }
-
device
Extension methodThe
GdkDevice
that is performing the drag.Declaration
Swift
@inlinable var device: DeviceRef! { get }
-
display
Extension methodThe
GdkDisplay
that the drag belongs to.Declaration
Swift
@inlinable var display: DisplayRef! { get }
-
dragSurface
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
drag
and will be destroyed when the drag operation is over.Declaration
Swift
@inlinable var dragSurface: SurfaceRef! { get }
-
formats
Extension methodThe possible formats that the drag can provide its data in.
Declaration
Swift
@inlinable var formats: ContentFormatsRef! { get }
-
selectedAction
Extension methodDetermines the action chosen by the drag destination.
Declaration
Swift
@inlinable var selectedAction: DragAction { get }
-
surface
Extension methodThe surface where the drag originates.
Declaration
Swift
@inlinable var surface: SurfaceRef! { get }