21 #ifndef __gtkmm2ext_dndtreeview_h__
22 #define __gtkmm2ext_dndtreeview_h__
26 #include <ytkmm/treeview.h>
27 #include <ytkmm/treeselection.h>
28 #include <ytkmm/selectiondata.h>
34 template<
class DataType>
53 while (first != last) {
69 void add_object_drag (
int column, std::string type_name, Gtk::TargetFlags flags = Gtk::TargetFlags (0));
72 void on_drag_end (Glib::RefPtr<Gdk::DragContext>
const & context);
75 press_start_x = ev->x;
76 press_start_y = ev->y;
77 return TreeView::on_button_press_event (ev);
80 void on_drag_leave(
const Glib::RefPtr<Gdk::DragContext>& context, guint time) {
81 TreeView::on_drag_leave (context, time);
82 suggested_action = context->get_suggested_action();
85 bool on_drag_motion(
const Glib::RefPtr<Gdk::DragContext>& context,
int x,
int y, guint time);
86 bool on_drag_drop(
const Glib::RefPtr<Gdk::DragContext>& context,
int x,
int y, guint time);
125 template<
class DataType>
132 sigc::signal<void, const Glib::RefPtr<Gdk::DragContext>&,
const Gtk::SelectionData&>
signal_drop;
134 void on_drag_data_get(
const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& selection_data, guint
info, guint time) {
135 if (selection_data.get_target() ==
"GTK_TREE_MODEL_ROW") {
137 TreeView::on_drag_data_get (context, selection_data,
info, time);
145 selection_data.set (8, (guchar*)&c,
sizeof(
void*));
147 TreeView::on_drag_data_get (context, selection_data,
info, time);
151 void on_drag_data_received(
const Glib::RefPtr<Gdk::DragContext>& context,
int x,
int y,
const Gtk::SelectionData& selection_data, guint
info, guint time) {
157 TreeView::on_drag_data_received (context, x, y, selection_data,
info, time);
161 if (selection_data.get_target() ==
"GTK_TREE_MODEL_ROW") {
162 TreeView::on_drag_data_received (context, x, y, selection_data,
info, time);
166 for (std::list<Gtk::TargetEntry>::const_iterator i =
draggable.begin(); i !=
draggable.end (); ++i) {
167 if (selection_data.get_target() == (*i).get_target()) {
169 context->drag_finish (
true,
false, time);
191 for (Gtk::TreeSelection::ListHandle_Path::iterator x =
selection.begin(); x !=
selection.end(); ++x) {
void set_drag_column(int c)
void add_object_drag(int column, std::string type_name, Gtk::TargetFlags flags=Gtk::TargetFlags(0))
std::list< Gtk::TargetEntry > draggable
sigc::signal4< bool, const Glib::RefPtr< Gdk::DragContext > &, int, int, guint, BoolAccumulator > signal_motion
bool on_button_press_event(GdkEventButton *ev)
static DragData drag_data
void on_drag_leave(const Glib::RefPtr< Gdk::DragContext > &context, guint time)
Gdk::DragAction suggested_action
bool on_drag_drop(const Glib::RefPtr< Gdk::DragContext > &context, int x, int y, guint time)
bool on_drag_motion(const Glib::RefPtr< Gdk::DragContext > &context, int x, int y, guint time)
void on_drag_begin(Glib::RefPtr< Gdk::DragContext > const &context)
void add_drop_targets(std::list< Gtk::TargetEntry > &)
void on_drag_end(Glib::RefPtr< Gdk::DragContext > const &context)
sigc::signal< void, const Glib::RefPtr< Gdk::DragContext > &, const Gtk::SelectionData & > signal_drop
void on_drag_data_get(const Glib::RefPtr< Gdk::DragContext > &context, Gtk::SelectionData &selection_data, guint info, guint time)
void get_object_drag_data(std::list< DataType > &l, Gtk::TreeView **source) const
void on_drag_data_received(const Glib::RefPtr< Gdk::DragContext > &context, int x, int y, const Gtk::SelectionData &selection_data, guint info, guint time)
link region and track selection