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
This commit is contained in:
Matija Kecman
2026-01-19 04:48:21 -08:00
committed by Copybara-Service
parent d173ee5bee
commit 654b393060
+13
View File
@@ -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);