Docking, Style: added style.DockingNodeHasCloseButton option to hide the CloseButton() attached to each docking node. (#8933)

This commit is contained in:
ocornut
2025-09-15 14:06:54 +02:00
parent a4cd45f44c
commit 09e7870497
4 changed files with 7 additions and 1 deletions

View File

@@ -123,6 +123,8 @@ Docking+Viewports Branch:
- DPI: Fixed obsoleted ImGuiConfigFlags_DpiEnableScaleFonts/_DpiEnableScaleViewports - DPI: Fixed obsoleted ImGuiConfigFlags_DpiEnableScaleFonts/_DpiEnableScaleViewports
names from setting the equivalent io.ConfigDpiScaleFonts/io.ConfigDpiScaleViewports names from setting the equivalent io.ConfigDpiScaleFonts/io.ConfigDpiScaleViewports
flag correctly (regression in 1.92). 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. - Backends: GLFW: improve multi-viewport behavior in tiling WMs on X11.
Note: using GLFW backend on Linux/BSD etc. requires linking with `-lX11`. Note: using GLFW backend on Linux/BSD etc. requires linking with `-lX11`.
(#8884, #8474, #8289, #2117) [@Ikos3k, @Madman10K] (#8884, #8474, #8289, #2117) [@Ikos3k, @Madman10K]

View File

@@ -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. 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. 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. 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 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. 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. 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; node->HasCloseButton |= window->HasCloseButton;
window->DockIsActive = (node->Windows.Size > 1); window->DockIsActive = (node->Windows.Size > 1);
} }
if (node_flags & ImGuiDockNodeFlags_NoCloseButton) if ((node_flags & ImGuiDockNodeFlags_NoCloseButton) || !g.Style.DockingNodeHasCloseButton)
node->HasCloseButton = false; node->HasCloseButton = false;
// Bind or create host window // Bind or create host window

View File

@@ -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 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 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). 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 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. 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). 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).

View File

@@ -8517,6 +8517,8 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
SliderFloat("ImageBorderSize", &style.ImageBorderSize, 0.0f, 1.0f, "%.0f"); SliderFloat("ImageBorderSize", &style.ImageBorderSize, 0.0f, 1.0f, "%.0f");
SeparatorText("Docking"); SeparatorText("Docking");
//SetCursorPosX(GetCursorPosX() + CalcItemWidth() - GetFrameHeight());
Checkbox("DockingNodeHasCloseButton", &style.DockingNodeHasCloseButton);
SliderFloat("DockingSeparatorSize", &style.DockingSeparatorSize, 0.0f, 12.0f, "%.0f"); SliderFloat("DockingSeparatorSize", &style.DockingSeparatorSize, 0.0f, 12.0f, "%.0f");
SeparatorText("Tooltips"); SeparatorText("Tooltips");