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

Method DisplayNode

imgui_tiny_app/imgui/imgui_demo.cpp:6912–6947  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6910 int ChildIdx;
6911 int ChildCount;
6912 static void DisplayNode(const MyTreeNode* node, const MyTreeNode* all_nodes)
6913 {
6914 ImGui::TableNextRow();
6915 ImGui::TableNextColumn();
6916 const bool is_folder = (node->ChildCount > 0);
6917
6918 ImGuiTreeNodeFlags node_flags = tree_node_flags_base;
6919 if (node != &all_nodes[0])
6920 node_flags &= ~ImGuiTreeNodeFlags_LabelSpanAllColumns; // Only demonstrate this on the root node.
6921
6922 if (is_folder)
6923 {
6924 bool open = ImGui::TreeNodeEx(node->Name, node_flags);
6925 if ((node_flags & ImGuiTreeNodeFlags_LabelSpanAllColumns) == 0)
6926 {
6927 ImGui::TableNextColumn();
6928 ImGui::TextDisabled("--");
6929 ImGui::TableNextColumn();
6930 ImGui::TextUnformatted(node->Type);
6931 }
6932 if (open)
6933 {
6934 for (int child_n = 0; child_n < node->ChildCount; child_n++)
6935 DisplayNode(&all_nodes[node->ChildIdx + child_n], all_nodes);
6936 ImGui::TreePop();
6937 }
6938 }
6939 else
6940 {
6941 ImGui::TreeNodeEx(node->Name, node_flags | ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_Bullet | ImGuiTreeNodeFlags_NoTreePushOnOpen);
6942 ImGui::TableNextColumn();
6943 ImGui::Text("%d", node->Size);
6944 ImGui::TableNextColumn();
6945 ImGui::TextUnformatted(node->Type);
6946 }
6947 }
6948 };
6949 static const MyTreeNode nodes[] =
6950 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected