20 #ifndef __gtkmm2ext_dndtreeview_h__
21 #define __gtkmm2ext_dndtreeview_h__
25 #include <gtkmm/treeview.h>
26 #include <gtkmm/treeselection.h>
27 #include <gtkmm/selectiondata.h>
33 template<
class DataType>
48 void add_drop_targets (std::list<Gtk::TargetEntry>&);
49 void add_object_drag (
int column, std::string type_name);
52 Gtk::TreeView::on_drag_begin (context);
56 void on_drag_leave(
const Glib::RefPtr<Gdk::DragContext>& context, guint time) {
57 suggested_action = context->get_suggested_action();
58 TreeView::on_drag_leave (context, time);
61 bool on_drag_motion(
const Glib::RefPtr<Gdk::DragContext>& context,
int x,
int y, guint time) {
62 suggested_action = context->get_suggested_action();
63 return TreeView::on_drag_motion (context, x, y, time);
66 bool on_drag_drop(
const Glib::RefPtr<Gdk::DragContext>& context,
int x,
int y, guint time);
91 template<
class DataType>
98 sigc::signal<void,const std::list<DataType>&,Gtk::TreeView*,int,int,Glib::RefPtr<Gdk::DragContext>&>
signal_drop;
100 void on_drag_data_get(
const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& selection_data, guint
info, guint time) {
101 if (selection_data.get_target() ==
"GTK_TREE_MODEL_ROW") {
103 TreeView::on_drag_data_get (context, selection_data, info, time);
105 }
else if (selection_data.get_target() ==
object_type) {
112 selection_data.set (8, (guchar*)&c, 1);
116 void on_drag_data_received(
const Glib::RefPtr<Gdk::DragContext>& context,
int x,
int y,
const Gtk::SelectionData& selection_data, guint
info, guint time) {
122 TreeView::on_drag_data_received (context, x, y, selection_data, info, time);
126 if (selection_data.get_target() ==
"GTK_TREE_MODEL_ROW") {
128 TreeView::on_drag_data_received (context, x, y, selection_data, info, time);
131 }
else if (selection_data.get_target() ==
object_type) {
133 end_object_drag (
const_cast<Glib::RefPtr<Gdk::DragContext>&
> (context), x, y);
153 Gtk::TreeSelection::ListHandle_Path selection =
drag_data.
source->get_selection()->get_selected_rows ();
155 for (Gtk::TreeSelection::ListHandle_Path::iterator x = selection.begin(); x != selection.end(); ++x) {
165 std::list<DataType> l;
166 Gtk::TreeView* source;
void on_drag_leave(const Glib::RefPtr< Gdk::DragContext > &context, guint time)
void end_object_drag(Glib::RefPtr< Gdk::DragContext > &context, int x, int y)
std::list< Gtk::TargetEntry > draggable
void get_object_drag_data(std::list< DataType > &l, Gtk::TreeView **source)
sigc::signal< void, const std::list< DataType > &, Gtk::TreeView *, int, int, Glib::RefPtr< Gdk::DragContext > & > signal_drop
void on_drag_data_get(const Glib::RefPtr< Gdk::DragContext > &context, Gtk::SelectionData &selection_data, guint info, guint time)
bool on_drag_motion(const Glib::RefPtr< Gdk::DragContext > &context, int x, int y, guint time)
void on_drag_data_received(const Glib::RefPtr< Gdk::DragContext > &context, int x, int y, const Gtk::SelectionData &selection_data, guint info, guint time)
LIBPBD_API Transmitter info
Gdk::DragAction suggested_action
static DragData drag_data
void on_drag_begin(Glib::RefPtr< Gdk::DragContext > const &context)