1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-15 03:27:45 +01:00

Docking: Internals: added ImGuiDockNodeFlags_NoUndocking. (#2999, #6823, #6780)

This commit is contained in:
ocornut 2023-09-15 20:15:13 +02:00
parent 14f8b76c1a
commit 1612813114
3 changed files with 7 additions and 4 deletions

View File

@ -4461,7 +4461,7 @@ void ImGui::StartMouseMovingWindowOrNode(ImGuiWindow* window, ImGuiDockNode* nod
{
ImGuiContext& g = *GImGui;
bool can_undock_node = false;
if (node != NULL && node->VisibleWindow && (node->VisibleWindow->Flags & ImGuiWindowFlags_NoMove) == 0)
if (node != NULL && node->VisibleWindow && (node->VisibleWindow->Flags & ImGuiWindowFlags_NoMove) == 0 && (node->MergedFlags & ImGuiDockNodeFlags_NoUndocking) == 0)
{
// Can undock if:
// - part of a floating node hierarchy with more than one visible node (if only one is visible, we'll just move the whole hierarchy)
@ -19893,6 +19893,7 @@ static void DebugNodeDockNodeFlags(ImGuiDockNodeFlags* p_flags, const char* labe
CheckboxFlags("NoDockingOverMe", p_flags, ImGuiDockNodeFlags_NoDockingOverMe);
CheckboxFlags("NoDockingOverOther", p_flags, ImGuiDockNodeFlags_NoDockingOverOther);
CheckboxFlags("NoDockingOverEmpty", p_flags, ImGuiDockNodeFlags_NoDockingOverEmpty);
CheckboxFlags("NoUndocking", p_flags, ImGuiDockNodeFlags_NoUndocking);
if (!enabled)
EndDisabled();
PopStyleVar();

View File

@ -1679,8 +1679,9 @@ enum ImGuiDockNodeFlagsPrivate_
ImGuiDockNodeFlags_NoDockingOverMe = 1 << 19, // // [EXPERIMENTAL] Prevent another window/node to be docked over this node.
ImGuiDockNodeFlags_NoDockingOverOther = 1 << 20, // // [EXPERIMENTAL] Prevent this node to be docked over another window or non-empty node.
ImGuiDockNodeFlags_NoDockingOverEmpty = 1 << 21, // // [EXPERIMENTAL] Prevent this node to be docked over an empty node (e.g. DockSpace with no other windows)
ImGuiDockNodeFlags_NoResizeX = 1 << 22, // // [EXPERIMENTAL]
ImGuiDockNodeFlags_NoResizeY = 1 << 23, // // [EXPERIMENTAL]
ImGuiDockNodeFlags_NoUndocking = 1 << 22, // // Disable undocking from this node.
ImGuiDockNodeFlags_NoResizeX = 1 << 23, // // [EXPERIMENTAL]
ImGuiDockNodeFlags_NoResizeY = 1 << 24, // // [EXPERIMENTAL]
ImGuiDockNodeFlags_SharedFlagsInheritMask_ = ~0,
ImGuiDockNodeFlags_NoResizeFlagsMask_ = ImGuiDockNodeFlags_NoResize | ImGuiDockNodeFlags_NoResizeX | ImGuiDockNodeFlags_NoResizeY,
// When splitting those flags are moved to the inheriting child, never duplicated

View File

@ -8639,7 +8639,8 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
}
// Extract a Dockable window out of it's tab bar
if (docked_window != NULL && !(docked_window->Flags & ImGuiWindowFlags_NoMove))
const bool can_undock = docked_window != NULL && !(docked_window->Flags & ImGuiWindowFlags_NoMove) && !(node->MergedFlags & ImGuiDockNodeFlags_NoUndocking);
if (can_undock)
{
// We use a variable threshold to distinguish dragging tabs within a tab bar and extracting them out of the tab bar
bool undocking_tab = (g.DragDropActive && g.DragDropPayload.SourceId == id);