2 Copyright (C) 2000-2007 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <gtkmm2ext/dndtreeview.h>
30 using namespace Gtkmm2ext;
32 DnDTreeViewBase::DragData DnDTreeViewBase::drag_data;
34 DnDTreeViewBase::DnDTreeViewBase ()
37 draggable.push_back (TargetEntry ("GTK_TREE_MODEL_ROW", TARGET_SAME_WIDGET));
40 enable_model_drag_source (draggable);
41 enable_model_drag_dest (draggable);
43 suggested_action = Gdk::DragAction (0);
47 DnDTreeViewBase::add_drop_targets (list<TargetEntry>& targets)
49 for (list<TargetEntry>::iterator i = targets.begin(); i != targets.end(); ++i) {
50 draggable.push_back (*i);
53 enable_model_drag_source (draggable);
54 enable_model_drag_dest (draggable);
58 DnDTreeViewBase::add_object_drag (int column, string type_name)
60 draggable.push_back (TargetEntry (type_name, TargetFlags(0)));
62 object_type = type_name;
64 enable_model_drag_source (draggable);
65 enable_model_drag_dest (draggable);
69 DnDTreeViewBase::on_drag_drop(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint time)
71 suggested_action = Gdk::DragAction (0);
73 return TreeView::on_drag_drop (context, x, y, time);