Gdk.Drop¶
- Subclasses:
 None
Methods¶
- Inherited:
 - Structs:
 
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
Virtual Methods¶
- Inherited:
 
Properties¶
Name  | 
Type  | 
Flags  | 
Short Description  | 
|---|---|---|---|
r/w/co/en  | 
|||
r/w/co/en  | 
|||
r/en  | 
|||
r/w/co/en  | 
|||
r/w/co/en  | 
|||
r/w/co/en  | 
Signals¶
- Inherited:
 
Fields¶
- Inherited:
 
Class Details¶
- class Gdk.Drop(**kwargs)¶
 - Bases:
 - Abstract:
 Yes
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
Gdk.EventType.DRAG_ENTER,Gdk.EventType.DRAG_LEAVE,Gdk.EventType.DRAG_MOTIONandGdk.EventType.DROP_START. TheGdkDropobject can be obtained from these [class`Gdk`.Event] types using [method`Gdk`.DNDEvent.get_drop].The actual data transfer is initiated from the target side via an async read, using one of the
GdkDropmethods for this purpose: [method`Gdk`.Drop.read_async] or [method`Gdk`.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.
- finish(action)[source]¶
 - Parameters:
 action (
Gdk.DragAction) – the action performed by the destination or 0 if the drop failed
Ends the drag operation after a drop.
The action must be a single action selected from the actions available via [method`Gdk`.Drop.get_actions].
- get_actions()[source]¶
 - Returns:
 The possible
GdkDragActions- Return type:
 
Returns the possible actions for this
GdkDrop.If this value contains multiple actions - i.e. [func`Gdk`.DragAction.is_unique] returns
Falsefor the result - [method`Gdk`.Drop.finish] must choose the action to use when accepting the drop. This will only happen if you passedGdk.DragAction.ASKas one of the possible actions in [method`Gdk`.Drop.status].Gdk.DragAction.ASKitself will not be included in the actions returned by this function.This value may change over the lifetime of the [class`Gdk`.Drop] both as a response to source side actions as well as to calls to [method`Gdk`.Drop.status] or [method`Gdk`.Drop.finish]. The source side will not change this value anymore once a drop has started.
- get_device()[source]¶
 - Returns:
 The
GdkDeviceperforming the drop.- Return type:
 
Returns the
GdkDeviceperforming the drop.
- get_display()[source]¶
 - Returns:
 a
GdkDisplay- Return type:
 
Gets the
GdkDisplaythat self was created for.
- get_drag()[source]¶
 - 
If this is an in-app drag-and-drop operation, returns the
GdkDragthat corresponds to this drop.If it is not,
Noneis returned. 
- get_formats()[source]¶
 - Returns:
 The possible
GdkContentFormats- Return type:
 
Returns the
GdkContentFormatsthat the drop offers the data to be read in.
- get_surface()[source]¶
 - Returns:
 The
GdkSurfaceperforming the drop.- Return type:
 
Returns the
GdkSurfaceperforming the drop.
- read_async(mime_types, io_priority, cancellable, callback, *user_data)[source]¶
 - Parameters:
 mime_types ([
str]) – pointer to an array of mime typesio_priority (
int) – the I/O priority for the read operationcancellable (
Gio.CancellableorNone) – optionalGCancellableobjectcallback (
Gio.AsyncReadyCallbackorNone) – aGAsyncReadyCallbackto call when the request is satisfied
Asynchronously read the dropped data from a
GdkDropin a format that complies with one of the mime types.
- read_finish(result)[source]¶
 - Parameters:
 result (
Gio.AsyncResult) – aGAsyncResult- Raises:
 - Returns:
 the
GInputStream- out_mime_type:
 return location for the used mime type
- Return type:
 (
Gio.InputStreamorNone, out_mime_type:str)
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
Gio.InputStream.read_bytes_async().See [method`Gdk`.Drop.read_async].
- read_value_async(type, io_priority, cancellable, callback, *user_data)[source]¶
 - Parameters:
 type (
GObject.GType) – aGTypeto readio_priority (
int) – the I/O priority of the request.cancellable (
Gio.CancellableorNone) – optionalGCancellableobject,Noneto ignore.callback (
Gio.AsyncReadyCallbackorNone) – callback to call when the request is satisfieduser_data (
objectorNone) – the data to pass to callback function
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 [func`Gdk`.content_deserialize_async] to convert the data.
- read_value_finish(result)[source]¶
 - Parameters:
 result (
Gio.AsyncResult) – aGAsyncResult- Raises:
 - Returns:
 a
GValuecontaining the result.- Return type:
 
Finishes an async drop read.
See [method`Gdk`.Drop.read_value_async].
- status(actions, preferred)[source]¶
 - Parameters:
 actions (
Gdk.DragAction) – Supported actions of the destination, or 0 to indicate that a drop will not be acceptedpreferred (
Gdk.DragAction) – A unique action that’s a member of actions indicating the preferred action
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 [method`Gdk`.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
Gdk.EventType.DRAG_ENTERorGdk.EventType.DRAG_MOTIONevents. 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.
Property Details¶
- Gdk.Drop.props.actions¶
 - Name:
 actions- Type:
 - Default Value:
 Gdk.DragAction.COPY|Gdk.DragAction.MOVE|Gdk.DragAction.LINK- Flags:
 
The possible actions for this drop
- Gdk.Drop.props.device¶
 - Name:
 device- Type:
 - Default Value:
 - Flags:
 
The
GdkDeviceperforming the drop
- Gdk.Drop.props.display¶
 - Name:
 display- Type:
 - Default Value:
 - Flags:
 
The
GdkDisplaythat the drop belongs to.
- Gdk.Drop.props.drag¶
 - Name:
 drag- Type:
 - Default Value:
 - Flags:
 
The
GdkDragthat initiated this drop
- Gdk.Drop.props.formats¶
 - Name:
 formats- Type:
 - Default Value:
 - Flags:
 
The possible formats that the drop can provide its data in.
- Gdk.Drop.props.surface¶
 - Name:
 surface- Type:
 - Default Value:
 - Flags:
 
The
GdkSurfacethe drop happens on