Chapter 18. Drag and Drop

Table of Contents

Gtk::Widget has several methods and signals which are prefixed with "drag_". These are used for Drag and Drop.

Sources and Destinations

Things are dragged from sources to be dropped on destinations. Each source and destination has infomation about the data formats that it can send or receive, provided by Gtk::TargetEntry items. A drop destination will only accept a dragged item if they both share a compatible Gtk::TargetEntry item. Appropriate signals will then be emitted, telling the signal handlers which Gtk::TargetEntry was used.

Gtk::TargetEntry objects contain this information:

  • target: A name, such as "STRING"

  • info: An identifier which will be sent to your signals to tell you which TargetEntry was used.

  • flags: Used only for drag and drop, this specifies whether the data may be dragged to other widgets and applications, or only to the same ones.