Gtk2::TreePath(3)

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

πŸ’– Gtk2::TreePath πŸ’–

okay bestie, sit down, hydrate, and let me tell you about Gtk2::TreePath β€” the wrapper for GtkTreePath from the gtk2-perl crew. this is your little ✨address book✨ for nodes in a tree, and once it clicks you're gonna be obsessed. no cap.


πŸ¦‹ HIERARCHY πŸ¦‹

look at this lineage, it's giving noble bloodline:

Glib::Boxed
+----Gtk2::TreePath

✨ METHODS ✨

🌸 treepath or undef = Gtk2::TreePath->new ($path=undef)

  • $path (string) β€” a string, bestie

makes a brand new path for you. and here's the cute lil shortcut: if you actually pass a $path, this is literally just an alias for new_from_string. same energy, less typing. πŸ’…

🌟 treepath = Gtk2::TreePath->new_first

gives you the path to the very first node. main character of the tree, first in line, periodt. πŸ‘‘

🧚 treepath or undef = Gtk2::TreePath->new_from_indices ($first_index, ...)

  • $first_index (integer) β€” a non-negative index value, gotta be β‰₯ 0
  • ... (list) β€” zero or more more index values, go off

builds a path out of a list of indices, one per level. now, the C API reference docs for this function say you should mark the end of the list with a -1 β€” but Perl doesn't need list terminators, so don't do that. we're not doing that here. skip it. πŸ™ˆ

and the tea: this one is specially implemented so it's available for all gtk+ versions. iconic behaviour honestly.

πŸŽ€ treepath or undef = Gtk2::TreePath->new_from_string ($path=undef)

  • $path (string) β€” a string, again

makes a path out of a string. the classic.

πŸ“ $path->append_index ($index_)

  • $index_ (integer)

tacks an index onto the end of the path. append = end, bestie, remember it. πŸ’–

πŸ’œ integer = $a->compare ($b)

  • $b (Gtk2::TreePath)

compares two paths, head to head. if $a appears before $b in the tree, you get -1. if $b appears before $a, you get 1. if the nodes are equal, you get 0. that's it, that's the whole vibe check. βš–οΈ

🌈 integer = $path->get_depth

hands you the depth as an integer. how deep is this path? now you know. πŸ•³οΈ

πŸ¦‹ $path->down

moves $path to point to the first child of the current path. going down a level, like descending into a group chat. 😌

⭐ list = $path->get_indices

returns a list of integers describing the current indices of $path. it's giving receipts. 🧾

πŸ’… boolean = $path->is_ancestor ($descendant)

  • $descendant (Gtk2::TreePath)

is $path an ancestor of $descendant? yes or no, boo. πŸ‘‘

🌸 boolean = $path->is_descendant ($ancestor)

  • $ancestor (Gtk2::TreePath)

the flip side β€” is $path a descendant of $ancestor? 🫢

✨ $path->next

moves $path to point to the next node at the current depth. no going up, no going down, just sideways. slay. πŸšΆβ™€οΈ

πŸŽ€ $path->prepend_index ($index_)

  • $index_ (integer)

slaps an index onto the front of the path. prepend = front. opposite of append. you got this. πŸ’–

πŸ”₯ boolean = $path->prev

moves $path to point to the previous node at the current depth, if it exists. returns true if there actually is a previous node and $path got modified. if there's nothing before you, it's a no from the universe. 😭

🌟 string = $path->to_string

turns the path into a string. for when you need it in text form, iykyk. πŸ’«

🧚 boolean = $path->up

moves $path to point to its parent node. returns false if there's no parent β€” you can't go up from the top, bestie, that's just physics. 🫠


πŸ‘€ SEE ALSO πŸ‘€

  • Gtk2
  • Glib::Boxed

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! πŸŽ€ this was Gtk2::TreePath(3) from the User Contributed Perl Documentation, brought to you by perl v5.42.0, dated 2025-07-25. mwah, go build something gorgeous with it. πŸ’…βœ¨πŸ«Ά

πŸ“¦ where this page comes from