Functions

Setting up the source widget

The function gtk_drag_source_set() specifies a set of target types for a drag operation on a widget.

void gtk_drag_source_set( GtkWidget            *widget,
                          GdkModifierType       start_button_mask,
                          const GtkTargetEntry *targets,
                          gint                  n_targets,
                          GdkDragAction         actions );

The parameters signify the following:

The targets parameter is an array of the following structure:

struct GtkTargetEntry {
   gchar *target;
   guint  flags;
   guint  info;
 };

The fields specify a string representing the drag type, optional flags and application assigned integer identifier.

If a widget is no longer required to act as a source for drag-and-drop operations, the function gtk_drag_source_unset() can be used to remove a set of drag-and-drop target types.

void gtk_drag_source_unset( GtkWidget *widget );

Signals on the source widget:

The source widget is sent the following signals during a drag-and-drop operation.

Setting up a destination widget:

gtk_drag_dest_set() specifies that this widget can receive drops and specifies what types of drops it can receive.

gtk_drag_dest_unset() specifies that the widget can no longer receive drops.

void gtk_drag_dest_set( GtkWidget            *widget,
                        GtkDestDefaults       flags,
                        const GtkTargetEntry *targets,
                        gint                  n_targets,
                        GdkDragAction         actions );

void gtk_drag_dest_unset( GtkWidget *widget );

Signals on the destination widget:

The destination widget is sent the following signals during a drag-and-drop operation.