MCPcopy Create free account
hub / github.com/Wemino/MarkerPatch / TreeNodeStoreStackData

Function TreeNodeStoreStackData

include/imgui/imgui_widgets.cpp:6847–6867  ·  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

6845// Store ImGuiTreeNodeStackData for just submitted node.
6846// Currently only supports 32 level deep and we are fine with (1 << Depth) overflowing into a zero, easy to increase.
6847static void TreeNodeStoreStackData(ImGuiTreeNodeFlags flags, float x1)
6848{
6849 ImGuiContext& g = *GImGui;
6850 ImGuiWindow* window = g.CurrentWindow;
6851
6852 g.TreeNodeStack.resize(g.TreeNodeStack.Size + 1);
6853 ImGuiTreeNodeStackData* tree_node_data = &g.TreeNodeStack.Data[g.TreeNodeStack.Size - 1];
6854 tree_node_data->ID = g.LastItemData.ID;
6855 tree_node_data->TreeFlags = flags;
6856 tree_node_data->ItemFlags = g.LastItemData.ItemFlags;
6857 tree_node_data->NavRect = g.LastItemData.NavRect;
6858
6859 // Initially I tried to latch value for GetColorU32(ImGuiCol_TreeLines) but it's not a good trade-off for very large trees.
6860 const bool draw_lines = (flags & (ImGuiTreeNodeFlags_DrawLinesFull | ImGuiTreeNodeFlags_DrawLinesToNodes)) != 0;
6861 tree_node_data->DrawLinesX1 = draw_lines ? (x1 + g.FontSize * 0.5f + g.Style.FramePadding.x) : +FLT_MAX;
6862 tree_node_data->DrawLinesTableColumn = (draw_lines && g.CurrentTable) ? (ImGuiTableColumnIdx)g.CurrentTable->CurrentColumn : -1;
6863 tree_node_data->DrawLinesToNodesY2 = -FLT_MAX;
6864 window->DC.TreeHasStackDataDepthMask |= (1 << window->DC.TreeDepth);
6865 if (flags & ImGuiTreeNodeFlags_DrawLinesToNodes)
6866 window->DC.TreeRecordsClippedNodesY2Mask |= (1 << window->DC.TreeDepth);
6867}
6868
6869bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end)
6870{

Callers 1

TreeNodeBehaviorMethod · 0.85

Calls 1

resizeMethod · 0.45

Tested by

no test coverage detected