Gtk2::Ex::TiedTreePath - tie an array to a Gtk2::TreePath
use Gtk2::Ex::TiedTreePath; my $path = Gtk2::Path->new; my @array; tie @array, 'Gtk2::Ex::TiedTreePath', $path; my $aref = Gtk2::Ex::TiedTreePath->new ($path);
TiedTreePath ties a Perl array to a Gtk2::TreePath object so that reading and writing the array acts on the indices making up the path.
Gtk2::TreePath
Like most tie things, TiedTreePath is probably better in concept than actuality. Being able to store to individual elements is handy, as are Perl operations like push and pop, but a native Gtk2::TreePath will suffice for most uses.
tie
delete
exists
A TreePath has no notion of "exists" on an array element. If you delete an element in the middle of the array then it's cleared to 0, but exists is still true, unlike an ordinary perl array where exists is false in that case. The tied exists method simply checks whether the given index is within the number of indices in the path.
Deleting the endmost element of a TiedTreePath works the same as an ordinary array though. In this case the TreePath is shortened with $path->up and exists on that element is then false, being beyond the available indices.
$path->up
tie @var, 'Gtk2::Ex::TiedTreePath', $path
Tie array variable @var to the given $path (a Gtk2::TreePath) so @var it accesses the path indices.
@var
$path
$arrayref = Gtk2::Ex::TiedTreePath->new ($path)
Return an arrayref which is tied to $path. For example
my $aref = Gtk2::Ex::TiedTreePath->new ($path);
is the same as
tie (my @array, 'Gtk2::Ex::TiedTreePath', $path); my $aref = \@array;
If you want your own @array as such then the plain tie is easier. If you want an arrayref to pass around to other funcs then new saves a line of code.
@array
new
The tie object associated with the array (as returned by the tie or obtained later with tied) has the following methods.
tied
$path = $tobj->path
Return the underlying Gtk2::TreePath object. Eg.
my @array; tie @array, 'Gtk2::Ex::TiedTreePath', $path; ... my $tobj = tied(@array); print $tobj->path->to_string;
Or likewise through an arrayref
my $aref = Gtk2::Ex::TiedTreePath->new($path); ... my $path = tied(@$aref)->path;
Gtk2::TreePath, Gtk2::Ex::TiedListColumn
http://user42.tuxfamily.org/gtk2-ex-tiedlistcolumn/
Copyright 2010 Kevin Ryde
Gtk2-Ex-TiedListColumn 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-TiedListColumn 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-TiedListColumn. If not, see http://www.gnu.org/licenses/.
To install Gtk2::Ex::TiedListColumn, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gtk2::Ex::TiedListColumn
CPAN shell
perl -MCPAN -e shell install Gtk2::Ex::TiedListColumn
For more information on module installation, please visit the detailed CPAN module installation guide.