diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 4c8e2eee4..ede101942 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -123,6 +123,8 @@ Docking+Viewports Branch: - DPI: Fixed obsoleted ImGuiConfigFlags_DpiEnableScaleFonts/_DpiEnableScaleViewports names from setting the equivalent io.ConfigDpiScaleFonts/io.ConfigDpiScaleViewports flag correctly (regression in 1.92). +- Docking, Style: added style.DockingNodeHasCloseButton option to hide the + Close Button attached to each docking node. (#8933) - Backends: GLFW: improve multi-viewport behavior in tiling WMs on X11. Note: using GLFW backend on Linux/BSD etc. requires linking with `-lX11`. (#8884, #8474, #8289, #2117) [@Ikos3k, @Madman10K] diff --git a/imgui.cpp b/imgui.cpp index 9ed51bdb1..50b1f57ab 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1467,6 +1467,7 @@ ImGuiStyle::ImGuiStyle() SeparatorTextPadding = ImVec2(20.0f,3.f);// Horizontal offset of text from each edge of the separator + spacing on other axis. Generally small values. .y is recommended to be == FramePadding.y. DisplayWindowPadding = ImVec2(19,19); // Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows. DisplaySafeAreaPadding = ImVec2(3,3); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows. + DockingNodeHasCloseButton = true; // Docking nodes have their own CloseButton() to close all docked windows. DockingSeparatorSize = 2.0f; // Thickness of resizing border between docked windows MouseCursorScale = 1.0f; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later. AntiAliasedLines = true; // Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU. @@ -18647,7 +18648,7 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node) node->HasCloseButton |= window->HasCloseButton; window->DockIsActive = (node->Windows.Size > 1); } - if (node_flags & ImGuiDockNodeFlags_NoCloseButton) + if ((node_flags & ImGuiDockNodeFlags_NoCloseButton) || !g.Style.DockingNodeHasCloseButton) node->HasCloseButton = false; // Bind or create host window diff --git a/imgui.h b/imgui.h index a68df790b..d21488a33 100644 --- a/imgui.h +++ b/imgui.h @@ -2389,6 +2389,7 @@ struct ImGuiStyle ImVec2 SeparatorTextPadding; // Horizontal offset of text from each edge of the separator + spacing on other axis. Generally small values. .y is recommended to be == FramePadding.y. ImVec2 DisplayWindowPadding; // Apply to regular windows: amount which we enforce to keep visible when moving near edges of your screen. ImVec2 DisplaySafeAreaPadding; // Apply to every windows, menus, popups, tooltips: amount where we avoid displaying contents. Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured). + bool DockingNodeHasCloseButton; // Docking node has their own CloseButton() to close all docked windows. float DockingSeparatorSize; // Thickness of resizing border between docked windows float MouseCursorScale; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). We apply per-monitor DPI scaling over this scale. May be removed later. bool AntiAliasedLines; // Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList). diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 738faa783..e746ba6b9 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -8517,6 +8517,8 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) SliderFloat("ImageBorderSize", &style.ImageBorderSize, 0.0f, 1.0f, "%.0f"); SeparatorText("Docking"); + //SetCursorPosX(GetCursorPosX() + CalcItemWidth() - GetFrameHeight()); + Checkbox("DockingNodeHasCloseButton", &style.DockingNodeHasCloseButton); SliderFloat("DockingSeparatorSize", &style.DockingSeparatorSize, 0.0f, 12.0f, "%.0f"); SeparatorText("Tooltips");