@ -2534,7 +2534,11 @@ static void ShowDemoWindowMisc()
void ImGui : : ShowAboutWindow ( bool * p_open )
{
ImGui : : Begin ( " About Dear ImGui " , p_open , ImGuiWindowFlags_AlwaysAutoResize ) ;
if ( ! ImGui : : Begin ( " About Dear ImGui " , p_open , ImGuiWindowFlags_AlwaysAutoResize ) )
{
ImGui : : End ( ) ;
return ;
}
ImGui : : Text ( " Dear ImGui %s " , ImGui : : GetVersion ( ) ) ;
ImGui : : Separator ( ) ;
ImGui : : Text ( " By Omar Cornut and all dear imgui contributors. " ) ;
@ -2726,20 +2730,13 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
ImGui : : SameLine ( ) ;
ShowHelpMarker ( " Save/Revert in local non-persistent storage. Default Colors definition are not affected. Use \" Export Colors \" below to save them somewhere. " ) ;
if ( ImGui : : TreeNode ( " Rendering " ) )
{
ImGui : : Checkbox ( " Anti-aliased lines " , & style . AntiAliasedLines ) ; ImGui : : SameLine ( ) ; ShowHelpMarker ( " When disabling anti-aliasing lines, you'll probably want to disable borders in your style as well. " ) ;
ImGui : : Checkbox ( " Anti-aliased fill " , & style . AntiAliasedFill ) ;
ImGui : : PushItemWidth ( 100 ) ;
ImGui : : DragFloat ( " Curve Tessellation Tolerance " , & style . CurveTessellationTol , 0.02f , 0.10f , FLT_MAX , " %.2f " , 2.0f ) ;
if ( style . CurveTessellationTol < 0.10f ) style . CurveTessellationTol = 0.10f ;
ImGui : : DragFloat ( " Global Alpha " , & style . Alpha , 0.005f , 0.20f , 1.0f , " %.2f " ) ; // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero.
ImGui : : PopItemWidth ( ) ;
ImGui : : TreePop ( ) ;
}
ImGui : : Separator ( ) ;
if ( ImGui : : TreeNode( " Settings " ) )
if ( ImGui : : BeginTabBar ( " ##tabs " , ImGuiTabBarFlags_None ) )
{
if ( ImGui : : BeginTabItem ( " Sizes " ) )
{
ImGui : : Text ( " Main " ) ;
ImGui : : SliderFloat2 ( " WindowPadding " , ( float * ) & style . WindowPadding , 0.0f , 20.0f , " %.0f " ) ;
ImGui : : SliderFloat ( " PopupRounding " , & style . PopupRounding , 0.0f , 16.0f , " %.0f " ) ;
ImGui : : SliderFloat2 ( " FramePadding " , ( float * ) & style . FramePadding , 0.0f , 20.0f , " %.0f " ) ;
@ -2749,7 +2746,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
ImGui : : SliderFloat ( " IndentSpacing " , & style . IndentSpacing , 0.0f , 30.0f , " %.0f " ) ;
ImGui : : SliderFloat ( " ScrollbarSize " , & style . ScrollbarSize , 1.0f , 20.0f , " %.0f " ) ;
ImGui : : SliderFloat ( " GrabMinSize " , & style . GrabMinSize , 1.0f , 20.0f , " %.0f " ) ;
ImGui : : Text ( " Border Size " ) ;
ImGui : : Text ( " Border s " ) ;
ImGui : : SliderFloat ( " WindowBorderSize " , & style . WindowBorderSize , 0.0f , 1.0f , " %.0f " ) ;
ImGui : : SliderFloat ( " ChildBorderSize " , & style . ChildBorderSize , 0.0f , 1.0f , " %.0f " ) ;
ImGui : : SliderFloat ( " PopupBorderSize " , & style . PopupBorderSize , 0.0f , 1.0f , " %.0f " ) ;
@ -2767,10 +2764,10 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
ImGui : : SliderFloat2 ( " ButtonTextAlign " , ( float * ) & style . ButtonTextAlign , 0.0f , 1.0f , " %.2f " ) ; ImGui : : SameLine ( ) ; ShowHelpMarker ( " Alignment applies when a button is larger than its text content. " ) ;
ImGui : : Text ( " Safe Area Padding " ) ; ImGui : : SameLine ( ) ; ShowHelpMarker ( " Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured). " ) ;
ImGui : : SliderFloat2 ( " DisplaySafeAreaPadding " , ( float * ) & style . DisplaySafeAreaPadding , 0.0f , 30.0f , " %.0f " ) ;
ImGui : : TreePop ( ) ;
ImGui : : EndTabItem ( ) ;
}
if ( ImGui : : TreeNode ( " Colors " ) )
if ( ImGui : : BeginTabItem ( " Colors " ) )
{
static int output_dest = 0 ;
static bool output_only_modified = true ;
@ -2793,17 +2790,16 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
ImGui : : SameLine ( ) ; ImGui : : PushItemWidth ( 120 ) ; ImGui : : Combo ( " ##output_type " , & output_dest , " To Clipboard \0 To TTY \0 " ) ; ImGui : : PopItemWidth ( ) ;
ImGui : : SameLine ( ) ; ImGui : : Checkbox ( " Only Modified Colors " , & output_only_modified ) ;
ImGui : : Text ( " Tip: Left-click on colored square to open color picker, \n Right-click to open edit options menu. " ) ;
static ImGuiTextFilter filter ;
filter . Draw ( " Filter colors " , 200 ) ;
filter . Draw ( " Filter colors " , ImGui : : GetFontSize ( ) * 16 ) ;
static ImGuiColorEditFlags alpha_flags = 0 ;
ImGui : : RadioButton ( " Opaque " , & alpha_flags , 0 ) ; ImGui : : SameLine ( ) ;
ImGui : : RadioButton ( " Alpha " , & alpha_flags , ImGuiColorEditFlags_AlphaPreview ) ; ImGui : : SameLine ( ) ;
ImGui : : RadioButton ( " Both " , & alpha_flags , ImGuiColorEditFlags_AlphaPreviewHalf ) ;
ImGui : : RadioButton ( " Both " , & alpha_flags , ImGuiColorEditFlags_AlphaPreviewHalf ) ; ImGui : : SameLine ( ) ;
ShowHelpMarker ( " In the color list: \n Left-click on colored square to open color picker, \n Right-click to open edit options menu. " ) ;
ImGui : : BeginChild ( " # colors" , ImVec2 ( 0 , 30 0) , true , ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar | ImGuiWindowFlags_NavFlattened ) ;
ImGui : : BeginChild ( " # # colors" , ImVec2 ( 0 , 0) , true , ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar | ImGuiWindowFlags_NavFlattened ) ;
ImGui : : PushItemWidth ( - 160 ) ;
for ( int i = 0 ; i < ImGuiCol_COUNT ; i + + )
{
@ -2826,24 +2822,19 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
ImGui : : PopItemWidth ( ) ;
ImGui : : EndChild ( ) ;
ImGui : : TreePop ( ) ;
ImGui : : EndTabItem ( ) ;
}
bool fonts_opened = ImGui : : TreeNode ( " Fonts " , " Fonts (%d) " , ImGui : : GetIO ( ) . Fonts - > Fonts . Size ) ;
if ( fonts_opened )
if ( ImGui : : BeginTabItem ( " Fonts " ) )
{
ImFontAtlas * atlas = ImGui : : GetIO ( ) . Fonts ;
if ( ImGui : : TreeNode ( " Atlas texture " , " Atlas texture (%dx%d pixels) " , atlas - > TexWidth , atlas - > TexHeight ) )
{
ImGui : : Image ( atlas - > TexID , ImVec2 ( ( float ) atlas - > TexWidth , ( float ) atlas - > TexHeight ) , ImVec2 ( 0 , 0 ) , ImVec2 ( 1 , 1 ) , ImColor ( 255 , 255 , 255 , 255 ) , ImColor ( 255 , 255 , 255 , 128 ) ) ;
ImGui : : TreePop ( ) ;
}
ImGui : : PushItemWidth ( 100 ) ;
ShowHelpMarker ( " Read FAQ and misc/fonts/README.txt for details on font loading. " ) ;
ImGui : : PushItemWidth ( 120 ) ;
for ( int i = 0 ; i < atlas - > Fonts . Size ; i + + )
{
ImFont * font = atlas - > Fonts [ i ] ;
ImGui : : PushID ( font ) ;
bool font_details_opened = ImGui : : TreeNode ( font , " Font %d: \ '%s \' , %.2f px, %d glyphs " , i , font - > ConfigData ? font - > ConfigData [ 0 ] . Name : " " , font - > FontSize , font - > Glyphs . Size ) ;
bool font_details_opened = ImGui : : TreeNode ( font , " Font %d: \ "%s \" \n %.2f px, %d glyphs, %d file(s) " , i , font - > ConfigData ? font - > ConfigData [ 0 ] . Name : " " , font - > FontSize , font - > Glyphs . Size , font - > ConfigDataCount ) ;
ImGui : : SameLine ( ) ; if ( ImGui : : SmallButton ( " Set as default " ) ) ImGui : : GetIO ( ) . FontDefault = font ;
if ( font_details_opened )
{
@ -2902,12 +2893,35 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
}
ImGui : : PopID ( ) ;
}
if ( ImGui : : TreeNode ( " Atlas texture " , " Atlas texture (%dx%d pixels) " , atlas - > TexWidth , atlas - > TexHeight ) )
{
ImGui : : Image ( atlas - > TexID , ImVec2 ( ( float ) atlas - > TexWidth , ( float ) atlas - > TexHeight ) , ImVec2 ( 0 , 0 ) , ImVec2 ( 1 , 1 ) , ImColor ( 255 , 255 , 255 , 255 ) , ImColor ( 255 , 255 , 255 , 128 ) ) ;
ImGui : : TreePop ( ) ;
}
static float window_scale = 1.0f ;
ImGui : : DragFloat ( " this window scale " , & window_scale , 0.005f , 0.3f , 2.0f , " %.1f " ) ; // scale only this window
if ( ImGui : : DragFloat ( " this window scale " , & window_scale , 0.005f , 0.3f , 2.0f , " %.1f " ) ) // scale only this window
ImGui : : SetWindowFontScale ( window_scale ) ;
ImGui : : DragFloat ( " global scale " , & ImGui : : GetIO ( ) . FontGlobalScale , 0.005f , 0.3f , 2.0f , " %.1f " ) ; // scale everything
ImGui : : PopItemWidth ( ) ;
ImGui : : SetWindowFontScale ( window_scale ) ;
ImGui : : TreePop ( ) ;
ImGui : : EndTabItem ( ) ;
}
if ( ImGui : : BeginTabItem ( " Rendering " ) )
{
ImGui : : Checkbox ( " Anti-aliased lines " , & style . AntiAliasedLines ) ; ImGui : : SameLine ( ) ; ShowHelpMarker ( " When disabling anti-aliasing lines, you'll probably want to disable borders in your style as well. " ) ;
ImGui : : Checkbox ( " Anti-aliased fill " , & style . AntiAliasedFill ) ;
ImGui : : PushItemWidth ( 100 ) ;
ImGui : : DragFloat ( " Curve Tessellation Tolerance " , & style . CurveTessellationTol , 0.02f , 0.10f , FLT_MAX , " %.2f " , 2.0f ) ;
if ( style . CurveTessellationTol < 0.10f ) style . CurveTessellationTol = 0.10f ;
ImGui : : DragFloat ( " Global Alpha " , & style . Alpha , 0.005f , 0.20f , 1.0f , " %.2f " ) ; // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero.
ImGui : : PopItemWidth ( ) ;
ImGui : : EndTabItem ( ) ;
}
ImGui : : EndTabBar ( ) ;
}
ImGui : : PopItemWidth ( ) ;
@ -3447,7 +3461,20 @@ static void ShowExampleAppLayout(bool* p_open)
ImGui : : BeginChild ( " item view " , ImVec2 ( 0 , - ImGui : : GetFrameHeightWithSpacing ( ) ) ) ; // Leave room for 1 line below us
ImGui : : Text ( " MyObject: %d " , selected ) ;
ImGui : : Separator ( ) ;
if ( ImGui : : BeginTabBar ( " ##Tabs " , ImGuiTabBarFlags_None ) )
{
if ( ImGui : : BeginTabItem ( " Description " ) )
{
ImGui : : TextWrapped ( " Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " ) ;
ImGui : : EndTabItem ( ) ;
}
if ( ImGui : : BeginTabItem ( " Details " ) )
{
ImGui : : Text ( " ID: 0123456789 " ) ;
ImGui : : EndTabItem ( ) ;
}
ImGui : : EndTabBar ( ) ;
}
ImGui : : EndChild ( ) ;
if ( ImGui : : Button ( " Revert " ) ) { }
ImGui : : SameLine ( ) ;
@ -3935,7 +3962,11 @@ void ShowExampleAppDocuments(bool* p_open)
{
static ExampleAppDocuments app ;
ImGui : : Begin ( " Examples: Documents " , p_open , ImGuiWindowFlags_MenuBar ) ;
if ( ! ImGui : : Begin ( " Examples: Documents " , p_open , ImGuiWindowFlags_MenuBar ) )
{
ImGui : : End ( ) ;
return ;
}
// Options
static bool opt_reorderable = true ;