Gdk.DragContext

g GObject.Object GObject.Object Gdk.DragContext Gdk.DragContext GObject.Object->Gdk.DragContext

Subclasses:None

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
  finish (success, del_, time)
  get_actions ()
  get_dest_window ()
  get_device ()
  get_drag_window ()
  get_protocol ()
  get_selected_action ()
  get_source_window ()
  get_suggested_action ()
  list_targets ()
  manage_dnd (ipc_window, actions)
  set_device (device)
  set_hotspot (hot_x, hot_y)

Virtual Methods

Inherited:GObject.Object (7)

Properties

None

Signals

Inherited:GObject.Object (1)
Name Short Description
action-changed A new action is being chosen for the drag and drop operation.
cancel The drag and drop operation was cancelled.
dnd-finished The drag and drop operation was finished, the drag destination finished reading all data.
drop-performed The drag and drop operation was performed on an accepting client.

Fields

Inherited:GObject.Object (1)

Class Details

class Gdk.DragContext(**kwargs)
Bases:GObject.Object
Abstract:No
finish(success, del_, time)
get_actions()[source]
Returns:the Gdk.DragAction flags
Return type:Gdk.DragAction

Determines the bitmask of actions proposed by the source if Gdk.DragContext.get_suggested_action() returns Gdk.DragAction.ASK.

New in version 2.22.

get_dest_window()[source]
Returns:a Gdk.Window
Return type:Gdk.Window

Returns the destination window for the DND operation.

New in version 3.0.

get_device()[source]
Returns:The Gdk.Device associated to self.
Return type:Gdk.Device

Returns the Gdk.Device associated to the drag context.

get_drag_window()[source]
Returns:the drag window, or None
Return type:Gdk.Window or None

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 self and will be destroyed when the drag operation is over.

New in version 3.20.

get_protocol()[source]
Returns:the drag protocol
Return type:Gdk.DragProtocol

Returns the drag protocol that is used by this context.

New in version 3.0.

get_selected_action()[source]
Returns:a Gdk.DragAction value
Return type:Gdk.DragAction

Determines the action chosen by the drag destination.

New in version 2.22.

get_source_window()[source]
Returns:a Gdk.Window
Return type:Gdk.Window

Returns the Gdk.Window where the DND operation started.

New in version 2.22.

get_suggested_action()[source]
Returns:a Gdk.DragAction value
Return type:Gdk.DragAction

Determines the suggested drag action of the context.

New in version 2.22.

list_targets()[source]
Returns:a GLib.List of targets
Return type:[Gdk.Atom]

Retrieves the list of targets of the context.

New in version 2.22.

manage_dnd(ipc_window, actions)[source]
Parameters:
  • ipc_window (Gdk.Window) – Window to use for IPC messaging/events
  • actions (Gdk.DragAction) – the actions supported by the drag source
Returns:

True if the drag and drop operation is managed.

Return type:

bool

Requests the drag and drop operation to be managed by self. When a drag and drop operation becomes managed, the Gdk.DragContext will internally handle all input and source-side Gdk.EventDND events as required by the windowing system.

Once the drag and drop operation is managed, the drag context will emit the following signals:

New in version 3.20.

set_device(device)[source]
Parameters:device (Gdk.Device) – a Gdk.Device

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

set_hotspot(hot_x, hot_y)[source]
Parameters:
  • hot_x (int) – x coordinate of the drag window hotspot
  • hot_y (int) – y coordinate of the drag window hotspot

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.

New in version 3.20.

Signal Details

Gdk.DragContext.signals.action_changed(drag_context, action)
Signal Name:

action-changed

Flags:

RUN_LAST

Parameters:

A new action is being chosen for the drag and drop operation.

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

New in version 3.20.

Gdk.DragContext.signals.cancel(drag_context, reason)
Signal Name:

cancel

Flags:

RUN_LAST

Parameters:

The drag and drop operation was cancelled.

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

New in version 3.20.

Gdk.DragContext.signals.dnd_finished(drag_context)
Signal Name:dnd-finished
Flags:RUN_LAST
Parameters:drag_context (Gdk.DragContext) – The object which received the signal

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 Gdk.DragContext manages the drag and drop operation. See Gdk.DragContext.manage_dnd() for more information.

New in version 3.20.

Gdk.DragContext.signals.drop_performed(drag_context, time)
Signal Name:

drop-performed

Flags:

RUN_LAST

Parameters:
  • drag_context (Gdk.DragContext) – The object which received the signal
  • time (int) – the time at which the drop happened.

The drag and drop operation was performed on an accepting client.

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

New in version 3.20.