From 834fa52c8ed2af4cf9c34dc9d88279d425632294 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 16 Nov 2017 17:34:34 +0100 Subject: [PATCH] Columns: Added ImGuiColumnsFlags_GrowParentContentsSize to internal API to restore old content sizes behavior. (#1444, #125) --- imgui.cpp | 3 ++- imgui_internal.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 832904baf..9c50555f7 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -10515,7 +10515,8 @@ void ImGui::EndColumns() window->DC.ColumnsCellMaxY = ImMax(window->DC.ColumnsCellMaxY, window->DC.CursorPos.y); window->DC.CursorPos.y = window->DC.ColumnsCellMaxY; - window->DC.CursorMaxPos.x = ImMax(window->DC.ColumnsStartMaxPosX, window->DC.ColumnsMaxX); // Columns don't grow parent + if (!(window->DC.ColumnsFlags & ImGuiColumnsFlags_GrowParentContentsSize)) + window->DC.CursorMaxPos.x = ImMax(window->DC.ColumnsStartMaxPosX, window->DC.ColumnsMaxX); // Restore cursor max pos, as columns don't grow parent // Draw columns borders and handle resize if (!(window->DC.ColumnsFlags & ImGuiColumnsFlags_NoBorder) && !window->SkipItems) diff --git a/imgui_internal.h b/imgui_internal.h index 6a081dfb6..c7600655e 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -194,7 +194,8 @@ enum ImGuiColumnsFlags_ ImGuiColumnsFlags_NoBorder = 1 << 0, // Disable column dividers ImGuiColumnsFlags_NoResize = 1 << 1, // Disable resizing columns when clicking on the dividers ImGuiColumnsFlags_NoPreserveWidths = 1 << 2, // Disable column width preservation when adjusting columns - ImGuiColumnsFlags_NoForceWithinWindow = 1 << 3 // Disable forcing columns to fit within window + ImGuiColumnsFlags_NoForceWithinWindow = 1 << 3, // Disable forcing columns to fit within window + ImGuiColumnsFlags_GrowParentContentsSize= 1 << 4, // (WIP) Restore pre-1.51 behavior of extending the parent window contents size but _without affecting the columns width at all_. Will eventually remove. }; enum ImGuiSelectableFlagsPrivate_