Metody
Widget může být rozpoznán jako zdroj nebo cíl pomocí těchto metod Gtk::Widget:
void drag_source_set(const Glib::RefPtr<Gdk::ContentFormats>& targets, Gdk::ModifierType start_button_mask, Gdk::DragAction actions);
- targets is a Gdk::ContentFormats object.
- start_button_mask jsou hodnoty kombinované bitovým NEBO, které určují, jaké modifikační klávesy nebo tlačítka myši musí být zmáčknuty, aby se začalo přetahovat.
- actions is an ORed combination of values, which specify which Drag and Drop operations will be possible from this source - for instance, copy, move, or link. The user can choose between the actions by using modifier keys, such as Shift to change from copy to move, and this will be shown by a different cursor.
void drag_dest_set(const Glib::RefPtr<Gdk::ContentFormats>& targets, Gtk::DestDefaults flags, Gdk::DragAction actions);
- flags jsou hodnoty kombinované pomocí bitového NEBO, které říkají, jak má widget vizuálně reagovat na přetahované položky.
- actions říká, které akce „Táhni a upusť“ může tento cíl přijímat – viz popis výše.
There are several methods to add source formats and destination formats. Examples:
- drag_source_add_text_targets()
- drag_source_add_image_targets()
- drag_dest_add_text_targets()
- drag_dest_add_image_targets()