MCPcopy Create free account
hub / github.com/cinder/Cinder / TreeNodeStoreStackData

Function TreeNodeStoreStackData

src/imgui/imgui_widgets.cpp:6732–6752  ·  view source on GitHub ↗

Store ImGuiTreeNodeStackData for just submitted node. Currently only supports 32 level deep and we are fine with (1 << Depth) overflowing into a zero, easy to increase.

Source from the content-addressed store, hash-verified

6730// Store ImGuiTreeNodeStackData for just submitted node.
6731// Currently only supports 32 level deep and we are fine with (1 << Depth) overflowing into a zero, easy to increase.
6732static void TreeNodeStoreStackData(ImGuiTreeNodeFlags flags, float x1)
6733{
6734 ImGuiContext& g = *GImGui;
6735 ImGuiWindow* window = g.CurrentWindow;
6736
6737 g.TreeNodeStack.resize(g.TreeNodeStack.Size + 1);
6738 ImGuiTreeNodeStackData* tree_node_data = &g.TreeNodeStack.Data[g.TreeNodeStack.Size - 1];
6739 tree_node_data->ID = g.LastItemData.ID;
6740 tree_node_data->TreeFlags = flags;
6741 tree_node_data->ItemFlags = g.LastItemData.ItemFlags;
6742 tree_node_data->NavRect = g.LastItemData.NavRect;
6743
6744 // Initially I tried to latch value for GetColorU32(ImGuiCol_TreeLines) but it's not a good trade-off for very large trees.
6745 const bool draw_lines = (flags & (ImGuiTreeNodeFlags_DrawLinesFull | ImGuiTreeNodeFlags_DrawLinesToNodes)) != 0;
6746 tree_node_data->DrawLinesX1 = draw_lines ? (x1 + g.FontSize * 0.5f + g.Style.FramePadding.x) : +FLT_MAX;
6747 tree_node_data->DrawLinesTableColumn = (draw_lines && g.CurrentTable) ? (ImGuiTableColumnIdx)g.CurrentTable->CurrentColumn : -1;
6748 tree_node_data->DrawLinesToNodesY2 = -FLT_MAX;
6749 window->DC.TreeHasStackDataDepthMask |= (1 << window->DC.TreeDepth);
6750 if (flags & ImGuiTreeNodeFlags_DrawLinesToNodes)
6751 window->DC.TreeRecordsClippedNodesY2Mask |= (1 << window->DC.TreeDepth);
6752}
6753
6754// When using public API, currently 'id == storage_id' is always true, but we separate the values to facilitate advanced user code doing storage queries outside of UI loop.
6755bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end)

Callers 1

TreeNodeBehaviorMethod · 0.85

Calls 1

resizeMethod · 0.45

Tested by

no test coverage detected