Σήματα

Όταν ένας προορισμός απόθεσης έχει αποδεχτεί ένα μεταφερόμενο στοιχείο, συγκεκριμένα σήματα θα εκπεμφθούν, ανάλογα με το ποια ενέργεια έχει επιλεγεί. Για παράδειγμα, ο χρήστης μπορεί να έχει πατημένο το πλήκτρο Shift για να ορίσει μια move αντί για μια copy. Να θυμάστε ότι ο χρήστης μπορεί να επιλέξει μόνο τις ενέργειες που έχετε ορίσει στις κλήσεις σας στις drag_dest_set() και drag_source_set().

18.3.1. Αντιγραφή

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

  • drag_begin: Provides DragContext.
  • drag_data_get: Provides info about the dragged data format, and a Gtk::SelectionData structure, in which you should put the requested data.
  • drag_end: Provides DragContext.

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

  • drag_motion: Provides DragContext and coordinates. You can call the drag_status() method of the DragContext to indicate which action will be accepted.
  • drag_drop: Provides DragContext and coordinates. You can call drag_get_data(), which triggers the drag_data_get signal in the source widget, and then the drag_data_received signal in the destination widget.
  • drag_data_received: Provides info about the dragged data format, and a Gtk::SelectionData 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. Μετακίνηση

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

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