From 654b39306008620e60299ed6496b067de6f3caa1 Mon Sep 17 00:00:00 2001 From: Matija Kecman Date: Mon, 19 Jan 2026 04:48:21 -0800 Subject: [PATCH] Add a boxing utility which can surround a bunch of UI and render it in a box. The ImGui table API cell padding variables can be used to adjust the positioning of the UI in the box. PiperOrigin-RevId: 858137824 Change-Id: I1ce1519c0abd67bc5fafc30f9a18dfcf18c2a313 --- src/experimental/platform/imgui_widgets.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/experimental/platform/imgui_widgets.h b/src/experimental/platform/imgui_widgets.h index 40b8c47e..478bbfc2 100644 --- a/src/experimental/platform/imgui_widgets.h +++ b/src/experimental/platform/imgui_widgets.h @@ -265,6 +265,19 @@ inline bool ImGui_IsChordJustPressed(ImGuiKeyChord chord) { return ImGui::IsKeyChordPressed(chord, 0); } +// Begin a boxed section with outer borders - use EndBoxSection to close. +inline bool BeginBoxSection(const char* id, ImGuiTableFlags extra_flags = 0) { + ImGuiTableFlags flags = ImGuiTableFlags_BordersOuter | extra_flags; + if (ImGui::BeginTable(id, 1, flags)) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + return true; + } + return false; +} + +inline void EndBoxSection() { ImGui::EndTable(); } + // Saves the given contents to the clipboard if the clipboard is available. void MaybeSaveToClipboard(const std::string& contents);