Gtk2::TreeStore(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

πŸ’– Gtk2::TreeStore β€” the manual, but make it cute ✨

okay bestie, gather round, because this is Gtk2::TreeStore(3) from the User Contributed Perl Documentation and it is literally the wrapper for GtkTreeStore. it's giving tree-shaped data structure energy and we are obsessed. πŸŒ³πŸ’…


🌸 NAME 🌸

Gtk2::TreeStore β€” the wrapper for GtkTreeStore, no cap. that's it, that's the name, she's simple and she's iconic. πŸ‘‘


πŸ¦‹ HIERARCHY πŸ¦‹

here's the family tree (pun fully intended, i'm hilarious):

Glib::Object
+----Gtk2::TreeStore

so she's a Glib::Object and Gtk2::TreeStore is her glow-up era. periodt. ✨


πŸŽ€ INTERFACES πŸŽ€

the vibes she's serving (she implements all of these):

  • Gtk2::TreeModel
  • Gtk2::TreeDragSource
  • Gtk2::TreeDragDest
  • Gtk2::TreeSortable
  • Gtk2::Buildable

five whole interfaces?? she's the main character fr fr. 🌈


✨ METHODS ✨

🌷 treestore = Gtk2::TreeStore->new (...)

build a brand new store, fresh out of the box, no baggage.

  • ... β€” a (list) of strings, package names

🌷 treeiter = $tree_store->append ($parent)

slap a new row on the end, like adding a story to your close friends list. πŸ“²

  • $parent β€” a Gtk2::TreeIter, or undef

🌷 $tree_store->clear

wipe it. all of it. clean slate, new me, no notes. πŸ’€

🌷 $tree_store->set_column_types (...)

  • ... β€” a (list) of strings, package names

🌷 $tree_store->set ($iter, $col1, $val1, ...)

set the values, drop the data, slay.

  • $iter β€” a Gtk2::TreeIter
  • $col1 β€” (integer) the first column number
  • $val1 β€” (scalar) the first value
  • ... β€” (list) pairs of columns and values

🌷 treeiter = $tree_store->insert ($parent, $position)

  • $parent β€” a Gtk2::TreeIter, or undef
  • $position β€” (integer)

🌷 treeiter = $tree_store->insert_after ($parent, $sibling)

  • $parent β€” a Gtk2::TreeIter, or undef
  • $sibling β€” a Gtk2::TreeIter, or undef

🌷 treeiter = $tree_store->insert_before ($parent, $sibling)

  • $parent β€” a Gtk2::TreeIter, or undef
  • $sibling β€” a Gtk2::TreeIter, or undef

🌷 treeiter = $tree_store->insert_with_values ($parent, $position, ...)

  • $parent β€” a Gtk2::TreeIter, or undef
  • $position β€” (integer) position to insert the new row
  • ... β€” (list) pairs of column numbers and values

okay so this one is basically doing insert and then set, EXCEPT β€” and this is the important part, don't skip it β€” insert_with_values emits only the row-inserted signal, instead of row-inserted, row-changed, and, if the store is sorted, rows-reordered like you'd get in the multiple-operation case. since emitting the rows-reordered signal over and over can genuinely mess with your program's performance, insert_with_values should generally be your fave when you're inserting rows into a sorted tree store. πŸ’…

Since: gtk+ 2.10 β€” vintage but still valid, she's aged like fine wine. 🍷

🌷 boolean = $tree_store->is_ancestor ($iter, $descendant)

  • $iter β€” a Gtk2::TreeIter
  • $descendant β€” a Gtk2::TreeIter

🌷 integer = $tree_store->iter_depth ($iter)

  • $iter β€” a Gtk2::TreeIter

🌷 boolean = $tree_store->iter_is_valid ($iter)

  • $iter β€” a Gtk2::TreeIter
Since: gtk+ 2.2

🌷 $tree_store->move_after ($iter, $position)

  • $iter β€” a Gtk2::TreeIter
  • $position β€” a Gtk2::TreeIter, or undef
Since: gtk+ 2.2

🌷 $tree_store->move_before ($iter, $position)

  • $iter β€” a Gtk2::TreeIter
  • $position β€” a Gtk2::TreeIter, or undef
Since: gtk+ 2.2

🌷 treeiter = $tree_store->prepend ($parent)

  • $parent β€” a Gtk2::TreeIter, or undef

🌷 boolean = $tree_store->remove ($iter)

  • $iter β€” a Gtk2::TreeIter

heads up bestie: the return is always a boolean in the style of Gtk 2.2.x and up, even when you're running on Gtk 2.0.x. consistency queen. πŸ‘‘

🌷 $tree_store->reorder ($parent, ...)

  • $parent β€” a Gtk2::TreeIter, or undef
  • ... β€” (list) of integer's, the new_order
Since: gtk+ 2.2

🌷 $tree_store->swap ($a, $b)

  • $a β€” a Gtk2::TreeIter
  • $b β€” a Gtk2::TreeIter
Since: gtk+ 2.2

🌷 $tree_store->set_value ($iter, $col1, $val1, ...)

  • $iter β€” a Gtk2::TreeIter
  • $col1 β€” (integer) the first column number
  • $val1 β€” (scalar) the first value
  • ... β€” (list) pairs of columns and values

she's just an alias for Gtk2::TreeStore::set(). same girl, different name, iykyk. πŸ’œ


🌈 SEE ALSO 🌈

go read up on these if you want the full lore:

  • Gtk2
  • Glib::Object

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice.


and that's the whole page, bestie, you ate. 🫢 this was perl v5.42.0 on 2025-07-25, signing off β€” stay iconic, stay sorted, and remember: Gtk2::TreeStore(3) loves you. πŸŒΈπŸ’–βœ¨

πŸ“¦ where this page comes from