NAME

Gtk2::Ex::TreeModelFilter::DragDest -- drag destination mix-in for TreeModelFilter subclasses

SYNOPSIS

 package MyNewFilterModel;
 use Gtk2;
 use base 'Gtk2::Ex::TreeModelFilter::DragDest';

 use Glib::Object::Subclass
   Gtk2::TreeModelFilter::,
   interfaces => [ 'Gtk2::TreeDragDest' ];

DESCRIPTION

Gtk2::Ex::TreeModelFilter::DragDest provides the following two functions to implement the Gtk2::TreeDragDest interface in a sub-class of Gtk2::TreeModelFilter.

    ROW_DROP_POSSIBLE
    DRAG_DATA_RECEIVED

They're designed as a multiple-inheritance mix-in, so you put Gtk2::Ex::TreeModelFilter::DragDest in your @ISA, then add Gtk2::TreeDragDest to the interfaces in your use Glib::Object::Subclass (or register_object).

For simple filter draggability you'll probably find Gtk2::Ex::TreeModelFilter::Draggable enough, but DragDest lets you add draggability to sub-sub-classes of TreeModelFilter.

Drop

The drop strategy is simply to delegate to the filter's child-model. If it's not a TreeDragDest, but is another Gtk2::TreeModelFilter, then its child-model is tried, and so downwards to the first TreeDragDest capable child. The destination path position is converted as necessary.

If the drag source is the filter itself (which is usual for say dragging in a Gtk2::TreeView) then the source row ends up being from the first non-filter child model. The above drop strategy ends up on that same child, which is important for instance for a Gtk2::ListStore since it only allows drags within itself.

OTHER NOTES

There's probably no reason GtkTreeModelFilter itself couldn't do this sort of drop, but as of Gtk 2.12 it doesn't. Perhaps by the time you read this it will, and you won't need this code.

If your filter's "visible" function decides a newly dropped row shouldn't appear then the drop still works, but it'll look to the user like the source just disappeared. That might be confusing; or if the destination is some designated "hidden track" then it be what you want.

SEE ALSO

Gtk2::TreeModelFilter, Gtk2::TreeModel

HOME PAGE

http://user42.tuxfamily.org/gtk2-ex-treemodelfilter-dragdest/

COPYRIGHT

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 http://www.gnu.org/licenses/.