DnDTreeview: allow to handle multiple drag-targets
This commit is contained in:
@@ -141,5 +141,3 @@ DnDTreeViewBase::on_drag_drop(const Glib::RefPtr<Gdk::DragContext>& context, int
|
||||
drag_data.source = 0;
|
||||
return TreeView::on_drag_drop (context, x, y, time);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -142,11 +142,16 @@ class /*LIBGTKMM2EXT_API*/ DnDTreeView : public DnDTreeViewBase
|
||||
|
||||
if (selection_data.get_target() == "GTK_TREE_MODEL_ROW") {
|
||||
TreeView::on_drag_data_received (context, x, y, selection_data, info, time);
|
||||
} else if (selection_data.get_target() == object_type) {
|
||||
signal_drop (context, selection_data);
|
||||
context->drag_finish (true, false, time);
|
||||
} else {
|
||||
/* some kind of target type added by the app, which will be handled by a signal handler */
|
||||
/* some kind of target type, usually 'object_type' added by the app,
|
||||
* which will be handled by a signal handler */
|
||||
for (std::list<Gtk::TargetEntry>::const_iterator i = draggable.begin(); i != draggable.end (); ++i) {
|
||||
if (selection_data.get_target() == (*i).get_target()) {
|
||||
signal_drop (context, selection_data);
|
||||
context->drag_finish (true, false, time);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user