fix up file renaming code a little bit
[ArdourMidi.git] / libs / gtkmm2ext / dndtreeview.cc
blob179423f2033082e61d2af15fc9ea90dddab24592
1 /*
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.
20 #include <cstdio>
21 #include <iostream>
23 #include <gtkmm2ext/dndtreeview.h>
25 using namespace std;
26 using namespace sigc;
27 using namespace Gdk;
28 using namespace Gtk;
29 using namespace Glib;
30 using namespace Gtkmm2ext;
32 DnDTreeViewBase::DragData DnDTreeViewBase::drag_data;
34 DnDTreeViewBase::DnDTreeViewBase ()
35 : TreeView ()
37 draggable.push_back (TargetEntry ("GTK_TREE_MODEL_ROW", TARGET_SAME_WIDGET));
38 data_column = -1;
40 enable_model_drag_source (draggable);
41 enable_model_drag_dest (draggable);
43 suggested_action = Gdk::DragAction (0);
46 void
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);
57 void
58 DnDTreeViewBase::add_object_drag (int column, string type_name)
60 draggable.push_back (TargetEntry (type_name, TargetFlags(0)));
61 data_column = column;
62 object_type = type_name;
64 enable_model_drag_source (draggable);
65 enable_model_drag_dest (draggable);
68 bool
69 DnDTreeViewBase::on_drag_drop(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint time)
71 suggested_action = Gdk::DragAction (0);
72 drag_data.source = 0;
73 return TreeView::on_drag_drop (context, x, y, time);