21 #ifndef __gtkmm2ext_dndtreeview_h__
22 #define __gtkmm2ext_dndtreeview_h__
34 template<
class DataType>
53 while (first != last) {
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>
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);
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) {
std::string get_target() const
void set(int format, const guint8 *data, int length)
Glib::ListHandle< TreeModel::Path, TreePath_Traits > ListHandle_Path
Glib::RefPtr< TreeModel > get_model()
Glib::RefPtr< TreeSelection > get_selection()
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)
This is a default handler for the signal signal_button_press_event().
static DragData drag_data
void on_drag_leave(const Glib::RefPtr< Gdk::DragContext > &context, guint time)
This is a default handler for the signal signal_drag_leave().
Gdk::DragAction suggested_action
bool on_drag_drop(const Glib::RefPtr< Gdk::DragContext > &context, int x, int y, guint time)
This is a default handler for the signal signal_drag_drop().
bool on_drag_motion(const Glib::RefPtr< Gdk::DragContext > &context, int x, int y, guint time)
This is a default handler for the signal signal_drag_motion().
void on_drag_begin(Glib::RefPtr< Gdk::DragContext > const &context)
This is a default handler for the signal signal_drag_begin().
void add_drop_targets(std::list< Gtk::TargetEntry > &)
void on_drag_end(Glib::RefPtr< Gdk::DragContext > const &context)
This is a default handler for the signal signal_drag_end().
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)
This is a default handler for the signal signal_drag_data_get().
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)
This is a default handler for the signal signal_drag_data_received().
link region and track selection