ImGuiTreeNodeFlags_Leaf=1<<8,// No collapsing, no arrow (use as a convenience for leaf nodes).
ImGuiTreeNodeFlags_Bullet=1<<9,// Display a bullet instead of arrow
ImGuiTreeNodeFlags_FramePadding=1<<10,// Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding().
//ImGuiTreeNodeFlags_SpanAllAvailWidth = 1 << 11, // FIXME: TODO: Extend hit box horizontally even if not framed
//ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 12, // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible
ImGuiTreeNodeFlags_SpanAvailWidth=1<<11,// Extend hit box to the right-most edge, even if not framed. This is not the default in order to allow adding other items on the same line. In the future we may refactor the hit system to be front-to-back, allowing natural overlaps and then this can become the default.
ImGuiTreeNodeFlags_SpanFullWidth=1<<12,// Extend hit box to the left-most and right-most edges (bypass the indented area).
ImGuiTreeNodeFlags_NavLeftJumpsBackHere=1<<13,// (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and TreePop)
//ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 14, // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible
if(ImGui::TreeNode("Advanced, with Selectable nodes"))
{
HelpMarker("This is a more typical looking tree with selectable nodes.\nClick to select, CTRL+Click to toggle, click on arrows or double-click to open.");
staticintselection_mask=(1<<2);// Dumb representation of what may be user-side selection state. You may carry selection state inside or outside your objects in whatever format you see fit.
intnode_clicked=-1;// Temporary storage of what node we have clicked to process selection at the end of the loop. May be a pointer to your own node type, etc.
ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing,ImGui::GetFontSize()*3);// Increase spacing to differentiate leaves from expanded contents.
for(inti=0;i<6;i++)
{
// Disable the default open on single-click behavior and pass in Selected flag according to our selection state.
else//if (!(selection_mask & (1 << node_clicked))) // Depending on selection behavior you want, this commented bit preserve selection when clicking on item that is part of the selection
selection_mask=(1<<node_clicked);// Click to single-select