2005-10-24 09:43:53 -04:00
|
|
|
#include <cstdio>
|
2005-12-29 19:34:21 -05:00
|
|
|
#include <iostream>
|
2005-10-24 09:43:53 -04:00
|
|
|
|
|
|
|
#include <gtkmm2ext/dndtreeview.h>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace sigc;
|
|
|
|
using namespace Gdk;
|
|
|
|
using namespace Gtk;
|
|
|
|
using namespace Glib;
|
|
|
|
using namespace Gtkmm2ext;
|
|
|
|
|
2006-09-20 12:24:24 -04:00
|
|
|
DnDTreeViewBase::DnDTreeViewBase ()
|
2005-10-24 09:43:53 -04:00
|
|
|
: TreeView ()
|
|
|
|
{
|
|
|
|
draggable.push_back (TargetEntry ("GTK_TREE_MODEL_ROW", TARGET_SAME_WIDGET));
|
2005-12-29 19:34:21 -05:00
|
|
|
data_column = -1;
|
|
|
|
|
2005-10-24 09:43:53 -04:00
|
|
|
enable_model_drag_source (draggable);
|
|
|
|
enable_model_drag_dest (draggable);
|
2005-12-29 19:34:21 -05:00
|
|
|
|
|
|
|
suggested_action = Gdk::DragAction (0);
|
2005-10-24 09:43:53 -04:00
|
|
|
}
|
|
|
|
|
2005-12-29 19:34:21 -05:00
|
|
|
void
|
2006-09-20 12:24:24 -04:00
|
|
|
DnDTreeViewBase::add_drop_targets (list<TargetEntry>& targets)
|
2005-12-29 19:34:21 -05:00
|
|
|
{
|
|
|
|
for (list<TargetEntry>::iterator i = targets.begin(); i != targets.end(); ++i) {
|
|
|
|
draggable.push_back (*i);
|
|
|
|
}
|
|
|
|
enable_model_drag_source (draggable);
|
|
|
|
enable_model_drag_dest (draggable);
|
|
|
|
}
|
|
|
|
|
2005-10-24 09:43:53 -04:00
|
|
|
void
|
2006-09-20 12:24:24 -04:00
|
|
|
DnDTreeViewBase::add_object_drag (int column, string type_name)
|
2005-10-24 09:43:53 -04:00
|
|
|
{
|
|
|
|
draggable.push_back (TargetEntry (type_name, TargetFlags(0)));
|
|
|
|
data_column = column;
|
|
|
|
|
|
|
|
enable_model_drag_source (draggable);
|
|
|
|
enable_model_drag_dest (draggable);
|
|
|
|
}
|
|
|
|
|
2006-01-09 23:25:47 -05:00
|
|
|
bool
|
2006-09-20 12:24:24 -04:00
|
|
|
DnDTreeViewBase::on_drag_drop(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint time)
|
2006-01-09 23:25:47 -05:00
|
|
|
{
|
|
|
|
suggested_action = Gdk::DragAction (0);
|
|
|
|
return TreeView::on_drag_drop (context, x, y, time);
|
|
|
|
}
|
2005-10-24 09:43:53 -04:00
|
|
|
|
2006-09-20 12:24:24 -04:00
|
|
|
|