Added CollapsingHeader() variant with close button, obsoleted 4 parameters version. Refactored code into TreeNodeBehavior. (#600)

New flag and declaration makes uses of SetNextTreeNode() functions on
collapsing header more obvious as well (#579).
This commit is contained in:
ocornut
2016-05-01 14:34:55 +02:00
parent befe02559a
commit df749e3f13
4 changed files with 127 additions and 67 deletions

View File

@ -284,6 +284,23 @@ void ImGui::ShowTestWindow(bool* p_opened)
ImGui::TreePop();
}
if (ImGui::TreeNode("Collapsing Headers"))
{
static bool closable_group = true;
if (ImGui::CollapsingHeader("Header"))
{
ImGui::Checkbox("Enable extra group", &closable_group);
for (int i = 0; i < 5; i++)
ImGui::Text("Some content %d", i);
}
if (ImGui::CollapsingHeader("Header with a close button", &closable_group))
{
for (int i = 0; i < 5; i++)
ImGui::Text("More content %d", i);
}
ImGui::TreePop();
}
if (ImGui::TreeNode("Bullets"))
{
ImGui::BulletText("Bullet point 1");