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.
| 7018 | // Store ImGuiTreeNodeStackData for just submitted node. |
| 7019 | // Currently only supports 32 level deep and we are fine with (1 << Depth) overflowing into a zero, easy to increase. |
| 7020 | static void TreeNodeStoreStackData(ImGuiTreeNodeFlags flags, float x1) |
| 7021 | { |
| 7022 | ImGuiContext& g = *GImGui; |
| 7023 | ImGuiWindow* window = g.CurrentWindow; |
| 7024 | |
| 7025 | g.TreeNodeStack.resize(g.TreeNodeStack.Size + 1); |
| 7026 | ImGuiTreeNodeStackData* tree_node_data = &g.TreeNodeStack.Data[g.TreeNodeStack.Size - 1]; |
| 7027 | tree_node_data->ID = g.LastItemData.ID; |
| 7028 | tree_node_data->TreeFlags = flags; |
| 7029 | tree_node_data->ItemFlags = g.LastItemData.ItemFlags; |
| 7030 | tree_node_data->NavRect = g.LastItemData.NavRect; |
| 7031 | |
| 7032 | // Initially I tried to latch value for GetColorU32(ImGuiCol_TreeLines) but it's not a good trade-off for very large trees. |
| 7033 | const bool draw_lines = (flags & (ImGuiTreeNodeFlags_DrawLinesFull | ImGuiTreeNodeFlags_DrawLinesToNodes)) != 0; |
| 7034 | tree_node_data->DrawLinesX1 = draw_lines ? (x1 + g.FontSize * 0.5f + g.Style.FramePadding.x) : +FLT_MAX; |
| 7035 | tree_node_data->DrawLinesTableColumn = (draw_lines && g.CurrentTable) ? (ImGuiTableColumnIdx)g.CurrentTable->CurrentColumn : -1; |
| 7036 | tree_node_data->DrawLinesToNodesY2 = -FLT_MAX; |
| 7037 | window->DC.TreeHasStackDataDepthMask |= (1 << window->DC.TreeDepth); |
| 7038 | if (flags & ImGuiTreeNodeFlags_DrawLinesToNodes) |
| 7039 | window->DC.TreeRecordsClippedNodesY2Mask |= (1 << window->DC.TreeDepth); |
| 7040 | } |
| 7041 | |
| 7042 | bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end) |
| 7043 | { |
no test coverage detected