Each node in the frame tree is a tree node object (yeah, really). All internal tree nodes have a :parent
property and a :children
property. As an example, we can inspect the root node in the REPL:
(def node (get-in jwno/context [:window-manager :root]))
(def parent (in node :parent))
(def children (in node :children))
(printf "Parent: %n, number of children: %n" parent (length children))
Since it's the root node, its :parent
is nil
. And the :children
property is a simple array, where you can have access to all its child nodes.
The tree-node-dump-subtree
function in win.janet
is a good reference for traversing the frame tree recursively (It's the implementation of the :dump-subtree
method we used to print the frame tree in Inspecting the Frame Tree).