Gtk2::TreeSortable(3pm) | User Contributed Perl Documentation | Gtk2::TreeSortable(3pm) |
Gtk2::TreeSortable - wrapper for GtkTreeSortable
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);
Gtk2, Glib::Interface
Copyright (C) 2003-2011 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
2017-06-24 | perl v5.24.1 |