## GtkDragIcon GtkDragIcon — A toplevel to use as drag icon |

## Functions

GtkWidget * | gtk_drag_icon_get_for_drag ()
void | gtk_drag_icon_set_child ()
GtkWidget * | gtk_drag_icon_get_child ()
void | gtk_drag_icon_set_from_paintable ()
GtkWidget * | gtk_drag_icon_create_widget_for_value ()

## Properties

GtkWidget * | child | Read / Write

## Types and Values

| GtkDragIcon

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkDragIcon

## Implemented Interfaces

GtkDragIcon implements AtkImplementorIface, GtkBuildable, GtkConstraintTarget, GtkNative and GtkRoot.

## Includes

    #include <gtk/gtk.h>

## Description

GtkDragIcon is a GtkRoot implementation with the sole purpose to serve as a drag icon during DND operations. A drag icon moves with the pointer during a drag operation and is destroyed when the drag ends.

To set up a drag icon and associate it with an ongoing drag operation, use `gtk_drag_icon_get_for_drag()` to get the icon for a drag. You can then use it like any other widget and use `gtk_drag_icon_set_child()` to set whatever widget should be used for the drag icon.

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

## Functions

### gtk_drag_icon_get_for_drag ()

    GtkWidget *
    gtk_drag_icon_get_for_drag (GdkDrag *drag);

Gets the GtkDragIcon in use with `drag` .

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

#### Parameters

drag | a GdkDrag |

#### Returns

the GtkDragIcon.

[transfer none]

### gtk_drag_icon_set_child ()

    void
    gtk_drag_icon_set_child (GtkDragIcon *self,
                             GtkWidget *child);

Sets the widget to display as the drag icon.

#### Parameters

self | a GtkDragIcon |
child | a GtkWidget or `NULL`. | [nullable]

### gtk_drag_icon_get_child ()

    GtkWidget *
    gtk_drag_icon_get_child (GtkDragIcon *self);

Gets the widget currently used as drag icon.

#### Parameters

self | a GtkDragIcon |

#### Returns

The drag icon or `NULL` if none.

[nullable][transfer none]

### gtk_drag_icon_set_from_paintable ()

    void
    gtk_drag_icon_set_from_paintable (GdkDrag *drag,
                                      GdkPaintable *paintable,
                                      int hot_x,
                                      int hot_y);

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.

#### Parameters

drag | a GdkDrag |
paintable | a GdkPaintable to display |
hot_x | X coordinate of the hotspot |
hot_y | Y coordinate of the hotspot |

### gtk_drag_icon_create_widget_for_value ()

    GtkWidget *
    gtk_drag_icon_create_widget_for_value (const GValue *value);

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

If GTK does not know how to create a widget for a given value, it will return `NULL`.

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

#### Parameters

value | a GValue |

#### Returns

A new GtkWidget for displaying `value` as a drag icon.

[nullable][transfer full]

## Types and Values

### GtkDragIcon

    typedef struct _GtkDragIcon GtkDragIcon;

## Property Details

### The `“child”` property

      “child”                    GtkWidget *

The widget to display as drag icon.

Owner: GtkDragIcon

Flags: Read / Write