@ -91,7 +91,7 @@ void ImGui::ShowUserGuide()
}
// Demonstrate most ImGui features (big function!)
void ImGui : : ShowTestWindow ( bool * opened)
void ImGui : : ShowTestWindow ( bool * p_ opened)
{
// Examples apps
static bool show_app_metrics = false ;
@ -145,7 +145,7 @@ void ImGui::ShowTestWindow(bool* opened)
if ( no_scrollbar ) window_flags | = ImGuiWindowFlags_NoScrollbar ;
if ( no_collapse ) window_flags | = ImGuiWindowFlags_NoCollapse ;
if ( ! no_menu ) window_flags | = ImGuiWindowFlags_MenuBar ;
if ( ! ImGui : : Begin ( " ImGui Demo " , opened, ImVec2 ( 550 , 680 ) , bg_alpha , window_flags ) )
if ( ! ImGui : : Begin ( " ImGui Demo " , p_ opened, ImVec2 ( 550 , 680 ) , bg_alpha , window_flags ) )
{
// Early out if the window is collapsed, as an optimization.
ImGui : : End ( ) ;
@ -779,7 +779,7 @@ void ImGui::ShowTestWindow(bool* opened)
ImGui : : TreePop ( ) ;
}
if ( ImGui : : TreeNode ( " Widgets Alignment " ) )
if ( ImGui : : TreeNode ( " Widgets Width " ) )
{
static float f = 0.0f ;
ImGui : : Text ( " PushItemWidth(100) " ) ;
@ -950,6 +950,17 @@ void ImGui::ShowTestWindow(bool* opened)
ImGui : : Text ( " Widget " ) ; ImGui : : SameLine ( ) ;
ImGui : : SmallButton ( " Widget " ) ;
// Tree
const float spacing = ImGui : : GetStyle ( ) . ItemInnerSpacing . x ;
ImGui : : Button ( " Button##1 " ) ;
ImGui : : SameLine ( 0.0f , spacing ) ;
if ( ImGui : : TreeNode ( " Node##1 " ) ) { for ( int i = 0 ; i < 6 ; i + + ) ImGui : : BulletText ( " Item %d.. " , i ) ; ImGui : : TreePop ( ) ; } // Dummy tree data
ImGui : : AlignFirstTextHeightToWidgets ( ) ; // Vertically align text node a bit lower so it'll be vertically centered with upcoming widget. Otherwise you can use SmallButton (smaller fit).
bool tree_opened = ImGui : : TreeNode ( " Node##2 " ) ; // Common mistake to avoid: if we want to SameLine after TreeNode we need to do it before we add child content.
ImGui : : SameLine ( 0.0f , spacing ) ; ImGui : : Button ( " Button##2 " ) ;
if ( tree_opened ) { for ( int i = 0 ; i < 6 ; i + + ) ImGui : : BulletText ( " Item %d.. " , i ) ; ImGui : : TreePop ( ) ; } // Dummy tree data
ImGui : : TreePop ( ) ;
}