NAME
Gtk2::Ex::TreeModelBits - miscellaneous TreeModel helpers
SYNOPSIS
use Gtk2::Ex::TreeModelBits;
FUNCTIONS
@types = Gtk2::Ex::TreeModelBits::all_column_types ($model)-
Return a list of all the column types in
$model. For example to create another ListStore with the same types as an existing one,my $new_store = Gtk2::ListStore->new (Gtk2::Ex::TreeModelBits::all_column_types ($old_store)); @values = Gtk2::Ex::TreeModelBits::column_contents ($model, $col)-
Return a list of all the values in column number
$colof aGtk2::TreeModelobject$model.Any tree structure in the model is flattened out for the return. A parent row's column value comes first, followed by the column values from its children, recursively, as per
$model->foreach. Gtk2::Ex::TreeModelBits::remove_matching_rows ($store, $subr, ...)-
Remove from
$storeall rows passing$subr.$storecan be aGtk2::TreeStore, aGtk2::ListStore, or another type with the same style$store->removemethod.$subris called$want_remove = &$subr ($store, $iter, ...)where
$iteris the row being considered, and any extra arguments toremove_matching_rowsare passed on to$subr.$subrshould return true if it wants to remove the row.The order rows are considered and removed is unspecified except that a parent row is tested before its children, and the children of course are not tested if the parent is removed.
If you use an old Gtk 2.0.x and might pass a
Gtk2::ListStoreorGtk2::TreeStoretoremove_matching_rowsthen get Perl-Gtk 1.240 or higher to have theremovemethod on those classes return a flag the same as in Gtk 2.2 and up. Otherwise on those storesremove_matching_rowswill stop after the first row removed. $iter = Gtk2::Ex::TreeModelBits::iter_prev ($model, $iter)-
Return a new
Gtk2::TreeIterwhich is the row preceding the given$iter, at the same depth. If$iteris the first element at its depth then the return isundef.This is like a reverse of
iter_next. Going to the previous row is not a native operation and might be a touch slow if a model uses say a linked list and so must chase through data for a path lookup.
EXPORTS
Nothing is exported by default, but the functions can be requested in usual Exporter style,
use Gtk2::Ex::TreeModelBits 'remove_matching_rows';
remove_matching_rows ($store, sub { ... });
There's no :all tag since this module is meant as a grab-bag of functions and to import as-yet unknown things would be asking for name clashes.
SEE ALSO
Gtk2::ListStore, Gtk2::TreeModel, Gtk2::Ex::WidgetBits, Gtk2::Ex::TreeModel::ImplBits
HOME PAGE
http://user42.tuxfamily.org/gtk2-ex-widgetbits/index.html
LICENSE
Copyright 2007, 2008, 2009, 2010, 2011, 2012 Kevin Ryde
Gtk2-Ex-WidgetBits 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-WidgetBits 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-WidgetBits. If not, see http://www.gnu.org/licenses/.