信号

When a drop destination has accepted a dragged item, certain signals will be emitted, depending on what action has been selected. For instance, the user might have held down the Shift key to specify a move rather than a copy. Remember that the user can only select the actions which you have specified in your calls to drag_dest_set() and drag_source_set().

18.3.1. Copy

The source widget will emit these signals, in this order:

  • drag_begin: Provides DragContext.
  • drag_motion: Provides DragContext and coordinates. You can call the drag_status() method of the DragContext to indicate which target will be accepted.
  • drag_get: Provides info about the dragged data format, and a GtkSelectionData structure, in which you should put the requested data.
  • drag_drop: Provides DragContext and coordinates.
  • drag_end: Provides DragContext.

The destination widget will emit this signal, after the source destination has emitted the drag_get signal:

  • drag_data_received: Provides info about the dragged data format, and a GtkSelectionData structure which contains the dropped data. You should call the drag_finish() method of the DragContext to indicate whether the operation was successful.

18.3.2. Move

During a move, the source widget will also emit this signal:

  • drag_delete: Gives the source the opportunity to delete the original data if that's appropriate.