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.

  • ptr

    Untyped pointer to the underlying GdkDrag instance.

    Declaration

    Swift

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

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

Drag Class

  • 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 transformation

    transform_to

    ValueTransformer to use for backwards transformation

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

    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

Drag signals

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

    Declaration

    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 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 DragSignalName signal

    Declaration

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

  • onCancel(flags:handler:) Extension method

    Emitted when the drag operation is cancelled.

    Note

    This represents the underlying cancel signal

    Declaration

    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 method

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

    Declaration

    Swift

    static var cancelSignal: DragSignalName { get }
  • Emitted when the destination side has finished reading all data.

    The drag object can now free all miscellaneous data.

    Note

    This represents the underlying dnd-finished signal

    Declaration

    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 method

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

    Declaration

    Swift

    static var dndFinishedSignal: DragSignalName { get }
  • Emitted when the drop operation is performed on an accepting client.

    Note

    This represents the underlying drop-performed signal

    Declaration

    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 method

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

    Declaration

    Swift

    static var dropPerformedSignal: DragSignalName { get }
  • 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 to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_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 underlying notify::actions signal

    Declaration

    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 method

    Typed notify::actions signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyActionsSignal: DragSignalName { get }
  • 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 to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_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 underlying notify::content signal

    Declaration

    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 method

    Typed notify::content signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyContentSignal: DragSignalName { get }
  • 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 to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_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 underlying notify::device signal

    Declaration

    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 method

    Typed notify::device signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyDeviceSignal: DragSignalName { get }
  • 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 to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_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 underlying notify::display signal

    Declaration

    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 method

    Typed notify::display signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyDisplaySignal: DragSignalName { get }
  • 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 to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_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 underlying notify::formats signal

    Declaration

    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 method

    Typed notify::formats signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyFormatsSignal: DragSignalName { get }
  • 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 to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_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 underlying notify::selected-action signal

    Declaration

    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 method

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

    Declaration

    Swift

    static var notifySelectedActionSignal: DragSignalName { get }
  • 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 to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_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 underlying notify::surface signal

    Declaration

    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 method

    Typed notify::surface signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifySurfaceSignal: DragSignalName { get }

Drag Class: DragProtocol extension (methods and fields)

  • dropDone(success:) Extension method

    Informs GDK that the drop ended.

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

    Determines the bitmask of possible actions proposed by the source.

    Declaration

    Swift

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

    Returns the GdkContentProvider associated to the GdkDrag object.

    Declaration

    Swift

    @inlinable
    func getContent() -> ContentProviderRef!
  • getDevice() Extension method

    Returns the GdkDevice associated to the GdkDrag object.

    Declaration

    Swift

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

    Gets the GdkDisplay that the drag object was created for.

    Declaration

    Swift

    @inlinable
    func getDisplay() -> DisplayRef!
  • getDragSurface() Extension method

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

    Retrieves the formats supported by this GdkDrag object.

    Declaration

    Swift

    @inlinable
    func getFormats() -> ContentFormatsRef!
  • getSelectedAction() Extension method

    Determines the action chosen by the drag destination.

    Declaration

    Swift

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

    Returns the GdkSurface where the drag originates.

    Declaration

    Swift

    @inlinable
    func getSurface() -> SurfaceRef!
  • setHotspot(hotX:hotY:) Extension method

    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 method

    The possible actions of this drag.

    Declaration

    Swift

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

    The GdkContentProvider.

    Declaration

    Swift

    @inlinable
    var content: ContentProviderRef! { get }
  • device Extension method

    The GdkDevice that is performing the drag.

    Declaration

    Swift

    @inlinable
    var device: DeviceRef! { get }
  • display Extension method

    The GdkDisplay that the drag belongs to.

    Declaration

    Swift

    @inlinable
    var display: DisplayRef! { get }
  • dragSurface Extension method

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

    The possible formats that the drag can provide its data in.

    Declaration

    Swift

    @inlinable
    var formats: ContentFormatsRef! { get }
  • selectedAction Extension method

    Determines the action chosen by the drag destination.

    Declaration

    Swift

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

    The surface where the drag originates.

    Declaration

    Swift

    @inlinable
    var surface: SurfaceRef! { get }