Author image Kevin Ryde
and 1 contributors


Gtk2::Ex::TreeModelFilter::Draggable -- draggable subclass of TreeModelFilter


 use Gtk2::Ex::TreeModelFilter::Draggable;
 my $filter = Gtk2::Ex::TreeModelFilter::Draggable->new ($child_model);


Gtk2::Ex::TreeModelFilter::Draggable is a subclass of Gtk2::TreeModelFilter


and adds the interface



Gtk2::Ex::TreeModelFilter::Draggable subclasses Gtk2::TreeModelFilter to add a Gtk2::TreeDragDest interface, making rows draggable when displayed for instance in a Gtk2::TreeView. Everything else in TreeModelFilter is unchanged. Basically to get a draggable filtered model use


wherever you would have had Gtk2::TreeModelFilter->new. See Gtk2::Ex::TreeModelFilter::DragDest for the drop details, and for getting DragDest on some other subclass or sub-sub-class of TreeModelFilter.


Gtk2::Ex::TreeModelFilter::Draggable->new ($child_model)
Gtk2::Ex::TreeModelFilter::Draggable->new ($child_model, $virtual_root)

Create and return a new TreeModelFilter::Draggable. The parameters are like the core Gtk2::TreeModelFilter->new. $child_model is the underlying model to present (any object implementing Gtk2:TreeModel), and the optional $virtual_root is a Gtk2::TreePath which is a subtree of $child_model to present.

If you subclass further from TreeModelFilter::Draggable using Glib::Object::Subclass then note that module will fiddle with your @ISA to have Glib::Object::new() ahead of the new above. Often this is a good thing if you've got additional properties in your subclass you want to set from new; but you can unfiddle or elevate TreeModelFilter::Draggable if you want the new above (it knows to use the $class argument when run from a subclass, unlike the various C code class-specific new functions).


As of Gtk 2.12 the core Gtk2::TreeModelFilter is a TreeDragSource, but not a TreeDragDest. Perhaps by the time you read this that will have changed. TreeModelFilter::Draggable is setup to watch out for that and omit its own DragDest, on the assumption the core will be equal or better. You can decide whether this is prudently forward-looking, or naively optimistic.


Gtk2::TreeModelFilter, Gtk2::Ex::TreeModelFilter::DragDest, Gtk2::TreeModel



Copyright 2008, 2009, 2010 Kevin Ryde

Gtk2-Ex-TreeModelFilter-DragDest is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Gtk2-Ex-TreeModelFilter-DragDest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Gtk2-Ex-TreeModelFilter-DragDest. If not, see