Tree Nodes
TreeNode functions return true when the node is open, in which case you need to also callTreePop() when you are finished displaying the tree node contents.
TreeNode
Node label (also used as ID)
True when node is open
TreeNode (with format)
String identifier (not displayed)
Pointer identifier (not displayed)
Format string (printf-style)
True when node is open
TreeNodeEx
Node label
Tree node flags (see ImGuiTreeNodeFlags_)
True when node is open
TreePush / TreePop
TreePush() = Indent() + PushID(). Already called by TreeNode() when returning true, but you can call TreePush/TreePop yourself if desired.
String identifier
Pointer identifier
GetTreeNodeToLabelSpacing
TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode.
Spacing in pixels
Collapsing Headers
CollapsingHeader
TreePop().
Header label
Tree node flags
True when header is open
CollapsingHeader (with close button)
p_visible != NULL: if *p_visible==true display an additional small close button on upper right of the header which will set the bool to false when clicked. If *p_visible==false don’t display the header.
Header label
Pointer to visibility boolean
Tree node flags
True when header is open
Tree Control
SetNextItemOpen
Open state
Condition for setting (see ImGuiCond_)
SetNextItemStorageID
Storage identifier
TreeNodeGetOpen
Storage identifier
True if node is open
Tree Node Flags
ImGuiTreeNodeFlags_
Flags forTreeNodeEx(), CollapsingHeader().
Display Options
| Flag | Description |
|---|---|
ImGuiTreeNodeFlags_None | Default |
ImGuiTreeNodeFlags_Selected | Draw as selected |
ImGuiTreeNodeFlags_Framed | Draw frame with background |
ImGuiTreeNodeFlags_AllowOverlap | Hit testing to allow subsequent widgets to overlap |
ImGuiTreeNodeFlags_NoTreePushOnOpen | Don’t do TreePush() when open (e.g. for CollapsingHeader) |
ImGuiTreeNodeFlags_NoAutoOpenOnLog | Don’t automatically open node when logging is active |
ImGuiTreeNodeFlags_DefaultOpen | Default node to be open |
ImGuiTreeNodeFlags_OpenOnDoubleClick | Open on double-click instead of simple click |
ImGuiTreeNodeFlags_OpenOnArrow | Open when clicking on the arrow part |
ImGuiTreeNodeFlags_Leaf | No collapsing, no arrow (use as convenience for leaf nodes) |
ImGuiTreeNodeFlags_Bullet | Display a bullet instead of arrow |
ImGuiTreeNodeFlags_FramePadding | Use FramePadding to vertically align text baseline |
Width Options
| Flag | Description |
|---|---|
ImGuiTreeNodeFlags_SpanAvailWidth | Extend hit box to right-most edge |
ImGuiTreeNodeFlags_SpanFullWidth | Extend hit box to left-most and right-most edges |
ImGuiTreeNodeFlags_SpanLabelWidth | Narrow hit box + narrow hovering highlight |
ImGuiTreeNodeFlags_SpanAllColumns | Frame will span all columns of container table |
ImGuiTreeNodeFlags_LabelSpanAllColumns | Label will span all columns of container table |
Navigation
| Flag | Description |
|---|---|
ImGuiTreeNodeFlags_NavLeftJumpsToParent | Nav: left arrow moves back to parent |
Tree Lines
| Flag | Description |
|---|---|
ImGuiTreeNodeFlags_DrawLinesNone | No lines drawn |
ImGuiTreeNodeFlags_DrawLinesFull | Horizontal lines to child nodes, vertical line down to TreePop() |
ImGuiTreeNodeFlags_DrawLinesToNodes | Horizontal lines to child nodes, vertical line to bottom-most child |