Skip to content

GUI Tree

App: apps/gui_tree/

Demonstrates the two Nuklear tree types: node (collapsible folder-style) and tab (tab-style header). Trees can be nested to arbitrary depth.

Terminal window
% ./plume3d gui_tree
  • Tree node (type=0 = NK_TREE_NODE) — file-system-style collapsible sections. State 1 = initially open, 0 = initially collapsed.
  • Tree tab (type=1 = NK_TREE_TAB) — visually flat, tab-style header; used for settings panels or tabbed content areas.
  • Nested trees (sub-folders) using recursive treePush.
// Node tree (folder style)
if (Gui.treePush(0, "Root", 1)) { // type=0, starts open
if (Gui.treePush(0, "Folder1", 1)) {
Gui.layoutRowDynamic(20, 1)
Gui.label(" File1.txt")
Gui.label(" File2.txt")
Gui.treePop()
}
if (Gui.treePush(0, "Folder2", 0)) { // starts collapsed
Gui.layoutRowDynamic(20, 1)
Gui.label(" File3.txt")
Gui.treePop()
}
Gui.treePop()
}
// Tab tree (settings panel style)
if (Gui.treePush(1, "Graphics Settings", 1)) { // type=1
_fullscreen = Gui.checkbox("Fullscreen", _fullscreen)
_shadows = Gui.checkbox("Shadows", _shadows)
Gui.treePop()
}

treePop() must be called if and only if treePush returned true. Never pop when it returned false.

  • GuitreePush, treePop.