CollapsingHeader: Added support for ImGuiTreeNodeFlags_Bullet and ImGuiTreeNodeFlags_Leaf on framed nodes. (#2159, #2160)

The Bullet and Leaf ImGuiTreeNodeFlags are now taken into account for Framed/CollapsingHeader tree nodes as well. TreeNodeEx() can be used to specify these flags. A choice was made to left-adjust the Framed text when no Bullet/Arrow is rendered, since this was deemed to look better in the Framed context (especially when considering that CollapsingHeader is drawn using NoTreePushOnOpen, so child/sibling Text items etc will often be non-indented).
This commit is contained in:
goran-w
2018-10-30 15:52:27 +01:00
committed by omar
parent ca858c084b
commit e100523917
3 changed files with 21 additions and 6 deletions

View File

@ -677,7 +677,7 @@ static void ShowDemoWindowWidgets()
{
static bool closable_group = true;
ImGui::Checkbox("Show 2nd header", &closable_group);
if (ImGui::CollapsingHeader("Header"))
if (ImGui::CollapsingHeader("Header", ImGuiTreeNodeFlags_None))
{
ImGui::Text("IsItemHovered: %d", ImGui::IsItemHovered());
for (int i = 0; i < 5; i++)
@ -689,6 +689,10 @@ static void ShowDemoWindowWidgets()
for (int i = 0; i < 5; i++)
ImGui::Text("More content %d", i);
}
/*
if (ImGui::CollapsingHeader("Header with a bullet", ImGuiTreeNodeFlags_Bullet))
ImGui::Text("IsItemHovered: %d", ImGui::IsItemHovered());
*/
ImGui::TreePop();
}
@ -696,6 +700,11 @@ static void ShowDemoWindowWidgets()
{
ImGui::BulletText("Bullet point 1");
ImGui::BulletText("Bullet point 2\nOn multiple lines");
if (ImGui::TreeNode("Tree node"))
{
ImGui::BulletText("Another bullet point");
ImGui::TreePop();
}
ImGui::Bullet(); ImGui::Text("Bullet point 3 (two calls)");
ImGui::Bullet(); ImGui::SmallButton("Button");
ImGui::TreePop();