@ -4339,9 +4339,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
IM_ASSERT ( g . Initialized ) ; // Forgot to call ImGui::NewFrame()
IM_ASSERT ( g . FrameCountEnded ! = g . FrameCount ) ; // Called ImGui::Render() or ImGui::EndFrame() and haven't called ImGui::NewFrame() again yet
if ( flags & ImGuiWindowFlags_NoInputs )
flags | = ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize ;
// Find or create
ImGuiWindow * window = FindWindowByName ( name ) ;
if ( ! window )
@ -4350,6 +4347,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window = CreateNewWindow ( name , size_on_first_use , flags ) ;
}
// Automatically disable manual moving/resizing when NoInputs is set
if ( flags & ImGuiWindowFlags_NoInputs )
flags | = ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize ;
//if (flags & ImGuiWindowFlags_NavFlattened)
// IM_ASSERT(flags & ImGuiWindowFlags_ChildWindow);
const int current_frame = g . FrameCount ;
const bool first_begin_of_the_frame = ( window - > LastFrameActive ! = current_frame ) ;
if ( first_begin_of_the_frame )
@ -4877,18 +4880,16 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
}
// Title text (FIXME: refactor text alignment facilities along with RenderText helpers)
const ImVec2 text_size = CalcTextSize ( name , NULL , true ) ;
ImVec2 text_min = window - > Pos ;
ImVec2 text_max = window - > Pos + ImVec2 ( window - > Size . x , style . FramePadding . y * 2 + text_size . y ) ;
ImRect clip_rect ;
clip_rect . Max = ImVec2 ( window - > Pos . x + window - > Size . x - ( p_open ? title_bar_rect . GetHeight ( ) - 3 : style . FramePadding . x ) , text_max . y ) ; // Match the size of CloseWindowButton()
ImVec2 text_size = CalcTextSize ( name , NULL , true ) ;
ImRect text_r = title_bar_rect ;
float pad_left = ( flags & ImGuiWindowFlags_NoCollapse ) = = 0 ? ( style . FramePadding . x + g . FontSize + style . ItemInnerSpacing . x ) : style . FramePadding . x ;
float pad_right = ( p_open ! = NULL ) ? ( style . FramePadding . x + g . FontSize + style . ItemInnerSpacing . x ) : style . FramePadding . x ;
if ( style . WindowTitleAlign . x > 0.0f ) pad_right = ImLerp ( pad_right , pad_left , style . WindowTitleAlign . x ) ;
text_min . x + = pad_left ;
text_max . x - = pad_right ;
clip_rect . Min = ImVec2 ( text_min . x , window - > Pos . y ) ;
RenderTextClipped ( text_min , text_max , name , NULL , & text_size , style . WindowTitleAlign , & clip_rect ) ;
text_r . Min . x + = pad_left ;
text_r . Max . x - = pad_right ;
ImRect clip_rect = text_r ;
clip_rect . Max . x = window - > Pos . x + window - > Size . x - ( p_open ? title_bar_rect . GetHeight ( ) - 3 : style . FramePadding . x ) ; // Match the size of CloseButton()
RenderTextClipped ( text_r . Min , text_r . Max , name , NULL , & text_size , style . WindowTitleAlign , & clip_rect ) ;
}
// Save clipped aabb so we can access it in constant-time in FindHoveredWindow()