SetNextWindowContentSize() adjust for client->window size, but the fate of borders isn't really clear for now (until now we always tried to make borders not affect layout, so if we want a 200x200 fully visible space with borders and zero window padding user need to include the borders) (#1490)

This commit is contained in:
omar
2017-12-10 17:36:30 +01:00
parent 7ac1583411
commit eab6333a0b
3 changed files with 6 additions and 4 deletions

View File

@ -4388,7 +4388,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
}
if (g.SetNextWindowContentSizeCond)
{
// Adjust passed "client size" to become a "window size"
window->SizeContentsExplicit = g.SetNextWindowContentSizeVal;
window->SizeContentsExplicit.y += window->TitleBarHeight() + window->MenuBarHeight();
g.SetNextWindowContentSizeCond = 0;
}
else if (first_begin_of_the_frame)
@ -5660,7 +5662,7 @@ void ImGui::SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& s
void ImGui::SetNextWindowContentSize(const ImVec2& size)
{
ImGuiContext& g = *GImGui;
g.SetNextWindowContentSizeVal = size;
g.SetNextWindowContentSizeVal = size; // In Begin() we will add the size of window decorations (title bar, menu etc.) to that to form a SizeContents value.
g.SetNextWindowContentSizeCond = ImGuiCond_Always;
}