@ -4600,7 +4600,7 @@ static void ImGui::EndFrameDrawDimmedBackgrounds()
bb . Expand ( - g . FontSize - 1.0f ) ;
bb . Expand ( - g . FontSize - 1.0f ) ;
rounding = window - > WindowRounding ;
rounding = window - > WindowRounding ;
}
}
draw_list - > AddRect ( bb . Min , bb . Max , GetColorU32 ( ImGuiCol_NavWindowingHighlight , g . NavWindowingHighlightAlpha ) , rounding , ~ 0 , 3.0f ) ;
draw_list - > AddRect ( bb . Min , bb . Max , GetColorU32 ( ImGuiCol_NavWindowingHighlight , g . NavWindowingHighlightAlpha ) , rounding , 0 , 3.0f ) ;
draw_list - > PopClipRect ( ) ;
draw_list - > PopClipRect ( ) ;
}
}
}
}
@ -5960,7 +5960,7 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar
}
}
// Render title text, collapse button, close button
// Render title text, collapse button, close button
// When inside a dock node, this is handled in DockNode UpdateTabBar () instead.
// When inside a dock node, this is handled in DockNode CalcTabBarLayout () instead.
void ImGui : : RenderWindowTitleBarContents ( ImGuiWindow * window , const ImRect & title_bar_rect , const char * name , bool * p_open )
void ImGui : : RenderWindowTitleBarContents ( ImGuiWindow * window , const ImRect & title_bar_rect , const char * name , bool * p_open )
{
{
ImGuiContext & g = * GImGui ;
ImGuiContext & g = * GImGui ;
@ -12361,7 +12361,7 @@ namespace ImGui
static bool DockNodeIsDropAllowed ( ImGuiWindow * host_window , ImGuiWindow * payload_window ) ;
static bool DockNodeIsDropAllowed ( ImGuiWindow * host_window , ImGuiWindow * payload_window ) ;
static void DockNodePreviewDockSetup ( ImGuiWindow * host_window , ImGuiDockNode * host_node , ImGuiWindow * payload_window , ImGuiDockPreviewData * preview_data , bool is_explicit_target , bool is_outer_docking ) ;
static void DockNodePreviewDockSetup ( ImGuiWindow * host_window , ImGuiDockNode * host_node , ImGuiWindow * payload_window , ImGuiDockPreviewData * preview_data , bool is_explicit_target , bool is_outer_docking ) ;
static void DockNodePreviewDockRender ( ImGuiWindow * host_window , ImGuiDockNode * host_node , ImGuiWindow * payload_window , const ImGuiDockPreviewData * preview_data ) ;
static void DockNodePreviewDockRender ( ImGuiWindow * host_window , ImGuiDockNode * host_node , ImGuiWindow * payload_window , const ImGuiDockPreviewData * preview_data ) ;
static void DockNodeCalcTabBarLayout ( const ImGuiDockNode * node , ImRect * out_title_rect , ImRect * out_tab_bar_rect , ImVec2 * out_window_menu_button_pos );
static void DockNodeCalcTabBarLayout ( const ImGuiDockNode * node , ImRect * out_title_rect , ImRect * out_tab_bar_rect , ImVec2 * out_window_menu_button_pos , ImVec2 * out_close_button_pos );
static void DockNodeCalcSplitRects ( ImVec2 & pos_old , ImVec2 & size_old , ImVec2 & pos_new , ImVec2 & size_new , ImGuiDir dir , ImVec2 size_new_desired ) ;
static void DockNodeCalcSplitRects ( ImVec2 & pos_old , ImVec2 & size_old , ImVec2 & pos_new , ImVec2 & size_new , ImGuiDir dir , ImVec2 size_new_desired ) ;
static bool DockNodeCalcDropRectsAndTestMousePos ( const ImRect & parent , ImGuiDir dir , ImRect & out_draw , bool outer_docking , ImVec2 * test_mouse_pos ) ;
static bool DockNodeCalcDropRectsAndTestMousePos ( const ImRect & parent , ImGuiDir dir , ImRect & out_draw , bool outer_docking , ImVec2 * test_mouse_pos ) ;
static const char * DockNodeGetHostWindowTitle ( ImGuiDockNode * node , char * buf , int buf_size ) { ImFormatString ( buf , buf_size , " ##DockNode_%02X " , node - > ID ) ; return buf ; }
static const char * DockNodeGetHostWindowTitle ( ImGuiDockNode * node , char * buf , int buf_size ) { ImFormatString ( buf , buf_size , " ##DockNode_%02X " , node - > ID ) ; return buf ; }
@ -13872,7 +13872,8 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
// Layout
// Layout
ImRect title_bar_rect , tab_bar_rect ;
ImRect title_bar_rect , tab_bar_rect ;
ImVec2 window_menu_button_pos ;
ImVec2 window_menu_button_pos ;
DockNodeCalcTabBarLayout ( node , & title_bar_rect , & tab_bar_rect , & window_menu_button_pos ) ;
ImVec2 close_button_pos ;
DockNodeCalcTabBarLayout ( node , & title_bar_rect , & tab_bar_rect , & window_menu_button_pos , & close_button_pos ) ;
// Submit new tabs, they will be added as Unsorted and sorted below based on relative DockOrder value.
// Submit new tabs, they will be added as Unsorted and sorted below based on relative DockOrder value.
const int tabs_count_old = tab_bar - > Tabs . Size ;
const int tabs_count_old = tab_bar - > Tabs . Size ;
@ -13996,8 +13997,7 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
PushItemFlag ( ImGuiItemFlags_Disabled , true ) ;
PushItemFlag ( ImGuiItemFlags_Disabled , true ) ;
PushStyleColor ( ImGuiCol_Text , style . Colors [ ImGuiCol_Text ] * ImVec4 ( 1.0f , 1.0f , 1.0f , 0.4f ) ) ;
PushStyleColor ( ImGuiCol_Text , style . Colors [ ImGuiCol_Text ] * ImVec4 ( 1.0f , 1.0f , 1.0f , 0.4f ) ) ;
}
}
const float button_sz = g . FontSize ;
if ( CloseButton ( host_window - > GetID ( " #CLOSE " ) , close_button_pos ) )
if ( CloseButton ( host_window - > GetID ( " #CLOSE " ) , title_bar_rect . GetTR ( ) + ImVec2 ( - style . FramePadding . x * 2.0f - button_sz , 0.0f ) ) )
if ( ImGuiTabItem * tab = TabBarFindTabByID ( tab_bar , tab_bar - > VisibleTabId ) )
if ( ImGuiTabItem * tab = TabBarFindTabByID ( tab_bar , tab_bar - > VisibleTabId ) )
{
{
node - > WantCloseTabId = tab - > ID ;
node - > WantCloseTabId = tab - > ID ;
@ -14115,27 +14115,35 @@ static bool ImGui::DockNodeIsDropAllowed(ImGuiWindow* host_window, ImGuiWindow*
}
}
// window menu button == collapse button when not in a dock node.
// window menu button == collapse button when not in a dock node.
// FIXME: This is similar to RenderWindowTitleBarContents , may want to share code.
// FIXME: This is similar to RenderWindowTitleBarContents () , may want to share code.
static void ImGui : : DockNodeCalcTabBarLayout ( const ImGuiDockNode * node , ImRect * out_title_rect , ImRect * out_tab_bar_rect , ImVec2 * out_window_menu_button_pos )
static void ImGui : : DockNodeCalcTabBarLayout ( const ImGuiDockNode * node , ImRect * out_title_rect , ImRect * out_tab_bar_rect , ImVec2 * out_window_menu_button_pos , ImVec2 * out_close_button_pos )
{
{
ImGuiContext & g = * GImGui ;
ImGuiContext & g = * GImGui ;
ImGuiStyle & style = g . Style ;
ImRect r = ImRect ( node - > Pos . x , node - > Pos . y , node - > Pos . x + node - > Size . x , node - > Pos . y + g . FontSize + g . Style . FramePadding . y * 2.0f ) ;
ImRect r = ImRect ( node - > Pos . x , node - > Pos . y , node - > Pos . x + node - > Size . x , node - > Pos . y + g . FontSize + g . Style . FramePadding . y * 2.0f ) ;
if ( out_title_rect ) { * out_title_rect = r ; }
if ( out_title_rect ) { * out_title_rect = r ; }
r . Min . x + = style . WindowBorderSize ;
r . Max . x - = style . WindowBorderSize ;
float button_sz = g . FontSize ;
ImVec2 window_menu_button_pos = r . Min ;
ImVec2 window_menu_button_pos = r . Min ;
r . Min . x + = g . Style . FramePadding . x ;
r . Min . x + = s tyle. FramePadding . x ;
r . Max . x - = g . Style . FramePadding . x ;
r . Max . x - = s tyle. FramePadding . x ;
if ( node - > HasCloseButton )
if ( node - > HasCloseButton )
{
{
r . Max . x - = g . FontSize ; // +1.0f; // In DockNodeUpdateTabBar() we currently display a disabled close button even if there is none.
r . Max . x - = button_sz ;
if ( out_close_button_pos ) * out_close_button_pos = ImVec2 ( r . Max . x - style . FramePadding . x , r . Min . y ) ;
}
}
if ( node - > HasWindowMenuButton & & g. S tyle. WindowMenuButtonPosition = = ImGuiDir_Left )
if ( node - > HasWindowMenuButton & & s tyle. WindowMenuButtonPosition = = ImGuiDir_Left )
{
{
r . Min . x + = g. FontSize ; // + g.Style.ItemInnerSpacing.x; // <-- Adding ItemInnerSpacing makes the title text moves slightly when in a docking tab bar. Instead we adjusted RenderArrowDockMenu()
r . Min . x + = button_sz + style . ItemInnerSpacing . x ;
}
}
else if ( node - > HasWindowMenuButton & & g. S tyle. WindowMenuButtonPosition = = ImGuiDir_Right )
else if ( node - > HasWindowMenuButton & & s tyle. WindowMenuButtonPosition = = ImGuiDir_Right )
{
{
r . Max . x - = g. FontSize + g . S tyle. FramePadding . x ;
r . Max . x - = button_sz + s tyle. FramePadding . x ;
window_menu_button_pos = ImVec2 ( r . Max . x , r . Min . y ) ;
window_menu_button_pos = ImVec2 ( r . Max . x , r . Min . y ) ;
}
}
if ( out_tab_bar_rect ) { * out_tab_bar_rect = r ; }
if ( out_tab_bar_rect ) { * out_tab_bar_rect = r ; }
@ -14352,7 +14360,7 @@ static void ImGui::DockNodePreviewDockRender(ImGuiWindow* host_window, ImGuiDock
{
{
// Compute target tab bar geometry so we can locate our preview tabs
// Compute target tab bar geometry so we can locate our preview tabs
ImRect tab_bar_rect ;
ImRect tab_bar_rect ;
DockNodeCalcTabBarLayout ( & data - > FutureNode , NULL , & tab_bar_rect , NULL );
DockNodeCalcTabBarLayout ( & data - > FutureNode , NULL , & tab_bar_rect , NULL , NULL );
ImVec2 tab_pos = tab_bar_rect . Min ;
ImVec2 tab_pos = tab_bar_rect . Min ;
if ( host_node & & host_node - > TabBar )
if ( host_node & & host_node - > TabBar )
{
{