GDK Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# Drag and Drop

## Name

Drag and Drop -- functions for controlling drag and drop handling.

## Synopsis

    #include <gdk/gdk.h>

    GdkAtom     gdk_drag_get_selection          (GdkDragContext *context);
    void        gdk_drag_abort                  (GdkDragContext *context,
                                                 guint32 time);
    void        gdk_drop_reply                  (GdkDragContext *context,
                                                 gboolean ok,
                                                 guint32 time);
    GdkDragContext* gdk_drag_context_new        (void);
    void        gdk_drag_drop                   (GdkDragContext *context,
                                                 guint32 time);
    void        gdk_drag_find_window            (GdkDragContext *context,
                                                 GdkWindow *drag_window,
                                                 gint x_root,
                                                 gint y_root,
                                                 GdkWindow **dest_window,
                                                 GdkDragProtocol *protocol);
    void        gdk_drag_context_ref            (GdkDragContext *context);
    GdkDragContext* gdk_drag_begin              (GdkWindow *window,
                                                 GList *targets);
    gboolean    gdk_drag_motion                 (GdkDragContext *context,
                                                 GdkWindow *dest_window,
                                                 GdkDragProtocol protocol,
                                                 gint x_root,
                                                 gint y_root,
                                                 GdkDragAction suggested_action,
                                                 GdkDragAction possible_actions,
                                                 guint32 time);
    void        gdk_drop_finish                 (GdkDragContext *context,
                                                 gboolean success,
                                                 guint32 time);
    guint32     gdk_drag_get_protocol           (guint32 xid,
                                                 GdkDragProtocol *protocol);
    enum        GdkDragProtocol;
    void        gdk_drag_context_unref          (GdkDragContext *context);
    struct      GdkDragContext;
    enum        GdkDragAction;
    void        gdk_drag_status                 (GdkDragContext *context,
                                                 GdkDragAction action,
                                                 guint32 time);

## Description

These functions provide a low level interface for drag and drop. GDK supports both the Xdnd and Motif drag and drop protocols transparently.

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.

## Details

### gdk_drag_get_selection ()

    GdkAtom     gdk_drag_get_selection          (GdkDragContext *context);

`context` : |
Returns : |

### gdk_drag_abort ()

    void        gdk_drag_abort                  (GdkDragContext *context,
                                                 guint32 time);

`context` : |
`time` : |

### gdk_drop_reply ()

    void        gdk_drop_reply                  (GdkDragContext *context,
                                                 gboolean ok,
                                                 guint32 time);

`context` : |
`ok` : |
`time` : |

### gdk_drag_context_new ()

    GdkDragContext* gdk_drag_context_new        (void);

Returns : |

### gdk_drag_drop ()

    void        gdk_drag_drop                   (GdkDragContext *context,
                                                 guint32 time);

`context` : |
`time` : |

### gdk_drag_find_window ()

    void        gdk_drag_find_window            (GdkDragContext *context,
                                                 GdkWindow *drag_window,
                                                 gint x_root,
                                                 gint y_root,
                                                 GdkWindow **dest_window,
                                                 GdkDragProtocol *protocol);

`context` : |
`drag_window` : |
`x_root` : |
`y_root` : |
`dest_window` : |
`protocol` : |

### gdk_drag_context_ref ()

    void        gdk_drag_context_ref            (GdkDragContext *context);

`context` : |

### gdk_drag_begin ()

    GdkDragContext* gdk_drag_begin              (GdkWindow *window,
                                                 GList *targets);

`window` : |
`targets` : |
Returns : |

### gdk_drag_motion ()

    gboolean    gdk_drag_motion                 (GdkDragContext *context,
                                                 GdkWindow *dest_window,
                                                 GdkDragProtocol protocol,
                                                 gint x_root,
                                                 gint y_root,
                                                 GdkDragAction suggested_action,
                                                 GdkDragAction possible_actions,
                                                 guint32 time);

`context` : |
`dest_window` : |
`protocol` : |
`x_root` : |
`y_root` : |
`suggested_action` : |
`possible_actions` : |
`time` : |
Returns : |

### gdk_drop_finish ()

    void        gdk_drop_finish                 (GdkDragContext *context,
                                                 gboolean success,
                                                 guint32 time);

`context` : |
`success` : |
`time` : |

### gdk_drag_get_protocol ()

    guint32     gdk_drag_get_protocol           (guint32 xid,
                                                 GdkDragProtocol *protocol);

`xid` : |
`protocol` : |
Returns : |

### enum GdkDragProtocol

    typedef enum {
      GDK_DRAG_PROTO_MOTIF,
      GDK_DRAG_PROTO_XDND,
      GDK_DRAG_PROTO_ROOTWIN,	/* A root window with nobody claiming
    				 * drags */
      GDK_DRAG_PROTO_NONE		/* Not a valid drag window */
    } GdkDragProtocol;

### gdk_drag_context_unref ()

    void        gdk_drag_context_unref          (GdkDragContext *context);

`context` : |

### struct GdkDragContext

    struct GdkDragContext {
      GdkDragProtocol protocol;

      gboolean is_source;

      GdkWindow *source_window;
      GdkWindow *dest_window;

      GList *targets;
      GdkDragAction actions;
      GdkDragAction suggested_action;
      GdkDragAction action;

      guint32 start_time;
    };

### enum GdkDragAction

    typedef enum {
      GDK_ACTION_DEFAULT = 1 << 0,
      GDK_ACTION_COPY    = 1 << 1,
      GDK_ACTION_MOVE    = 1 << 2,
      GDK_ACTION_LINK    = 1 << 3,
      GDK_ACTION_PRIVATE = 1 << 4,
      GDK_ACTION_ASK     = 1 << 5
    } GdkDragAction;

### gdk_drag_status ()

    void        gdk_drag_status                 (GdkDragContext *context,
                                                 GdkDragAction action,
                                                 guint32 time);

`context` : |
`action` : |
`time` : |

<<< Previous Page | Home | Up | Next Page >>>
Selections | Properties and Atoms