Gtk.DragIcon

g GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget Gtk.Native Gtk.Native GObject.GInterface->Gtk.Native Gtk.Root Gtk.Root GObject.GInterface->Gtk.Root GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.DragIcon Gtk.DragIcon Gtk.Native->Gtk.DragIcon Gtk.Root->Gtk.DragIcon Gtk.Widget->Gtk.DragIcon

Subclasses:

None

Methods

Inherited:

Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Gtk.Native (6), Gtk.Root (3)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

create_widget_for_value (value)

class

get_for_drag (drag)

class

set_from_paintable (drag, paintable, hot_x, hot_y)

get_child ()

set_child (child)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)

Properties

Inherited:

Gtk.Widget (34), Gtk.Accessible (1)

Name

Type

Flags

Short Description

child

Gtk.Widget

r/w/en

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details

class Gtk.DragIcon(**kwargs)
Bases:

Gtk.Widget, Gtk.Native, Gtk.Root

Abstract:

No

Structure:

Gtk.DragIconClass

GtkDragIcon is a GtkRoot implementation for drag icons.

A drag icon moves with the pointer during a Drag-and-Drop operation and is destroyed when the drag ends.

To set up a drag icon and associate it with an ongoing drag operation, use [func`Gtk`.DragIcon.get_for_drag] to get the icon for a drag. You can then use it like any other widget and use [method`Gtk`.DragIcon.set_child] to set whatever widget should be used for the drag icon.

Keep in mind that drag icons do not allow user input.

classmethod create_widget_for_value(value)[source]
Parameters:

value (GObject.Value) – a GValue

Returns:

A new GtkWidget for displaying value as a drag icon.

Return type:

Gtk.Widget or None

Creates a widget that can be used as a drag icon for the given value.

Supported types include strings, GdkRGBA and GtkTextBuffer. If GTK does not know how to create a widget for a given value, it will return None.

This method is used to set the default drag icon on drag-and-drop operations started by GtkDragSource, so you don’t need to set a drag icon using this function there.

classmethod get_for_drag(drag)[source]
Parameters:

drag (Gdk.Drag) – a GdkDrag

Returns:

the GtkDragIcon

Return type:

Gtk.Widget

Gets the GtkDragIcon in use with drag.

If no drag icon exists yet, a new one will be created and shown.

classmethod set_from_paintable(drag, paintable, hot_x, hot_y)[source]
Parameters:
  • drag (Gdk.Drag) – a GdkDrag

  • paintable (Gdk.Paintable) – a GdkPaintable to display

  • hot_x (int) – X coordinate of the hotspot

  • hot_y (int) – Y coordinate of the hotspot

Creates a GtkDragIcon that shows paintable, and associates it with the drag operation.

The hotspot position on the paintable is aligned with the hotspot of the cursor.

get_child()[source]
Returns:

The drag icon

Return type:

Gtk.Widget or None

Gets the widget currently used as drag icon.

set_child(child)[source]
Parameters:

child (Gtk.Widget or None) – a GtkWidget

Sets the widget to display as the drag icon.

Property Details

Gtk.DragIcon.props.child
Name:

child

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The widget to display as drag icon.