Skip to content

Commit 09e7870

Browse files
committed
Docking, Style: added style.DockingNodeHasCloseButton option to hide the CloseButton() attached to each docking node. (ocornut#8933)
1 parent a4cd45f commit 09e7870

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

docs/CHANGELOG.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ Docking+Viewports Branch:
123123
- DPI: Fixed obsoleted ImGuiConfigFlags_DpiEnableScaleFonts/_DpiEnableScaleViewports
124124
names from setting the equivalent io.ConfigDpiScaleFonts/io.ConfigDpiScaleViewports
125125
flag correctly (regression in 1.92).
126+
- Docking, Style: added style.DockingNodeHasCloseButton option to hide the
127+
Close Button attached to each docking node. (#8933)
126128
- Backends: GLFW: improve multi-viewport behavior in tiling WMs on X11.
127129
Note: using GLFW backend on Linux/BSD etc. requires linking with `-lX11`.
128130
(#8884, #8474, #8289, #2117) [@Ikos3k, @Madman10K]

imgui.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,6 +1467,7 @@ ImGuiStyle::ImGuiStyle()
14671467
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.
14681468
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.
14691469
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.
1470+
DockingNodeHasCloseButton = true; // Docking nodes have their own CloseButton() to close all docked windows.
14701471
DockingSeparatorSize = 2.0f; // Thickness of resizing border between docked windows
14711472
MouseCursorScale = 1.0f; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later.
14721473
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)
1864718648
node->HasCloseButton |= window->HasCloseButton;
1864818649
window->DockIsActive = (node->Windows.Size > 1);
1864918650
}
18650-
if (node_flags & ImGuiDockNodeFlags_NoCloseButton)
18651+
if ((node_flags & ImGuiDockNodeFlags_NoCloseButton) || !g.Style.DockingNodeHasCloseButton)
1865118652
node->HasCloseButton = false;
1865218653

1865318654
// Bind or create host window

imgui.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2389,6 +2389,7 @@ struct ImGuiStyle
23892389
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.
23902390
ImVec2 DisplayWindowPadding; // Apply to regular windows: amount which we enforce to keep visible when moving near edges of your screen.
23912391
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).
2392+
bool DockingNodeHasCloseButton; // Docking node has their own CloseButton() to close all docked windows.
23922393
float DockingSeparatorSize; // Thickness of resizing border between docked windows
23932394
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.
23942395
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).

imgui_demo.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8517,6 +8517,8 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
85178517
SliderFloat("ImageBorderSize", &style.ImageBorderSize, 0.0f, 1.0f, "%.0f");
85188518

85198519
SeparatorText("Docking");
8520+
//SetCursorPosX(GetCursorPosX() + CalcItemWidth() - GetFrameHeight());
8521+
Checkbox("DockingNodeHasCloseButton", &style.DockingNodeHasCloseButton);
85208522
SliderFloat("DockingSeparatorSize", &style.DockingSeparatorSize, 0.0f, 12.0f, "%.0f");
85218523

85228524
SeparatorText("Tooltips");

0 commit comments

Comments
 (0)