Re: Enable drag and drop for treeview?



its possible that this may prove useful to someone:

http://viewcvs.ardour.org/filedetails.php?repname=Ardour&path=%2Ftrunk%
2Flibs%2Fgtkmm2ext%2Fgtkmm2ext%2Fdndtreeview.h

http://viewcvs.ardour.org/filedetails.php?repname=Ardour&path=%2Ftrunk%
2Flibs%2Fgtkmm2ext%2Fdndtreeview.cc

this a derived + templated version of the treeview that attempts to make
handle cross-treeview dragging possible. it provides a single extra
signal, 

	sigc::signal<void,std::string,uint32_t,const DataType*>
signal_object_drop;

(DataType is a template argument)

the signal is emitted when a drag from the DnDTreeView is finished. the
assumption is that the drag source+dest represent a model containing a
set of ptrs to objects of some kind, and that the drag operation is
intended to copy them from one to the other. the signal provides a
string name for the datatype, a count of how many of them have been
drag, and a pointer to an array of the object pointers. 

the goal is to avoid having the drop target needing to understand the
structure of the treeview that was the drag source. 

it also comes with convenience functions to add your own datatypes to
those that can be dragged/dropped.

we use it quite a lot in ardour. i mention it here because i found it
very very very hard to figure out how to do inter-treeview drags and it
took several iterations to get to this rather hacky conclusion.

--p





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]