Renamed SetNextTreeNodeOpen() to SetNextItemOpen(). Refactored SetNextItemXXX stuff to match SetNextWindowXXX code closely.

This commit is contained in:
omar
2019-05-13 15:11:25 +02:00
parent 36e714a459
commit 632469d2e5
6 changed files with 60 additions and 31 deletions

View File

@ -568,13 +568,20 @@ static void ShowDemoWindowWidgets()
if (ImGui::TreeNode("Basic trees"))
{
for (int i = 0; i < 5; i++)
{
// Use SetNextItemOpen() so set the default state of a node to be open.
// We could also use TreeNodeEx() with the ImGuiTreeNodeFlags_DefaultOpen flag to achieve the same thing!
if (i == 0)
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
if (ImGui::TreeNode((void*)(intptr_t)i, "Child %d", i))
{
ImGui::Text("blah blah");
ImGui::SameLine();
if (ImGui::SmallButton("button")) { };
if (ImGui::SmallButton("button")) {};
ImGui::TreePop();
}
}
ImGui::TreePop();
}