MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / TreeNodeStoreStackData

Function TreeNodeStoreStackData

imgui_tiny_app/imgui/imgui_widgets.cpp:6832–6852  ·  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

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

Callers 1

TreeNodeBehaviorMethod · 0.85

Calls 1

resizeMethod · 0.45

Tested by

no test coverage detected