1.21 <GdkDrop>

Class: <GdkDrop>

It derives from <GObject>.

Represents the target of an ongoing DND operation.

Possible drop sites get informed about the status of the ongoing drag operation with events of type drag-enter, drag-leave, drag-motion and drop-start. The <GdkDrop> object can be obtained from these <GdkEvent> types using dndevent:get-drop.

The actual data transfer is initiated from the target side via an async read, using one of the <GdkDrop> methods for this purpose: drop:read-async or drop:read-value-async.

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.

Properties

Property: drop:actions self

The possible actions for this drop

Its value is a <GdkDragAction> (or, to set it, a list of its symbols, or one of them).

It can only be set when the object is made, with #:actions.

Property: drop:device self

The <GdkDevice> performing the drop

Its value is a <GdkDevice>, or #f.

It can only be set when the object is made, with #:device.

Property: drop:display self

The <GdkDisplay> that the drop belongs to.

Its value is a <GdkDisplay>, or #f.

It is read only.

Property: drop:drag self

The <GdkDrag> that initiated this drop

Its value is a <GdkDrag>, or #f.

It can only be set when the object is made, with #:drag.

Property: drop:formats self

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

Its value is a <GdkContentFormats>, or #f.

It can only be set when the object is made, with #:formats.

Property: drop:surface self

The <GdkSurface> the drop happens on

Its value is a <GdkSurface>, or #f.

It can only be set when the object is made, with #:surface.

Procedures

Method: drop:finish self action
Method: finish self action

Ends the drag operation after a drop.

The action must be a single action selected from the actions available via drop:get-actions.

self

Passed: a <GdkDrop>.

a <GdkDrop>

action

Passed: a <GdkDragAction>, or a list of its symbols, or one of them.

the action performed by the destination or none if the drop failed

Method: drop:get-actions self ⇒ %return
Method: get-actions self ⇒ %return

Returns the possible actions for this <GdkDrop>.

If this value contains multiple actions - i.e. drag-action:is-unique? returns false for the result - drop:finish must choose the action to use when accepting the drop. This will only happen if you passed ask as one of the possible actions in drop:status. ask itself will not be included in the actions returned by this function.

This value may change over the lifetime of the <GdkDrop> both as a response to source side actions as well as to calls to drop:status or drop:finish. The source side will not change this value anymore once a drop has started.

self

Passed: a <GdkDrop>.

a <GdkDrop>

%return

Returned: a <GdkDragAction>.

The possible GdkDragActions

Method: drop:get-device self ⇒ %return
Method: get-device self ⇒ %return

Returns the <GdkDevice> performing the drop.

self

Passed: a <GdkDrop>.

a <GdkDrop>

%return

Returned: a <GdkDevice>.

The <GdkDevice> performing the drop.

Method: drop:get-display self ⇒ %return
Method: get-display self ⇒ %return

Gets the <GdkDisplay> that self was created for.

self

Passed: a <GdkDrop>.

a <GdkDrop>

%return

Returned: a <GdkDisplay>.

a <GdkDisplay>

Method: drop:get-drag self ⇒ %return
Method: get-drag self ⇒ %return

If this is an in-app drag-and-drop operation, returns the <GdkDrag> that corresponds to this drop.

If it is not, NULL is returned.

self

Passed: a <GdkDrop>.

a <GdkDrop>

%return

Returned: a <GdkDrag>, or #f.

the corresponding <GdkDrag>

Method: drop:get-formats self ⇒ %return
Method: get-formats self ⇒ %return

Returns the <GdkContentFormats> that the drop offers the data to be read in.

self

Passed: a <GdkDrop>.

a <GdkDrop>

%return

Returned: a <GdkContentFormats>.

The possible <GdkContentFormats>

Method: drop:get-surface self ⇒ %return
Method: get-surface self ⇒ %return

Returns the <GdkSurface> performing the drop.

self

Passed: a <GdkDrop>.

a <GdkDrop>

%return

Returned: a <GdkSurface>.

The <GdkSurface> performing the drop.

Method: drop:read-async self mime-types io-priority [cancellable] [callback]
Method: read-async self mime-types io-priority [cancellable] [callback]

Asynchronously read the dropped data from a <GdkDrop> in a format that complies with one of the mime types.

self

Passed: a <GdkDrop>.

a <GdkDrop>

mime-types

Passed: a list or vector, each a string.

pointer to an array of mime types

io-priority

Passed: a 32-bit integer.

the I/O priority for the read operation

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback

Method: drop:read-finish self result ⇒ %return out-mime-type
Method: read-finish self result ⇒ %return out-mime-type

Finishes an async drop read operation.

Note that you must not use blocking read calls on the returned stream in the GTK thread, since some platforms might require communication with GTK to complete the data transfer. You can use async APIs such as input-stream:read-bytes-async.

See drop:read-async.

self

Passed: a <GdkDrop>.

a <GdkDrop>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GInputStream>, or #f.

the <GInputStream>

out-mime-type

Returned: a string.

return location for the used mime type

Method: drop:read-value-async self type io-priority [cancellable] [callback]
Method: read-value-async self type io-priority [cancellable] [callback]

Asynchronously request the drag operation’s contents converted to the given type.

For local drag-and-drop operations that are available in the given GType, the value will be copied directly. Otherwise, GDK will try to use content-deserialize-async to convert the data.

self

Passed: a <GdkDrop>.

a <GdkDrop>

type

Passed: a class, or a GType number.

a GType to read

io-priority

Passed: a 32-bit integer.

the I/O priority of the request.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

callback

Passed, or left out: a procedure, or #f.

callback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: drop:read-value-finish self result ⇒ %return
Method: read-value-finish self result ⇒ %return

Finishes an async drop read.

See drop:read-value-async.

self

Passed: a <GdkDrop>.

a <GdkDrop>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GValue>.

a <GValue> containing the result.

Method: drop:status self actions preferred
Method: status self actions preferred

Selects all actions that are potentially supported by the destination.

When calling this function, do not restrict the passed in actions to the ones provided by drop:get-actions. Those actions may change in the future, even depending on the actions you provide here.

The preferred action is a hint to the drag-and-drop mechanism about which action to use when multiple actions are possible.

This function should be called by drag destinations in response to drag-enter or drag-motion events. If the destination does not yet know the exact actions it supports, it should set any possible actions first and then later call this function again.

self

Passed: a <GdkDrop>.

a <GdkDrop>

actions

Passed: a <GdkDragAction>, or a list of its symbols, or one of them.

Supported actions of the destination, or none to indicate that a drop will not be accepted

preferred

Passed: a <GdkDragAction>, or a list of its symbols, or one of them.

A unique action that’s a member of actions indicating the preferred action