Drag and Drop

Drag and drop is a complex topic and requires careful setup to allow transferring of information to ensure the drag and drop operations work correctly. The drag and drop operation consists of a drag source and a drop destination, typically both consisting of a widget such as a Button or TreeView.

Note

The drag and drop functionality of GTK+ requires a good understanding of the toolkit.

Basic Functions

Basic drag and drop functionality is available, and can be used between simpler widgets such as a Label.

Advanced Functions

Signals

A number of signals can be setup on the source and destination objects to control the functionality.

Source

The source is the object from where the drag and drop operation is started.

  • "drag-begin" - commonly used to setup an icon which will be displayed to the user when the drag operation is started.
  • "drag-data-get" - grab the data which will be transferred to the destination.
  • "drag-data-delete" - delete the data if the drag and drop operation will move rather than copy.
  • "drag-end" - undo any setup begun with the "drag-begin" signal.

Destination

A destination is an object which is the receiver of the drag and drop operation.