Gdk.Drag¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
|||
r/w/co/en |
|||
r/w/co/en |
|||
r/en |
|||
r/w/co/en |
|||
r/w/en |
|||
r/w/co/en |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted when the drag operation is cancelled. |
|
Emitted when the destination side has finished reading all data. |
|
Emitted when the drop operation is performed on an accepting client. |
Fields¶
- Inherited:
Class Details¶
- class Gdk.Drag(**kwargs)¶
- Bases:
- Abstract:
Yes
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 [func`Gdk`.Drag.begin], the caller gets informed about the status of the ongoing drag operation with signals on theGdkDrag
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.
- classmethod begin(surface, device, content, actions, dx, dy)[source]¶
- Parameters:
surface (
Gdk.Surface
) – the source surface for this dragdevice (
Gdk.Device
) – the device that controls this dragcontent (
Gdk.ContentProvider
) – the offered contentactions (
Gdk.DragAction
) – the actions supported by this dragdx (
float
) – the x offset to device's position where the drag nominally starteddy (
float
) – the y offset to device's position where the drag nominally started
- Returns:
a newly created
GdkDrag
- Return type:
Starts a drag and creates a new drag context for it.
This function is called by the drag source. After this call, you probably want to set up the drag icon using the surface returned by [method`Gdk`.Drag.get_drag_surface].
This function returns a reference to the [class`Gdk`.Drag] object, but GTK keeps its own reference as well, as long as the DND operation is going on.
Note: if actions include
Gdk.DragAction.MOVE
, you need to listen for the [signal`Gdk`.Drag::dnd-finished] signal and delete the data at the source if [method`Gdk`.Drag.get_selected_action] returnsGdk.DragAction.MOVE
.
- drop_done(success)[source]¶
- Parameters:
success (
bool
) – whether the drag was ultimatively successful
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 self.
The
GdkDrag
will only take the first [method`Gdk`.Drag.drop_done] call as effective, if this function is called multiple times, all subsequent calls will be ignored.
- get_actions()[source]¶
- Returns:
the
GdkDragAction
flags- Return type:
Determines the bitmask of possible actions proposed by the source.
- get_content()[source]¶
- Returns:
The
GdkContentProvider
associated to self.- Return type:
Returns the
GdkContentProvider
associated to theGdkDrag
object.
- get_device()[source]¶
- Returns:
The
GdkDevice
associated to self.- Return type:
Returns the
GdkDevice
associated to theGdkDrag
object.
- get_display()[source]¶
- Returns:
a
GdkDisplay
- Return type:
Gets the
GdkDisplay
that the drag object was created for.
- get_drag_surface()[source]¶
- Returns:
the drag surface
- Return type:
Gdk.Surface
orNone
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 self and will be destroyed when the drag operation is over.
- get_formats()[source]¶
- Returns:
a
GdkContentFormats
- Return type:
Retrieves the formats supported by this
GdkDrag
object.
- get_selected_action()[source]¶
- Returns:
a
GdkDragAction
value- Return type:
Determines the action chosen by the drag destination.
- get_surface()[source]¶
- Returns:
The
GdkSurface
where the drag originates- Return type:
Returns the
GdkSurface
where the drag originates.
Signal Details¶
- Gdk.Drag.signals.cancel(drag, reason)¶
- Signal Name:
cancel
- Flags:
- Parameters:
drag (
Gdk.Drag
) – The object which received the signalreason (
Gdk.DragCancelReason
) – The reason the drag was cancelled
Emitted when the drag operation is cancelled.
Property Details¶
- Gdk.Drag.props.actions¶
- Name:
actions
- Type:
- Default Value:
0
- Flags:
The possible actions of this drag.
- Gdk.Drag.props.content¶
- Name:
content
- Type:
- Default Value:
- Flags:
The
GdkContentProvider
.
- Gdk.Drag.props.device¶
- Name:
device
- Type:
- Default Value:
- Flags:
The
GdkDevice
that is performing the drag.
- Gdk.Drag.props.display¶
- Name:
display
- Type:
- Default Value:
- Flags:
The
GdkDisplay
that the drag belongs to.
- Gdk.Drag.props.formats¶
- Name:
formats
- Type:
- Default Value:
- Flags:
The possible formats that the drag can provide its data in.
- Gdk.Drag.props.selected_action¶
- Name:
selected-action
- Type:
- Default Value:
0
- Flags:
The currently selected action of the drag.
- Gdk.Drag.props.surface¶
- Name:
surface
- Type:
- Default Value:
- Flags:
The surface where the drag originates.