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.

  • ptr

    Untyped pointer to the underlying GdkDragContext instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • drag_context_ptr Default implementation

    Typed 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)

DragContext signals

  • Connect a Swift signal handler to the given, typed DragContextSignalName signal

    Declaration

    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 by userData

    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 a C signal handler to the given, typed DragContextSignalName signal

    Declaration

    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 by userData

    signalHandler

    The C function to be called on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • 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. See gdk_drag_context_manage_dnd() for more information.

    Note

    This represents the underlying action-changed signal

    Declaration

    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 method

    Typed action-changed signal for using the connect(signal:) methods

    Declaration

    Swift

    static var actionChangedSignal: DragContextSignalName { get }
  • onCancel(flags:handler:) Extension method

    The drag and drop operation was cancelled.

    This signal will only be emitted if the GdkDragContext manages the drag and drop operation. See gdk_drag_context_manage_dnd() for more information.

    Note

    This represents the underlying cancel signal

    Declaration

    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 method

    Typed cancel signal for using the connect(signal:) methods

    Declaration

    Swift

    static var cancelSignal: DragContextSignalName { get }
  • 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. See gdk_drag_context_manage_dnd() for more information.

    Note

    This represents the underlying dnd-finished signal

    Declaration

    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 method

    Typed dnd-finished signal for using the connect(signal:) methods

    Declaration

    Swift

    static var dndFinishedSignal: DragContextSignalName { get }
  • 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. See gdk_drag_context_manage_dnd() for more information.

    Note

    This represents the underlying drop-performed signal

    Declaration

    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 method

    Typed drop-performed signal for using the connect(signal:) methods

    Declaration

    Swift

    static var dropPerformedSignal: DragContextSignalName { get }

DragContext Class: DragContextProtocol extension (methods and fields)

  • getActions() Extension method

    Determines the bitmask of actions proposed by the source if gdk_drag_context_get_suggested_action() returns GDK_ACTION_ASK.

    Declaration

    Swift

    @inlinable
    func getActions() -> DragAction
  • getDestWindow() Extension method

    Returns the destination window for the DND operation.

    Declaration

    Swift

    @inlinable
    func getDestWindow() -> WindowRef!
  • getDevice() Extension method

    Returns the GdkDevice associated to the drag context.

    Declaration

    Swift

    @inlinable
    func getDevice() -> DeviceRef!
  • getDragWindow() Extension method

    Returns 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 method

    Returns the drag protocol that is used by this context.

    Declaration

    Swift

    @inlinable
    func getProtocol() -> GdkDragProtocol
  • getSelectedAction() Extension method

    Determines the action chosen by the drag destination.

    Declaration

    Swift

    @inlinable
    func getSelectedAction() -> DragAction
  • getSourceWindow() Extension method

    Returns the GdkWindow where the DND operation started.

    Declaration

    Swift

    @inlinable
    func getSourceWindow() -> WindowRef!
  • getSuggestedAction() Extension method

    Determines the suggested drag action of the context.

    Declaration

    Swift

    @inlinable
    func getSuggestedAction() -> DragAction
  • listTargets() Extension method

    Retrieves the list of targets of the context.

    Declaration

    Swift

    @inlinable
    func listTargets() -> GLib.ListRef!
  • Requests the drag and drop operation to be managed by context. When a drag and drop operation becomes managed, the GdkDragContext will internally handle all input and source-side GdkEventDND 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 all GdkSelection 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
  • set(device:) Extension method

    Associates a GdkDevice to context, so all Drag and Drop events for context are emitted as if they came from this device.

    Declaration

    Swift

    @inlinable
    func set<DeviceT>(device: DeviceT) where DeviceT : DeviceProtocol
  • setHotspot(hotX:hotY:) Extension method

    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 for success 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 first gdk_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 method

    Returns 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 and protocol parameters for gdk_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 method

    Returns 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:time_:) Extension method

    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:time_:) Extension method

    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:time_:) Extension method

    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 method

    Determines the bitmask of actions proposed by the source if gdk_drag_context_get_suggested_action() returns GDK_ACTION_ASK.

    Declaration

    Swift

    @inlinable
    var actions: DragAction { get }
  • destWindow Extension method

    Returns the destination window for the DND operation.

    Declaration

    Swift

    @inlinable
    var destWindow: WindowRef! { get }
  • device Extension method

    Returns the GdkDevice associated to the drag context.

    Declaration

    Swift

    @inlinable
    var device: DeviceRef! { get nonmutating set }
  • dragWindow Extension method

    Returns 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 method

    Returns the drag protocol that is used by this context.

    Declaration

    Swift

    @inlinable
    var `protocol`: GdkDragProtocol { get }
  • selectedAction Extension method

    Determines the action chosen by the drag destination.

    Declaration

    Swift

    @inlinable
    var selectedAction: DragAction { get }
  • sourceWindow Extension method

    Returns the GdkWindow where the DND operation started.

    Declaration

    Swift

    @inlinable
    var sourceWindow: WindowRef! { get }
  • suggestedAction Extension method

    Determines the suggested drag action of the context.

    Declaration

    Swift

    @inlinable
    var suggestedAction: DragAction { get }