DragContextProtocol
public protocol DragContextProtocol : ObjectProtocol
The DragContextProtocol
protocol exposes the methods and properties of an underlying GdkDragContext
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 DragContext
.
Alternatively, use DragContextRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GdkDragContext
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
drag_context_ptr
Default implementationTyped pointer to the underlying
GdkDragContext
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GdkDragContext
instance.Declaration
Swift
var drag_context_ptr: UnsafeMutablePointer<GdkDragContext>! { get }
-
Required Initialiser for types conforming to
DragContextProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
connect(signal:
Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
DragContextSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: DragContextSignalName, 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
DragContextSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: DragContextSignalName, 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)
-
onActionChanged(flags:
Extension methodhandler: ) A new action is being chosen for the drag and drop operation.
This signal will only be emitted if the
GdkDragContext
manages the drag and drop operation. Seegdk_drag_context_manage_dnd()
for more information.Note
This represents the underlyingaction-changed
signalDeclaration
Swift
@discardableResult @inlinable func onActionChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragContextRef, _ action: DragAction) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
action
The action currently chosen
handler
The signal handler to call Run the given callback whenever the
actionChanged
signal is emitted -
actionChangedSignal
Extension methodTyped
action-changed
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var actionChangedSignal: DragContextSignalName { get }
-
onCancel(flags:
Extension methodhandler: ) The drag and drop operation was cancelled.
This signal will only be emitted if the
GdkDragContext
manages the drag and drop operation. Seegdk_drag_context_manage_dnd()
for more information.Note
This represents the underlyingcancel
signalDeclaration
Swift
@discardableResult @inlinable func onCancel(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragContextRef, _ reason: DragCancelReason) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
reason
The reason the context 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: DragContextSignalName { get }
-
onDndFinished(flags:
Extension methodhandler: ) The drag and drop operation was finished, the drag destination finished reading all data. The drag source can now free all miscellaneous data.
This signal will only be emitted if the
GdkDragContext
manages the drag and drop operation. Seegdk_drag_context_manage_dnd()
for more information.Note
This represents the underlyingdnd-finished
signalDeclaration
Swift
@discardableResult @inlinable func onDndFinished(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragContextRef) -> 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: DragContextSignalName { get }
-
onDropPerformed(flags:
Extension methodhandler: ) The drag and drop operation was performed on an accepting client.
This signal will only be emitted if the
GdkDragContext
manages the drag and drop operation. Seegdk_drag_context_manage_dnd()
for more information.Note
This represents the underlyingdrop-performed
signalDeclaration
Swift
@discardableResult @inlinable func onDropPerformed(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DragContextRef, _ time: Int) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
time
the time at which the drop happened.
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: DragContextSignalName { get }
-
getActions()
Extension methodDetermines the bitmask of actions proposed by the source if
gdk_drag_context_get_suggested_action()
returnsGDK_ACTION_ASK
.Declaration
Swift
@inlinable func getActions() -> DragAction
-
getDestWindow()
Extension methodReturns the destination window for the DND operation.
Declaration
Swift
@inlinable func getDestWindow() -> WindowRef!
-
getDevice()
Extension methodReturns the
GdkDevice
associated to the drag context.Declaration
Swift
@inlinable func getDevice() -> DeviceRef!
-
getDragWindow()
Extension methodReturns the window on which the drag icon should be rendered during the drag operation. Note that the window may not be available until the drag operation has begun. GDK will move the window in accordance with the ongoing drag operation. The window is owned by
context
and will be destroyed when the drag operation is over.Declaration
Swift
@inlinable func getDragWindow() -> WindowRef!
-
getProtocol()
Extension methodReturns the drag protocol that is used by this context.
Declaration
Swift
@inlinable func getProtocol() -> GdkDragProtocol
-
getSelectedAction()
Extension methodDetermines the action chosen by the drag destination.
Declaration
Swift
@inlinable func getSelectedAction() -> DragAction
-
getSourceWindow()
Extension methodReturns the
GdkWindow
where the DND operation started.Declaration
Swift
@inlinable func getSourceWindow() -> WindowRef!
-
getSuggestedAction()
Extension methodDetermines the suggested drag action of the context.
Declaration
Swift
@inlinable func getSuggestedAction() -> DragAction
-
listTargets()
Extension methodRetrieves the list of targets of the context.
Declaration
Swift
@inlinable func listTargets() -> GLib.ListRef!
-
manageDnd(ipcWindow:
Extension methodactions: ) Requests the drag and drop operation to be managed by
context
. When a drag and drop operation becomes managed, theGdkDragContext
will internally handle all input and source-sideGdkEventDND
events as required by the windowing system.Once the drag and drop operation is managed, the drag context will emit the following signals:
- The
GdkDragContext::action-changed
signal whenever the final action to be performed by the drag and drop operation changes. - The
GdkDragContext::drop-performed
signal after the user performs the drag and drop gesture (typically by releasing the mouse button). - The
GdkDragContext::dnd-finished
signal after the drag and drop operation concludes (after allGdkSelection
transfers happen). - The
GdkDragContext::cancel
signal if the drag and drop operation is finished but doesn’t happen over an accepting destination, or is cancelled through other means.
Declaration
Swift
@inlinable func manageDnd<WindowT>(ipcWindow: WindowT, actions: DragAction) -> Bool where WindowT : WindowProtocol
- The
-
set(device:
Extension method) Associates a
GdkDevice
tocontext
, so all Drag and Drop events forcontext
are emitted as if they came from this device.Declaration
Swift
@inlinable func set<DeviceT>(device: DeviceT) where DeviceT : DeviceProtocol
-
setHotspot(hotX:
Extension methodhotY: ) Sets the position of the drag window that will be kept under the cursor hotspot. Initially, the hotspot is at the top left corner of the drag window.
Declaration
Swift
@inlinable func setHotspot(hotX: Int, hotY: Int)
-
dragAbort(time_:
Extension method) Aborts a drag without dropping.
This function is called by the drag source.
This function does not need to be called in managed drag and drop operations. See
gdk_drag_context_manage_dnd()
for more information.Declaration
Swift
@inlinable func dragAbort(time_: guint32)
-
dragDrop(time_:
Extension method) Drops on the current destination.
This function is called by the drag source.
This function does not need to be called in managed drag and drop operations. See
gdk_drag_context_manage_dnd()
for more information.Declaration
Swift
@inlinable func dragDrop(time_: guint32)
-
dragDropDone(success:
Extension method) Inform GDK if the drop ended successfully. 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
context
.The
GdkDragContext
will only take the firstgdk_drag_drop_done()
call as effective, if this function is called multiple times, all subsequent calls will be ignored.Declaration
Swift
@inlinable func dragDropDone(success: Bool)
-
dragDropSucceeded()
Extension methodReturns whether the dropped data has been successfully transferred. This function is intended to be used while handling a
GDK_DROP_FINISHED
event, its return value is meaningless at other times.Declaration
Swift
@inlinable func dragDropSucceeded() -> Bool
-
Finds the destination window and DND protocol to use at the given pointer position.
This function is called by the drag source to obtain the
dest_window
andprotocol
parameters forgdk_drag_motion()
.Declaration
Swift
@inlinable func dragFindWindowForScreen<ScreenT, WindowT>(dragWindow: WindowT, screen: ScreenT, xRoot: Int, yRoot: Int, destWindow: UnsafeMutablePointer<UnsafeMutablePointer<GdkWindow>?>!, protocol: UnsafeMutablePointer<GdkDragProtocol>!) where ScreenT : ScreenProtocol, WindowT : WindowProtocol
-
dragGetSelection()
Extension methodReturns the selection atom for the current source window.
Declaration
Swift
@inlinable func dragGetSelection() -> GdkAtom!
-
Updates the drag context when the pointer moves or the set of actions changes.
This function is called by the drag source.
This function does not need to be called in managed drag and drop operations. See
gdk_drag_context_manage_dnd()
for more information.Declaration
Swift
@inlinable func dragMotion<WindowT>(destWindow: WindowT, protocol: GdkDragProtocol, xRoot: Int, yRoot: Int, suggestedAction: DragAction, possibleActions: DragAction, time_: guint32) -> Bool where WindowT : WindowProtocol
-
dragStatus(action:
Extension methodtime_: ) Selects one of the actions offered by the drag source.
This function is called by the drag destination in response to
gdk_drag_motion()
called by the drag source.Declaration
Swift
@inlinable func dragStatus(action: DragAction, time_: guint32)
-
dropFinish(success:
Extension methodtime_: ) Ends the drag operation after a drop.
This function is called by the drag destination.
Declaration
Swift
@inlinable func dropFinish(success: Bool, time_: guint32)
-
dropReply(accepted:
Extension methodtime_: ) Accepts or rejects a drop.
This function is called by the drag destination in response to a drop initiated by the drag source.
Declaration
Swift
@inlinable func dropReply(accepted: Bool, time_: guint32)
-
actions
Extension methodDetermines the bitmask of actions proposed by the source if
gdk_drag_context_get_suggested_action()
returnsGDK_ACTION_ASK
.Declaration
Swift
@inlinable var actions: DragAction { get }
-
destWindow
Extension methodReturns the destination window for the DND operation.
Declaration
Swift
@inlinable var destWindow: WindowRef! { get }
-
device
Extension methodReturns the
GdkDevice
associated to the drag context.Declaration
Swift
@inlinable var device: DeviceRef! { get nonmutating set }
-
dragWindow
Extension methodReturns the window on which the drag icon should be rendered during the drag operation. Note that the window may not be available until the drag operation has begun. GDK will move the window in accordance with the ongoing drag operation. The window is owned by
context
and will be destroyed when the drag operation is over.Declaration
Swift
@inlinable var dragWindow: WindowRef! { get }
-
protocol
Extension methodReturns the drag protocol that is used by this context.
Declaration
Swift
@inlinable var `protocol`: GdkDragProtocol { get }
-
selectedAction
Extension methodDetermines the action chosen by the drag destination.
Declaration
Swift
@inlinable var selectedAction: DragAction { get }
-
sourceWindow
Extension methodReturns the
GdkWindow
where the DND operation started.Declaration
Swift
@inlinable var sourceWindow: WindowRef! { get }
-
suggestedAction
Extension methodDetermines the suggested drag action of the context.
Declaration
Swift
@inlinable var suggestedAction: DragAction { get }