NAME

Gtk2::Ex::TreeModelBits - miscellaneous TreeModel helpers

SYNOPSIS

use Gtk2::Ex::TreeModelBits;

FUNCTIONS

@values = Gtk2::Ex::TreeModelBits::column_contents ($model, $col)

Return a list of all the values in column number $col of a Gtk2::TreeModel object $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 $store all rows passing $subr. $store can be a Gtk2::TreeStore, a Gtk2::ListStore, or another type with the same style $store->remove method. $subr is called

$want_remove = &$subr ($store, $iter)

where $iter is the row being considered and $subr should return true if it wants to remove the row. The order rows are considered is unspecified, except that a parent row is tested before its children (the children of course tested only if the parent is not removed).

@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));

BUGS

remove_matching_rows only works properly in a Perl-Gtk compiled against Gtk 2.2 or higher. If compiled against Gtk 2.0.x then only the first row which $subr asks to remove is removed, then it returns as if there were no more rows. It's unlikely you'll still be using 2.0.x, but watch this space for an emulation in newer Perl-Gtk.

SEE ALSO

Gtk2::ListModel, Gtk2::TreeModel, Gtk2::Ex::WidgetBits

HOME PAGE

http://user42.tuxfamily.org/gtk2-ex-widgetbits/index.html

LICENSE

Copyright 2007, 2008, 2009 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/.