@ -214,6 +214,8 @@
Here is a change - log of API breaking changes , if you are using one of the functions listed , expect to have to fix some code .
Here is a change - log of API breaking changes , if you are using one of the functions listed , expect to have to fix some code .
Also read releases logs https : //github.com/ocornut/imgui/releases for more details.
Also read releases logs https : //github.com/ocornut/imgui/releases for more details.
- 2017 / 11 / 18 ( 1.53 ) - Style , Begin : removed ImGuiWindowFlags_ShowBorders window flag . Borders are now fully set up in the ImGuiStyle structure ( see e . g . style . FrameBorderSize , style . WindowBorderSize ) . Use ImGui : : ShowStyleEditor ( ) to look them up .
Please note that the style system will keep evolving ( hopefully stabilizing in Q1 2018 ) , and so custom styles will probably subtly break over time . It is recommended you use the StyleColorsClassic ( ) , StyleColorsDark ( ) , StyleColorsLight ( ) functions .
- 2017 / 11 / 18 ( 1.53 ) - Style : removed ImGuiCol_ComboBg in favor of combo boxes using ImGuiCol_PopupBg for consistency .
- 2017 / 11 / 18 ( 1.53 ) - Style : removed ImGuiCol_ComboBg in favor of combo boxes using ImGuiCol_PopupBg for consistency .
- 2017 / 11 / 18 ( 1.53 ) - Style : renamed ImGuiCol_ChildWindowBg to ImGuiCol_ChildBg .
- 2017 / 11 / 18 ( 1.53 ) - Style : renamed ImGuiCol_ChildWindowBg to ImGuiCol_ChildBg .
- 2017 / 11 / 18 ( 1.53 ) - Style : renamed style . ChildWindowRounding to style . ChildRounding , ImGuiStyleVar_ChildWindowRounding to ImGuiStyleVar_ChildRounding .
- 2017 / 11 / 18 ( 1.53 ) - Style : renamed style . ChildWindowRounding to style . ChildRounding , ImGuiStyleVar_ChildWindowRounding to ImGuiStyleVar_ChildRounding .
@ -704,12 +706,16 @@ ImGuiStyle::ImGuiStyle()
Alpha = 1.0f ; // Global alpha applies to everything in ImGui
Alpha = 1.0f ; // Global alpha applies to everything in ImGui
WindowPadding = ImVec2 ( 8 , 8 ) ; // Padding within a window
WindowPadding = ImVec2 ( 8 , 8 ) ; // Padding within a window
WindowRounding = 9.0f ; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
WindowRounding = 9.0f ; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
WindowBorderSize = 0.0f ; // Thickness of border around windows. Generally set to 0.0f or 1.0f. Other values not well tested.
WindowMinSize = ImVec2 ( 32 , 32 ) ; // Minimum window size
WindowMinSize = ImVec2 ( 32 , 32 ) ; // Minimum window size
WindowTitleAlign = ImVec2 ( 0.0f , 0.5f ) ; // Alignment for title bar text
WindowTitleAlign = ImVec2 ( 0.0f , 0.5f ) ; // Alignment for title bar text
ChildRounding = 0.0f ; // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows
ChildRounding = 0.0f ; // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows
ChildBorderSize = 1.0f ; // Thickness of border around child windows. Generally set to 0.0f or 1.0f. Other values not well tested.
PopupRounding = 0.0f ; // Radius of popup window corners rounding. Set to 0.0f to have rectangular child windows
PopupRounding = 0.0f ; // Radius of popup window corners rounding. Set to 0.0f to have rectangular child windows
PopupBorderSize = 1.0f ; // Thickness of border around popup or tooltip windows. Generally set to 0.0f or 1.0f. Other values not well tested.
FramePadding = ImVec2 ( 4 , 3 ) ; // Padding within a framed rectangle (used by most widgets)
FramePadding = ImVec2 ( 4 , 3 ) ; // Padding within a framed rectangle (used by most widgets)
FrameRounding = 0.0f ; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets).
FrameRounding = 0.0f ; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets).
FrameBorderSize = 0.0f ; // Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested.
ItemSpacing = ImVec2 ( 8 , 4 ) ; // Horizontal and vertical spacing between widgets/lines
ItemSpacing = ImVec2 ( 8 , 4 ) ; // Horizontal and vertical spacing between widgets/lines
ItemInnerSpacing = ImVec2 ( 4 , 4 ) ; // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
ItemInnerSpacing = ImVec2 ( 4 , 4 ) ; // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
TouchExtraPadding = ImVec2 ( 0 , 0 ) ; // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
TouchExtraPadding = ImVec2 ( 0 , 0 ) ; // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
@ -3075,10 +3081,11 @@ void ImGui::RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border,
ImGuiContext & g = * GImGui ;
ImGuiContext & g = * GImGui ;
ImGuiWindow * window = g . CurrentWindow ;
ImGuiWindow * window = g . CurrentWindow ;
window - > DrawList - > AddRectFilled ( p_min , p_max , fill_col , rounding ) ;
window - > DrawList - > AddRectFilled ( p_min , p_max , fill_col , rounding ) ;
if ( border & & ( window - > Flags & ImGuiWindowFlags_ShowBorders ) )
const float border_size = g . Style . FrameBorderSize ;
if ( border & & border_size > 0.0f )
{
{
window - > DrawList - > AddRect ( p_min + ImVec2 ( 1 , 1 ) , p_max + ImVec2 ( 1 , 1 ) , GetColorU32 ( ImGuiCol_BorderShadow ) , rounding );
window - > DrawList - > AddRect ( p_min + ImVec2 ( 1 , 1 ) , p_max + ImVec2 ( 1 , 1 ) , GetColorU32 ( ImGuiCol_BorderShadow ) , rounding , ~ 0 , border_size );
window - > DrawList - > AddRect ( p_min , p_max , GetColorU32 ( ImGuiCol_Border ) , rounding );
window - > DrawList - > AddRect ( p_min , p_max , GetColorU32 ( ImGuiCol_Border ) , rounding , ~ 0 , border_size );
}
}
}
}
@ -3086,10 +3093,11 @@ void ImGui::RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding)
{
{
ImGuiContext & g = * GImGui ;
ImGuiContext & g = * GImGui ;
ImGuiWindow * window = g . CurrentWindow ;
ImGuiWindow * window = g . CurrentWindow ;
if ( window - > Flags & ImGuiWindowFlags_ShowBorders )
const float border_size = g . Style . FrameBorderSize ;
if ( border_size > 0.0f )
{
{
window - > DrawList - > AddRect ( p_min + ImVec2 ( 1 , 1 ) , p_max + ImVec2 ( 1 , 1 ) , GetColorU32 ( ImGuiCol_BorderShadow ) , rounding );
window - > DrawList - > AddRect ( p_min + ImVec2 ( 1 , 1 ) , p_max + ImVec2 ( 1 , 1 ) , GetColorU32 ( ImGuiCol_BorderShadow ) , rounding , ~ 0 , border_size );
window - > DrawList - > AddRect ( p_min , p_max , GetColorU32 ( ImGuiCol_Border ) , rounding );
window - > DrawList - > AddRect ( p_min , p_max , GetColorU32 ( ImGuiCol_Border ) , rounding , ~ 0 , border_size );
}
}
}
}
@ -3665,14 +3673,12 @@ static inline void ClearSetNextWindowData()
bool ImGui : : BeginPopupEx ( ImGuiID id , ImGuiWindowFlags extra_flags )
bool ImGui : : BeginPopupEx ( ImGuiID id , ImGuiWindowFlags extra_flags )
{
{
ImGuiContext & g = * GImGui ;
ImGuiContext & g = * GImGui ;
ImGuiWindow * window = g . CurrentWindow ;
if ( ! IsPopupOpen ( id ) )
if ( ! IsPopupOpen ( id ) )
{
{
ClearSetNextWindowData ( ) ; // We behave like Begin() and need to consume those values
ClearSetNextWindowData ( ) ; // We behave like Begin() and need to consume those values
return false ;
return false ;
}
}
PushStyleVar ( ImGuiStyleVar_WindowRounding , 0.0f ) ;
ImGuiWindowFlags flags = extra_flags | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings ;
ImGuiWindowFlags flags = extra_flags | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings ;
char name [ 20 ] ;
char name [ 20 ] ;
@ -3682,9 +3688,7 @@ bool ImGui::BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags)
ImFormatString ( name , IM_ARRAYSIZE ( name ) , " ##popup_%08x " , id ) ; // Not recycling, so we can close/open during the same frame
ImFormatString ( name , IM_ARRAYSIZE ( name ) , " ##popup_%08x " , id ) ; // Not recycling, so we can close/open during the same frame
bool is_open = Begin ( name , NULL , flags ) ;
bool is_open = Begin ( name , NULL , flags ) ;
if ( ! ( window - > Flags & ImGuiWindowFlags_ShowBorders ) )
if ( ! is_open ) // NB: Begin can return false when the popup is completely clipped (e.g. zero size display)
g . CurrentWindow - > Flags & = ~ ImGuiWindowFlags_ShowBorders ;
if ( ! is_open ) // NB: is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
EndPopup ( ) ;
EndPopup ( ) ;
return is_open ;
return is_open ;
@ -3698,7 +3702,7 @@ bool ImGui::BeginPopup(const char* str_id)
ClearSetNextWindowData ( ) ; // We behave like Begin() and need to consume those values
ClearSetNextWindowData ( ) ; // We behave like Begin() and need to consume those values
return false ;
return false ;
}
}
return BeginPopupEx ( g . CurrentWindow - > GetID ( str_id ) , ImGuiWindowFlags_ ShowBorders | ImGuiWindowFlags_ AlwaysAutoResize) ;
return BeginPopupEx ( g . CurrentWindow - > GetID ( str_id ) , ImGuiWindowFlags_ AlwaysAutoResize) ;
}
}
bool ImGui : : IsPopupOpen ( ImGuiID id )
bool ImGui : : IsPopupOpen ( ImGuiID id )
@ -3747,8 +3751,6 @@ void ImGui::EndPopup()
IM_ASSERT ( window - > Flags & ImGuiWindowFlags_Popup ) ; // Mismatched BeginPopup()/EndPopup() calls
IM_ASSERT ( window - > Flags & ImGuiWindowFlags_Popup ) ; // Mismatched BeginPopup()/EndPopup() calls
IM_ASSERT ( GImGui - > CurrentPopupStack . Size > 0 ) ;
IM_ASSERT ( GImGui - > CurrentPopupStack . Size > 0 ) ;
End ( ) ;
End ( ) ;
if ( ! ( window - > Flags & ImGuiWindowFlags_Modal ) )
PopStyleVar ( ) ;
}
}
bool ImGui : : OpenPopupOnItemClick ( const char * str_id , int mouse_button )
bool ImGui : : OpenPopupOnItemClick ( const char * str_id , int mouse_button )
@ -3774,7 +3776,7 @@ bool ImGui::BeginPopupContextItem(const char* str_id, int mouse_button)
IM_ASSERT ( id ! = 0 ) ; // However, you cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)
IM_ASSERT ( id ! = 0 ) ; // However, you cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)
if ( IsMouseClicked ( mouse_button ) & & IsItemHovered ( ImGuiHoveredFlags_AllowWhenBlockedByPopup ) )
if ( IsMouseClicked ( mouse_button ) & & IsItemHovered ( ImGuiHoveredFlags_AllowWhenBlockedByPopup ) )
OpenPopupEx ( id , true ) ;
OpenPopupEx ( id , true ) ;
return BeginPopupEx ( id , ImGuiWindowFlags_ ShowBorders | ImGuiWindowFlags_ AlwaysAutoResize) ;
return BeginPopupEx ( id , ImGuiWindowFlags_ AlwaysAutoResize) ;
}
}
bool ImGui : : BeginPopupContextWindow ( const char * str_id , int mouse_button , bool also_over_items )
bool ImGui : : BeginPopupContextWindow ( const char * str_id , int mouse_button , bool also_over_items )
@ -3786,7 +3788,7 @@ bool ImGui::BeginPopupContextWindow(const char* str_id, int mouse_button, bool a
if ( IsWindowHovered ( ImGuiHoveredFlags_AllowWhenBlockedByPopup ) )
if ( IsWindowHovered ( ImGuiHoveredFlags_AllowWhenBlockedByPopup ) )
if ( also_over_items | | ! IsAnyItemHovered ( ) )
if ( also_over_items | | ! IsAnyItemHovered ( ) )
OpenPopupEx ( id , true ) ;
OpenPopupEx ( id , true ) ;
return BeginPopupEx ( id , ImGuiWindowFlags_ ShowBorders | ImGuiWindowFlags_ AlwaysAutoResize) ;
return BeginPopupEx ( id , ImGuiWindowFlags_ AlwaysAutoResize) ;
}
}
bool ImGui : : BeginPopupContextVoid ( const char * str_id , int mouse_button )
bool ImGui : : BeginPopupContextVoid ( const char * str_id , int mouse_button )
@ -3796,11 +3798,12 @@ bool ImGui::BeginPopupContextVoid(const char* str_id, int mouse_button)
ImGuiID id = GImGui - > CurrentWindow - > GetID ( str_id ) ;
ImGuiID id = GImGui - > CurrentWindow - > GetID ( str_id ) ;
if ( ! IsAnyWindowHovered ( ) & & IsMouseClicked ( mouse_button ) )
if ( ! IsAnyWindowHovered ( ) & & IsMouseClicked ( mouse_button ) )
OpenPopupEx ( id , true ) ;
OpenPopupEx ( id , true ) ;
return BeginPopupEx ( id , ImGuiWindowFlags_ ShowBorders | ImGuiWindowFlags_ AlwaysAutoResize) ;
return BeginPopupEx ( id , ImGuiWindowFlags_ AlwaysAutoResize) ;
}
}
static bool BeginChildEx ( const char * name , ImGuiID id , const ImVec2 & size_arg , bool border , ImGuiWindowFlags extra_flags )
static bool BeginChildEx ( const char * name , ImGuiID id , const ImVec2 & size_arg , bool border , ImGuiWindowFlags extra_flags )
{
{
ImGuiContext & g = * GImGui ;
ImGuiWindow * parent_window = ImGui : : GetCurrentWindow ( ) ;
ImGuiWindow * parent_window = ImGui : : GetCurrentWindow ( ) ;
ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_ChildWindow ;
ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_ChildWindow ;
flags | = ( parent_window - > Flags & ImGuiWindowFlags_NoMove ) ; // Inherit the NoMove flag
flags | = ( parent_window - > Flags & ImGuiWindowFlags_NoMove ) ; // Inherit the NoMove flag
@ -3812,8 +3815,10 @@ static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
size . x = ImMax ( content_avail . x , 4.0f ) - fabsf ( size . x ) ; // Arbitrary minimum zero-ish child size of 4.0f (0.0f causing too much issues)
size . x = ImMax ( content_avail . x , 4.0f ) - fabsf ( size . x ) ; // Arbitrary minimum zero-ish child size of 4.0f (0.0f causing too much issues)
if ( size . y < = 0.0f )
if ( size . y < = 0.0f )
size . y = ImMax ( content_avail . y , 4.0f ) - fabsf ( size . y ) ;
size . y = ImMax ( content_avail . y , 4.0f ) - fabsf ( size . y ) ;
if ( border )
flags | = ImGuiWindowFlags_ShowBorders ;
const float backup_border_size = g . Style . ChildBorderSize ;
if ( ! border )
g . Style . ChildBorderSize = 0.0f ;
flags | = extra_flags ;
flags | = extra_flags ;
char title [ 256 ] ;
char title [ 256 ] ;
@ -3826,8 +3831,7 @@ static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
bool ret = ImGui : : Begin ( title , NULL , flags ) ;
bool ret = ImGui : : Begin ( title , NULL , flags ) ;
ImGuiWindow * child_window = ImGui : : GetCurrentWindow ( ) ;
ImGuiWindow * child_window = ImGui : : GetCurrentWindow ( ) ;
child_window - > AutoFitChildAxises = auto_fit_axises ;
child_window - > AutoFitChildAxises = auto_fit_axises ;
if ( ! ( parent_window - > Flags & ImGuiWindowFlags_ShowBorders ) )
g . Style . ChildBorderSize = backup_border_size ;
child_window - > Flags & = ~ ImGuiWindowFlags_ShowBorders ;
return ret ;
return ret ;
}
}
@ -3876,14 +3880,15 @@ bool ImGui::BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags ext
const ImGuiStyle & style = g . Style ;
const ImGuiStyle & style = g . Style ;
PushStyleColor ( ImGuiCol_ChildBg , style . Colors [ ImGuiCol_FrameBg ] ) ;
PushStyleColor ( ImGuiCol_ChildBg , style . Colors [ ImGuiCol_FrameBg ] ) ;
PushStyleVar ( ImGuiStyleVar_ChildRounding , style . FrameRounding ) ;
PushStyleVar ( ImGuiStyleVar_ChildRounding , style . FrameRounding ) ;
PushStyleVar ( ImGuiStyleVar_ChildBorderSize , style . FrameBorderSize ) ;
PushStyleVar ( ImGuiStyleVar_WindowPadding , style . FramePadding ) ;
PushStyleVar ( ImGuiStyleVar_WindowPadding , style . FramePadding ) ;
return BeginChild ( id , size , ( g . CurrentWindow - > Flags & ImGuiWindowFlags_ShowBorders ) ? tru e : fals e, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding | extra_flags ) ;
return BeginChild ( id , size , tru e, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding | extra_flags ) ;
}
}
void ImGui : : EndChildFrame ( )
void ImGui : : EndChildFrame ( )
{
{
EndChild ( ) ;
EndChild ( ) ;
PopStyleVar ( 2 ) ;
PopStyleVar ( 3 ) ;
PopStyleColor ( ) ;
PopStyleColor ( ) ;
}
}
@ -4265,13 +4270,15 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
}
}
}
}
// Lock window padding so that altering the ShowBorders flag for children doesn't have side-effects.
// Lock window padding so that altering the border sizes for children doesn't have side-effects.
window - > WindowPadding = style . WindowPadding ;
window - > WindowPadding = style . WindowPadding ;
if ( ( flags & ImGuiWindowFlags_ChildWindow ) & & ! ( flags & ( ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_ ShowBorders | ImGuiWindowFlags_ComboBox | ImGuiWindowFlags_Popup ) ) )
if ( ( flags & ImGuiWindowFlags_ChildWindow ) & & ! ( flags & ( ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_ ComboBox | ImGuiWindowFlags_Popup ) ) & & style . WindowBorderSize = = 0.0f )
window - > WindowPadding = ImVec2 ( 0.0f , ( flags & ImGuiWindowFlags_MenuBar ) ? style . WindowPadding . y : 0.0f ) ;
window - > WindowPadding = ImVec2 ( 0.0f , ( flags & ImGuiWindowFlags_MenuBar ) ? style . WindowPadding . y : 0.0f ) ;
window - > WindowBorderSize = ( flags & ImGuiWindowFlags_ShowBorders ) ? 1.0f : 0.0f ;
window - > WindowRounding = ( flags & ImGuiWindowFlags_ChildWindow ) ? style . ChildRounding : ( ( flags & ImGuiWindowFlags_Popup ) & & ! ( flags & ImGuiWindowFlags_Modal ) ) ? style . PopupRounding : style . WindowRounding ;
window - > WindowRounding = ( flags & ImGuiWindowFlags_ChildWindow ) ? style . ChildRounding : ( ( flags & ImGuiWindowFlags_Popup ) & & ! ( flags & ImGuiWindowFlags_Modal ) ) ? style . PopupRounding : style . WindowRounding ;
window - > WindowBorderSize = ( flags & ImGuiWindowFlags_ChildWindow ) ? style . ChildBorderSize : ( ( flags & ImGuiWindowFlags_Popup ) & & ! ( flags & ImGuiWindowFlags_Modal ) ) ? style . PopupBorderSize : style . WindowBorderSize ;
const ImVec2 window_padding = window - > WindowPadding ;
const float window_rounding = window - > WindowRounding ;
const float window_rounding = window - > WindowRounding ;
const float window_border_size = window - > WindowBorderSize ;
// Calculate auto-fit size, handle automatic resize
// Calculate auto-fit size, handle automatic resize
const ImVec2 size_auto_fit = CalcSizeAutoFit ( window ) ;
const ImVec2 size_auto_fit = CalcSizeAutoFit ( window ) ;
@ -4405,7 +4412,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
if ( window - > Collapsed )
if ( window - > Collapsed )
{
{
// Title bar only
// Title bar only
float backup_border_size = style . FrameBorderSize ;
g . Style . FrameBorderSize = window - > WindowBorderSize ;
RenderFrame ( title_bar_rect . Min , title_bar_rect . Max , GetColorU32 ( ImGuiCol_TitleBgCollapsed ) , true , window_rounding ) ;
RenderFrame ( title_bar_rect . Min , title_bar_rect . Max , GetColorU32 ( ImGuiCol_TitleBgCollapsed ) , true , window_rounding ) ;
g . Style . FrameBorderSize = backup_border_size ;
}
}
else
else
{
{
@ -4459,9 +4469,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
if ( flags & ImGuiWindowFlags_MenuBar )
if ( flags & ImGuiWindowFlags_MenuBar )
{
{
ImRect menu_bar_rect = window - > MenuBarRect ( ) ;
ImRect menu_bar_rect = window - > MenuBarRect ( ) ;
if ( flags & ImGuiWindowFlags_ShowBorders )
window - > DrawList - > AddLine ( menu_bar_rect . GetBL ( ) , menu_bar_rect . GetBR ( ) , GetColorU32 ( ImGuiCol_Border ) ) ;
window - > DrawList - > AddRectFilled ( menu_bar_rect . GetTL ( ) , menu_bar_rect . GetBR ( ) , GetColorU32 ( ImGuiCol_MenuBarBg ) , ( flags & ImGuiWindowFlags_NoTitleBar ) ? window_rounding : 0.0f , ImGuiCorner_TopLeft | ImGuiCorner_TopRight ) ;
window - > DrawList - > AddRectFilled ( menu_bar_rect . GetTL ( ) , menu_bar_rect . GetBR ( ) , GetColorU32 ( ImGuiCol_MenuBarBg ) , ( flags & ImGuiWindowFlags_NoTitleBar ) ? window_rounding : 0.0f , ImGuiCorner_TopLeft | ImGuiCorner_TopRight ) ;
if ( style . FrameBorderSize > 0.0f )
window - > DrawList - > AddLine ( menu_bar_rect . GetBL ( ) , menu_bar_rect . GetBR ( ) , GetColorU32 ( ImGuiCol_Border ) , style . FrameBorderSize ) ;
}
}
// Scrollbars
// Scrollbars
@ -4475,20 +4485,17 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
if ( ! ( flags & ImGuiWindowFlags_NoResize ) )
if ( ! ( flags & ImGuiWindowFlags_NoResize ) )
{
{
const ImVec2 br = window - > Rect ( ) . GetBR ( ) ;
const ImVec2 br = window - > Rect ( ) . GetBR ( ) ;
window - > DrawList - > PathLineTo ( br + ImVec2 ( - resize_corner_size , - window - > WindowBorderS ize) ) ;
window - > DrawList - > PathLineTo ( br + ImVec2 ( - resize_corner_size , - window _border_s ize) ) ;
window - > DrawList - > PathLineTo ( br + ImVec2 ( - window - > WindowBorderS ize, - resize_corner_size ) ) ;
window - > DrawList - > PathLineTo ( br + ImVec2 ( - window _border_s ize, - resize_corner_size ) ) ;
window - > DrawList - > PathArcToFast ( ImVec2 ( br . x - window_rounding - window - > WindowBorderS ize, br . y - window_rounding - window - > WindowBorderS ize) , window_rounding , 0 , 3 ) ;
window - > DrawList - > PathArcToFast ( ImVec2 ( br . x - window_rounding - window _border_s ize, br . y - window_rounding - window _border_s ize) , window_rounding , 0 , 3 ) ;
window - > DrawList - > PathFillConvex ( resize_col ) ;
window - > DrawList - > PathFillConvex ( resize_col ) ;
}
}
// Borders
// Borders
if ( flags & ImGuiWindowFlags_ShowBorders )
if ( window_border_size > 0.0f )
{
window - > DrawList - > AddRect ( window - > Pos , window - > Pos + window - > Size , GetColorU32 ( ImGuiCol_Border ) , window_rounding , ~ 0 , window_border_size ) ;
window - > DrawList - > AddRect ( window - > Pos + ImVec2 ( 1 , 1 ) , window - > Pos + window - > Size + ImVec2 ( 1 , 1 ) , GetColorU32 ( ImGuiCol_BorderShadow ) , window_rounding ) ;
if ( style . FrameBorderSize > 0 & & ! ( flags & ImGuiWindowFlags_NoTitleBar ) )
window - > DrawList - > AddRect ( window - > Pos , window - > Pos + window - > Size , GetColorU32 ( ImGuiCol_Border ) , window_rounding ) ;
window - > DrawList - > AddLine ( title_bar_rect . GetBL ( ) + ImVec2 ( 1 , - 1 ) , title_bar_rect . GetBR ( ) + ImVec2 ( - 1 , - 1 ) , GetColorU32 ( ImGuiCol_Border ) , style . FrameBorderSize ) ;
if ( ! ( flags & ImGuiWindowFlags_NoTitleBar ) )
window - > DrawList - > AddLine ( title_bar_rect . GetBL ( ) + ImVec2 ( 1 , 0 ) , title_bar_rect . GetBR ( ) - ImVec2 ( 1 , 0 ) , GetColorU32 ( ImGuiCol_Border ) ) ;
}
}
}
// Update ContentsRegionMax. All the variable it depends on are set above in this function.
// Update ContentsRegionMax. All the variable it depends on are set above in this function.
@ -5042,11 +5049,15 @@ static const ImGuiStyleVarInfo GStyleVarInfo[ImGuiStyleVar_Count_] =
{ ImGuiDataType_Float , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , Alpha ) } , // ImGuiStyleVar_Alpha
{ ImGuiDataType_Float , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , Alpha ) } , // ImGuiStyleVar_Alpha
{ ImGuiDataType_Float2 , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , WindowPadding ) } , // ImGuiStyleVar_WindowPadding
{ ImGuiDataType_Float2 , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , WindowPadding ) } , // ImGuiStyleVar_WindowPadding
{ ImGuiDataType_Float , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , WindowRounding ) } , // ImGuiStyleVar_WindowRounding
{ ImGuiDataType_Float , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , WindowRounding ) } , // ImGuiStyleVar_WindowRounding
{ ImGuiDataType_Float , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , WindowBorderSize ) } , // ImGuiStyleVar_WindowBorderSize
{ ImGuiDataType_Float2 , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , WindowMinSize ) } , // ImGuiStyleVar_WindowMinSize
{ ImGuiDataType_Float2 , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , WindowMinSize ) } , // ImGuiStyleVar_WindowMinSize
{ ImGuiDataType_Float , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , ChildRounding ) } , // ImGuiStyleVar_ChildRounding
{ ImGuiDataType_Float , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , ChildRounding ) } , // ImGuiStyleVar_ChildRounding
{ ImGuiDataType_Float , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , ChildBorderSize ) } , // ImGuiStyleVar_ChildBorderSize
{ ImGuiDataType_Float , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , PopupRounding ) } , // ImGuiStyleVar_PopupRounding
{ ImGuiDataType_Float , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , PopupRounding ) } , // ImGuiStyleVar_PopupRounding
{ ImGuiDataType_Float , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , PopupBorderSize ) } , // ImGuiStyleVar_PopupBorderSize
{ ImGuiDataType_Float2 , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , FramePadding ) } , // ImGuiStyleVar_FramePadding
{ ImGuiDataType_Float2 , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , FramePadding ) } , // ImGuiStyleVar_FramePadding
{ ImGuiDataType_Float , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , FrameRounding ) } , // ImGuiStyleVar_FrameRounding
{ ImGuiDataType_Float , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , FrameRounding ) } , // ImGuiStyleVar_FrameRounding
{ ImGuiDataType_Float , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , FrameBorderSize ) } , // ImGuiStyleVar_FrameBorderSize
{ ImGuiDataType_Float2 , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , ItemSpacing ) } , // ImGuiStyleVar_ItemSpacing
{ ImGuiDataType_Float2 , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , ItemSpacing ) } , // ImGuiStyleVar_ItemSpacing
{ ImGuiDataType_Float2 , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , ItemInnerSpacing ) } , // ImGuiStyleVar_ItemInnerSpacing
{ ImGuiDataType_Float2 , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , ItemInnerSpacing ) } , // ImGuiStyleVar_ItemInnerSpacing
{ ImGuiDataType_Float , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , IndentSpacing ) } , // ImGuiStyleVar_IndentSpacing
{ ImGuiDataType_Float , ( ImU32 ) IM_OFFSETOF ( ImGuiStyle , IndentSpacing ) } , // ImGuiStyleVar_IndentSpacing
@ -7619,7 +7630,7 @@ void ImGui::ProgressBar(float fraction, const ImVec2& size_arg, const char* over
// Render
// Render
fraction = ImSaturate ( fraction ) ;
fraction = ImSaturate ( fraction ) ;
RenderFrame ( bb . Min , bb . Max , GetColorU32 ( ImGuiCol_FrameBg ) , true , style . FrameRounding ) ;
RenderFrame ( bb . Min , bb . Max , GetColorU32 ( ImGuiCol_FrameBg ) , true , style . FrameRounding ) ;
bb . Expand ( ImVec2 ( - window- > WindowBorderSize , - window - > Window BorderSize) ) ;
bb . Expand ( ImVec2 ( - style. FrameBorderSize , - style . Frame BorderSize) ) ;
const ImVec2 fill_br = ImVec2 ( ImLerp ( bb . Min . x , bb . Max . x , fraction ) , bb . Max . y ) ;
const ImVec2 fill_br = ImVec2 ( ImLerp ( bb . Min . x , bb . Max . x , fraction ) , bb . Max . y ) ;
RenderRectFilledRangeH ( window - > DrawList , bb , GetColorU32 ( ImGuiCol_PlotHistogram ) , 0.0f , fraction , style . FrameRounding ) ;
RenderRectFilledRangeH ( window - > DrawList , bb , GetColorU32 ( ImGuiCol_PlotHistogram ) , 0.0f , fraction , style . FrameRounding ) ;
@ -7742,10 +7753,10 @@ bool ImGui::RadioButton(const char* label, bool active)
window - > DrawList - > AddCircleFilled ( center , radius - pad , GetColorU32 ( ImGuiCol_CheckMark ) , 16 ) ;
window - > DrawList - > AddCircleFilled ( center , radius - pad , GetColorU32 ( ImGuiCol_CheckMark ) , 16 ) ;
}
}
if ( window- > Flags & ImGuiWindowFlags_ShowBorders )
if ( style. FrameBorderSize > 0.0f )
{
{
window - > DrawList - > AddCircle ( center + ImVec2 ( 1 , 1 ) , radius , GetColorU32 ( ImGuiCol_BorderShadow ) , 16 );
window - > DrawList - > AddCircle ( center + ImVec2 ( 1 , 1 ) , radius , GetColorU32 ( ImGuiCol_BorderShadow ) , 16 , style . FrameBorderSize );
window - > DrawList - > AddCircle ( center , radius , GetColorU32 ( ImGuiCol_Border ) , 16 );
window - > DrawList - > AddCircle ( center , radius , GetColorU32 ( ImGuiCol_Border ) , 16 , style . FrameBorderSize );
}
}
if ( g . LogEnabled )
if ( g . LogEnabled )
@ -8884,18 +8895,17 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImVec2 popu
// Position our combo ABOVE because there's more space to fit! (FIXME: Handle in Begin() or use a shared helper. We have similar code in Begin() for popup placement)
// Position our combo ABOVE because there's more space to fit! (FIXME: Handle in Begin() or use a shared helper. We have similar code in Begin() for popup placement)
popup_y1 = ImClamp ( frame_bb . Min . y - popup_size . y , style . DisplaySafeAreaPadding . y , frame_bb . Min . y ) ;
popup_y1 = ImClamp ( frame_bb . Min . y - popup_size . y , style . DisplaySafeAreaPadding . y , frame_bb . Min . y ) ;
popup_y2 = frame_bb . Min . y ;
popup_y2 = frame_bb . Min . y ;
SetNextWindowPos ( ImVec2 ( frame_bb . Min . x , frame_bb . Min . y + window- > Window BorderSize) , ImGuiCond_Always , ImVec2 ( 0.0f , 1.0f ) ) ;
SetNextWindowPos ( ImVec2 ( frame_bb . Min . x , frame_bb . Min . y + style. Frame BorderSize) , ImGuiCond_Always , ImVec2 ( 0.0f , 1.0f ) ) ;
}
}
else
else
{
{
// Position our combo below
// Position our combo below
SetNextWindowPos ( ImVec2 ( frame_bb . Min . x , frame_bb . Max . y - window- > Window BorderSize) , ImGuiCond_Always , ImVec2 ( 0.0f , 0.0f ) ) ;
SetNextWindowPos ( ImVec2 ( frame_bb . Min . x , frame_bb . Max . y - style. Frame BorderSize) , ImGuiCond_Always , ImVec2 ( 0.0f , 0.0f ) ) ;
}
}
SetNextWindowSize ( ImVec2 ( popup_size . x , popup_y2 - popup_y1 ) , ImGuiCond_Appearing ) ;
SetNextWindowSize ( ImVec2 ( popup_size . x , popup_y2 - popup_y1 ) , ImGuiCond_Appearing ) ;
PushStyleVar ( ImGuiStyleVar_WindowPadding , style . FramePadding ) ;
PushStyleVar ( ImGuiStyleVar_WindowPadding , style . FramePadding ) ;
const ImGuiWindowFlags flags = ImGuiWindowFlags_ComboBox | ( ( window - > Flags & ImGuiWindowFlags_ShowBorders ) ? ImGuiWindowFlags_ShowBorders : 0 ) ;
if ( ! BeginPopupEx ( id , ImGuiWindowFlags_ComboBox ) )
if ( ! BeginPopupEx ( id , flags ) )
{
{
IM_ASSERT ( 0 ) ; // This should never happen as we tested for IsPopupOpen() above
IM_ASSERT ( 0 ) ; // This should never happen as we tested for IsPopupOpen() above
return false ;
return false ;
@ -9361,7 +9371,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
if ( menu_is_open )
if ( menu_is_open )
{
{
SetNextWindowPos ( popup_pos , ImGuiCond_Always ) ;
SetNextWindowPos ( popup_pos , ImGuiCond_Always ) ;
ImGuiWindowFlags flags = ImGuiWindowFlags_ ShowBorders | ImGuiWindowFlags_ AlwaysAutoResize | ( ( window - > Flags & ( ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu ) ) ? ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_ChildWindow : ImGuiWindowFlags_ChildMenu ) ;
ImGuiWindowFlags flags = ImGuiWindowFlags_ AlwaysAutoResize | ( ( window - > Flags & ( ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu ) ) ? ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_ChildWindow : ImGuiWindowFlags_ChildMenu ) ;
menu_is_open = BeginPopupEx ( id , flags ) ; // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
menu_is_open = BeginPopupEx ( id , flags ) ; // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
}
}
@ -9506,7 +9516,7 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl
else
else
window - > DrawList - > AddRectFilled ( bb_inner . Min , bb_inner . Max , GetColorU32 ( col_source ) , rounding , ~ 0 ) ;
window - > DrawList - > AddRectFilled ( bb_inner . Min , bb_inner . Max , GetColorU32 ( col_source ) , rounding , ~ 0 ) ;
}
}
if ( window- > Flags & ImGuiWindowFlags_ShowBorders )
if ( g. Style . FrameBorderSize > 0.0f )
RenderFrameBorder ( bb . Min , bb . Max , rounding ) ;
RenderFrameBorder ( bb . Min , bb . Max , rounding ) ;
else
else
window - > DrawList - > AddRect ( bb . Min , bb . Max , GetColorU32 ( ImGuiCol_FrameBg ) , rounding ) ; // Color button are often in need of some sort of border
window - > DrawList - > AddRect ( bb . Min , bb . Max , GetColorU32 ( ImGuiCol_FrameBg ) , rounding ) ; // Color button are often in need of some sort of border