Gtk2::TreeIter(3)
π Gtk2::TreeIter β the manual page, but make it make sense β¨
okay so bestie, you know Gtk2::TreeIter? The wrapper for GtkTreeIter? Yeah. That one. This is its whole manual page and I'm gonna walk you through it like we're texting at 2am π¦
It's part of the User Contributed Perl Documentation, and the page itself is Gtk2::TreeIter(3). Let's get into it π
π HIERARCHY
Glib::Boxed
+----Gtk2::TreeIter
it's giving nepo baby but like, in a cute way β Gtk2::TreeIter is a child of Glib::Boxed and that's the whole family tree πΈ
β¨ SYNOPSIS
package MyCustomListStore;
use Glib::Object::Subclass
Glib::Object::,
interfaces => [ Gtk2::TreeModel:: ],
;
...
sub set {
my $list = shift;
my $iter = shift; # a Gtk2::TreeIter
# this method needs access to the internal representation
# of the iter, as the model implementation sees it:
my $arrayref = $iter->to_arrayref ($list->{stamp});
...
}
no cap, that comment in the middle is doing a LOT of heavy lifting and honestly? respect π«Ά
π DESCRIPTION
okay this is the important part, bestie, listen up:
The methods described here are only of use in custom Gtk2::TreeModel implementations; they are not safe to be used on generic iters or in application code.
NOT SAFE. On generic iters. Or in application code. So if you're just vibing in app-land, this is not your page, this is not your moment, go home π
For the real details, go read "CREATING A CUSTOM TREE MODEL" in Gtk2::TreeModel. That's where the lore lives π
π METHODS
π treeiter = Gtk2::TreeIter->new_from_arrayref ($sv_iter)
$sv_iter(scalar) β a scalar, that's the whole vibe
Create a brand new Gtk2::TreeIter from the "internal" array reference representation used by custom Gtk2::TreeModel implementations. It's the glow-up counterpart to Gtk2::TreeIter::to_arrayref() β¨
You use this when you need to create and return a new iter from a method that is not one of the Gtk2::TreeModelIface interface vfuncs. Like, it's not a vfunc, it's just a method, and it still needs to hand back an iter. That's the situation. See "CREATING A CUSTOM TREE MODEL" in Gtk2::TreeModel for more info π«Ά
π¦ $iter->set ($from)
$from(scalar) β also a scalar, keeping it consistent
Set the contents of $iter. And $from can be either another Gtk2::TreeIter or an "internal" arrayref form as described above. Two options, both valid, we love a flexible queen π
Often you'd create a new iter instead of modifying an existing one, but "set" lets you implement things in the style of the "remove" method of Gtk2::ListStore and Gtk2::TreeStore. iykyk π
And ooh, here's the spicy bit β a set can also explicitly invalidate an iter by zapping its stamp, so nobody can accidentally use it again. It's like blocking someone but for memory safety π₯
$iter->set ([0,0,undef,undef]);
β scalar = $iter->to_arrayref ($stamp)
$stamp(integer) β an integer, a whole number, a number that is whole
Convert a boxed Gtk2::TreeIter reference into the "internal" array reference representation used by custom Gtk2::TreeModel implementations. You need this when you gotta get to the data inside your iters in methods which are not the vfuncs of the Gtk2::TreeModelIface interface. Same energy as the one above, just the other direction, it's giving mirror selfie πͺ
the stamp must match. Periodt. This protects the binding code from potential memory faults when attempting to convert an iter that doesn't actually belong to your model.
Like, if the stamp doesn't match, that iter is NOT yours, it's a stranger, do not let it in the house π See "CREATING A CUSTOM TREE MODEL" in Gtk2::TreeModel for more info π
πΈ SEE ALSO
- Gtk2
- Glib::Boxed
- Gtk2::TreeModel
the whole friend group π«Ά
π COPYRIGHT
Copyright (C) 2003-2011 by the gtk2-perl team. (yes the whole team, iconic, love that for them π)
This software is licensed under the LGPL. See Gtk2 for a full notice. Read the license bestie, it's literally right there πβ¨
and that's the page!! π this was Gtk2::TreeIter(3), from perl v5.42.0, dated 2025-07-25, and that's on periodt π bye bestie, go write a custom tree model, you got this π¦π
π¦ where this page comes from
- fedora 43: perl-Gtk2 1.24993-23.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms