Widgets can be identified as sources or destinations using these Gtk::Widget methods:
void drag_source_set(const std::vector<Gtk::TargetEntry>& targets, Gdk::ModifierType start_button_mask, Gdk::DragAction actions);
- targets is a vector of Gtk::TargetEntry elements.
- start_button_mask is an ORed combination of values, which specify which modifier key or mouse button must be pressed to start the drag.
- actions is an ORed combination of values, which specified 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 std::vector<Gtk::TargetEntry>& targets, Gtk::DestDefaults flags, Gdk::DragAction actions);
- flags is an ORed combination of values which indicates how the widget will respond visually to Drag and Drop items.
- actions indicates the Drag and Drop actions which this destination can receive - see the description above.