Next: Gtk2::TreeSortable::IterCompareFunc | Previous: Gtk2::TreeSelection | [Gtk2-Perl - Table of Contents] | [Gtk2-Perl - Index] |
Gtk2::TreeSortable
Glib::Interface +----Gtk2::TreeSortable
Returns sort_column_id, an integer and order, a Gtk2::SortType.
If you want your custom tree model to be sortable, you need to implement the
GtkTreeSortable interface. Just like with other interfaces, this boils down
to announcing that your subclass implements the interface and providing a few
virtual methods. The former is achieved by adding Gtk2::TreeSortable
to the
interfaces
key. For example:
package MyModel; use Gtk2; use Glib::Object::Subclass Glib::Object::, interfaces => [ Gtk2::TreeModel::, Gtk2::TreeSortable:: ], ;
The virtual methods you need to implement are listed below.
These virtual methods are called by perl when gtk+ attempts to modify the sorting behavior of your model. Implement them in your model's package. Note that we don't provide a wrapper for sort_column_changed because there is a signal for it, which means you can use the normal signal overriding mechanism documented in Glib::Object::Subclass.
The $func and $data arguments passed to these two methods should be treated as blackboxes. They are generic containers for some callback that is to be invoked whenever you want to compare two tree iters. When you call them, make sure to always pass $data. For example:
$retval = $func->($list, $a, $b, $data);
Copyright (C) 2003-2008 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.