mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-22 15:46:35 +00:00
Docking: Separating SharedFlags vs LocalFlags in dock node so settings can be applied to individual nodes. Made _NoResize logic on single node applies as expected. (#2423, #2109)
This commit is contained in:
parent
75e3793f4d
commit
fd5859ed04
63
imgui.cpp
63
imgui.cpp
@ -11097,7 +11097,7 @@ static void ImGui::DockContextBuildNodesFromSettings(ImGuiContext* ctx, ImGuiDoc
|
|||||||
node->SelectedTabID = settings->SelectedTabID;
|
node->SelectedTabID = settings->SelectedTabID;
|
||||||
node->SplitAxis = settings->SplitAxis;
|
node->SplitAxis = settings->SplitAxis;
|
||||||
if (settings->IsDockSpace)
|
if (settings->IsDockSpace)
|
||||||
node->Flags |= ImGuiDockNodeFlags_DockSpace;
|
node->LocalFlags |= ImGuiDockNodeFlags_DockSpace;
|
||||||
node->IsCentralNode = settings->IsCentralNode != 0;
|
node->IsCentralNode = settings->IsCentralNode != 0;
|
||||||
node->IsHiddenTabBar = settings->IsHiddenTabBar != 0;
|
node->IsHiddenTabBar = settings->IsHiddenTabBar != 0;
|
||||||
|
|
||||||
@ -11343,7 +11343,7 @@ void ImGui::DockContextProcessUndockNode(ImGuiContext* ctx, ImGuiDockNode* node)
|
|||||||
ImGuiDockNode::ImGuiDockNode(ImGuiID id)
|
ImGuiDockNode::ImGuiDockNode(ImGuiID id)
|
||||||
{
|
{
|
||||||
ID = id;
|
ID = id;
|
||||||
Flags = ImGuiDockNodeFlags_None;
|
SharedFlags = LocalFlags = ImGuiDockNodeFlags_None;
|
||||||
ParentNode = ChildNodes[0] = ChildNodes[1] = NULL;
|
ParentNode = ChildNodes[0] = ChildNodes[1] = NULL;
|
||||||
TabBar = NULL;
|
TabBar = NULL;
|
||||||
SplitAxis = ImGuiAxis_None;
|
SplitAxis = ImGuiAxis_None;
|
||||||
@ -11613,9 +11613,8 @@ static void ImGui::DockNodeUpdateVisibleFlagAndInactiveChilds(ImGuiDockNode* nod
|
|||||||
IM_ASSERT(node->ParentNode == NULL || node->ParentNode->ChildNodes[0] == node || node->ParentNode->ChildNodes[1] == node);
|
IM_ASSERT(node->ParentNode == NULL || node->ParentNode->ChildNodes[0] == node || node->ParentNode->ChildNodes[1] == node);
|
||||||
|
|
||||||
// Inherit most flags
|
// Inherit most flags
|
||||||
ImGuiDockNodeFlags flags_to_inherit = ~ImGuiDockNodeFlags_DockSpace;
|
|
||||||
if (node->ParentNode)
|
if (node->ParentNode)
|
||||||
node->Flags = node->ParentNode->Flags & flags_to_inherit;
|
node->SharedFlags = node->ParentNode->SharedFlags & ImGuiDockNodeFlags_SharedFlagsInheritMask_;
|
||||||
|
|
||||||
// Recurse into children
|
// Recurse into children
|
||||||
// There is the possibility that one of our child becoming empty will delete itself and moving its sibling contents into 'node'.
|
// There is the possibility that one of our child becoming empty will delete itself and moving its sibling contents into 'node'.
|
||||||
@ -11651,7 +11650,8 @@ static void ImGui::DockNodeUpdateVisibleFlagAndInactiveChilds(ImGuiDockNode* nod
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Auto-hide tab bar option
|
// Auto-hide tab bar option
|
||||||
if (node->WantHiddenTabBarUpdate && node->Windows.Size == 1 && (node->Flags & ImGuiDockNodeFlags_AutoHideTabBar) && !node->IsHiddenTabBar)
|
ImGuiDockNodeFlags node_flags = node->GetMergedFlags();
|
||||||
|
if (node->WantHiddenTabBarUpdate && node->Windows.Size == 1 && (node_flags & ImGuiDockNodeFlags_AutoHideTabBar) && !node->IsHiddenTabBar)
|
||||||
node->WantHiddenTabBarToggle = true;
|
node->WantHiddenTabBarToggle = true;
|
||||||
node->WantHiddenTabBarUpdate = false;
|
node->WantHiddenTabBarUpdate = false;
|
||||||
|
|
||||||
@ -11856,7 +11856,8 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node)
|
|||||||
|
|
||||||
// We need to draw a background at the root level if requested by ImGuiDockNodeFlags_PassthruCentralNode, but we will only know the correct pos/size after
|
// We need to draw a background at the root level if requested by ImGuiDockNodeFlags_PassthruCentralNode, but we will only know the correct pos/size after
|
||||||
// processing the resizing splitters. So we are using the DrawList channel splitting facility to submit drawing primitives out of order!
|
// processing the resizing splitters. So we are using the DrawList channel splitting facility to submit drawing primitives out of order!
|
||||||
const bool render_dockspace_bg = node->IsRootNode() && host_window && (node->Flags & ImGuiDockNodeFlags_PassthruCentralNode) != 0;
|
const ImGuiDockNodeFlags node_flags = node->GetMergedFlags();
|
||||||
|
const bool render_dockspace_bg = node->IsRootNode() && host_window && (node_flags & ImGuiDockNodeFlags_PassthruCentralNode) != 0;
|
||||||
if (render_dockspace_bg)
|
if (render_dockspace_bg)
|
||||||
{
|
{
|
||||||
host_window->DrawList->ChannelsSplit(2);
|
host_window->DrawList->ChannelsSplit(2);
|
||||||
@ -11865,7 +11866,7 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node)
|
|||||||
|
|
||||||
// Register a hit-test hole in the window unless we are currently dragging a window that is compatible with our dockspace
|
// Register a hit-test hole in the window unless we are currently dragging a window that is compatible with our dockspace
|
||||||
const ImGuiDockNode* central_node = node->CentralNode;
|
const ImGuiDockNode* central_node = node->CentralNode;
|
||||||
const bool central_node_hole = node->IsRootNode() && host_window && (node->Flags & ImGuiDockNodeFlags_PassthruCentralNode) != 0 && central_node != NULL && central_node->IsEmpty();
|
const bool central_node_hole = node->IsRootNode() && host_window && (node_flags & ImGuiDockNodeFlags_PassthruCentralNode) != 0 && central_node != NULL && central_node->IsEmpty();
|
||||||
bool central_node_hole_register_hit_test_hole = central_node_hole;
|
bool central_node_hole_register_hit_test_hole = central_node_hole;
|
||||||
if (central_node_hole)
|
if (central_node_hole)
|
||||||
if (const ImGuiPayload* payload = ImGui::GetDragDropPayload())
|
if (const ImGuiPayload* payload = ImGui::GetDragDropPayload())
|
||||||
@ -11892,7 +11893,7 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw empty node background (currently can only be the Central Node)
|
// Draw empty node background (currently can only be the Central Node)
|
||||||
if (host_window && node->IsEmpty() && node->IsVisible && !(node->Flags & ImGuiDockNodeFlags_PassthruCentralNode))
|
if (host_window && node->IsEmpty() && node->IsVisible && !(node_flags & ImGuiDockNodeFlags_PassthruCentralNode))
|
||||||
host_window->DrawList->AddRectFilled(node->Pos, node->Pos + node->Size, GetColorU32(ImGuiCol_DockingEmptyBg));
|
host_window->DrawList->AddRectFilled(node->Pos, node->Pos + node->Size, GetColorU32(ImGuiCol_DockingEmptyBg));
|
||||||
|
|
||||||
// Draw whole dockspace background if ImGuiDockNodeFlags_PassthruCentralNode if set.
|
// Draw whole dockspace background if ImGuiDockNodeFlags_PassthruCentralNode if set.
|
||||||
@ -12369,15 +12370,16 @@ static bool ImGui::DockNodePreviewDockCalc(ImGuiWindow* host_window, ImGuiDockNo
|
|||||||
data->FutureNode.Size = host_node ? ref_node_for_rect->Size : host_window->Size;
|
data->FutureNode.Size = host_node ? ref_node_for_rect->Size : host_window->Size;
|
||||||
|
|
||||||
// Figure out here we are allowed to dock
|
// Figure out here we are allowed to dock
|
||||||
|
ImGuiDockNodeFlags host_node_flags = host_node ? host_node->GetMergedFlags() : 0;
|
||||||
const bool src_is_visibly_splitted = root_payload->DockNodeAsHost && root_payload->DockNodeAsHost->IsSplitNode() && (root_payload->DockNodeAsHost->OnlyNodeWithWindows == NULL);
|
const bool src_is_visibly_splitted = root_payload->DockNodeAsHost && root_payload->DockNodeAsHost->IsSplitNode() && (root_payload->DockNodeAsHost->OnlyNodeWithWindows == NULL);
|
||||||
data->IsCenterAvailable = !is_outer_docking;
|
data->IsCenterAvailable = !is_outer_docking;
|
||||||
if (src_is_visibly_splitted && (!host_node || !host_node->IsEmpty()))
|
if (src_is_visibly_splitted && (!host_node || !host_node->IsEmpty()))
|
||||||
data->IsCenterAvailable = false;
|
data->IsCenterAvailable = false;
|
||||||
if (host_node && (host_node->Flags & ImGuiDockNodeFlags_NoDockingInCentralNode) && host_node->IsCentralNode)
|
if (host_node && (host_node_flags & ImGuiDockNodeFlags_NoDockingInCentralNode) && host_node->IsCentralNode)
|
||||||
data->IsCenterAvailable = false;
|
data->IsCenterAvailable = false;
|
||||||
|
|
||||||
data->IsSidesAvailable = true;
|
data->IsSidesAvailable = true;
|
||||||
if ((host_node && (host_node->Flags & ImGuiDockNodeFlags_NoSplit)) || g.IO.ConfigDockingNoSplit)
|
if ((host_node && (host_node_flags & ImGuiDockNodeFlags_NoSplit)) || g.IO.ConfigDockingNoSplit)
|
||||||
data->IsSidesAvailable = false;
|
data->IsSidesAvailable = false;
|
||||||
if (!is_outer_docking && host_node && host_node->ParentNode == NULL && host_node->IsCentralNode)
|
if (!is_outer_docking && host_node && host_node->ParentNode == NULL && host_node->IsCentralNode)
|
||||||
data->IsSidesAvailable = false;
|
data->IsSidesAvailable = false;
|
||||||
@ -12528,7 +12530,7 @@ static void ImGui::DockNodePreviewDockRender(ImGuiWindow* host_window, ImGuiDock
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Stop after ImGuiDir_None
|
// Stop after ImGuiDir_None
|
||||||
if ((host_node && (host_node->Flags & ImGuiDockNodeFlags_NoSplit)) || g.IO.ConfigDockingNoSplit)
|
if ((host_node && (host_node->GetMergedFlags() & ImGuiDockNodeFlags_NoSplit)) || g.IO.ConfigDockingNoSplit)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -12567,8 +12569,12 @@ void ImGui::DockNodeTreeSplit(ImGuiContext* ctx, ImGuiDockNode* parent_node, ImG
|
|||||||
DockNodeTreeUpdatePosSize(parent_node, parent_node->Pos, parent_node->Size);
|
DockNodeTreeUpdatePosSize(parent_node, parent_node->Pos, parent_node->Size);
|
||||||
|
|
||||||
// Flags transfer
|
// Flags transfer
|
||||||
|
child_0->SharedFlags = parent_node->SharedFlags & ImGuiDockNodeFlags_SharedFlagsInheritMask_;
|
||||||
|
child_1->SharedFlags = parent_node->SharedFlags & ImGuiDockNodeFlags_SharedFlagsInheritMask_;
|
||||||
|
child_inheritor->LocalFlags = parent_node->LocalFlags & ImGuiDockNodeFlags_LocalFlagsTransferMask_;
|
||||||
child_inheritor->IsCentralNode = parent_node->IsCentralNode;
|
child_inheritor->IsCentralNode = parent_node->IsCentralNode;
|
||||||
child_inheritor->IsHiddenTabBar = parent_node->IsHiddenTabBar;
|
child_inheritor->IsHiddenTabBar = parent_node->IsHiddenTabBar;
|
||||||
|
parent_node->LocalFlags &= ~ImGuiDockNodeFlags_LocalFlagsTransferMask_;
|
||||||
parent_node->IsCentralNode = false;
|
parent_node->IsCentralNode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12603,6 +12609,7 @@ void ImGui::DockNodeTreeMerge(ImGuiContext* ctx, ImGuiDockNode* parent_node, ImG
|
|||||||
parent_node->SizeRef = backup_last_explicit_size;
|
parent_node->SizeRef = backup_last_explicit_size;
|
||||||
|
|
||||||
// Flags transfer
|
// Flags transfer
|
||||||
|
parent_node->LocalFlags = ((child_0 ? child_0->LocalFlags : 0) | (child_1 ? child_1->LocalFlags : 0)) & ImGuiDockNodeFlags_LocalFlagsTransferMask_;
|
||||||
parent_node->IsCentralNode = (child_0 && child_0->IsCentralNode) || (child_1 && child_1->IsCentralNode);
|
parent_node->IsCentralNode = (child_0 && child_0->IsCentralNode) || (child_1 && child_1->IsCentralNode);
|
||||||
parent_node->IsHiddenTabBar = merge_lead_child->IsHiddenTabBar;
|
parent_node->IsHiddenTabBar = merge_lead_child->IsHiddenTabBar;
|
||||||
|
|
||||||
@ -12719,7 +12726,7 @@ void ImGui::DockNodeTreeUpdateSplitter(ImGuiDockNode* node)
|
|||||||
bb.Max[axis ^ 1] += child_1->Size[axis ^ 1];
|
bb.Max[axis ^ 1] += child_1->Size[axis ^ 1];
|
||||||
//if (g.IO.KeyCtrl) GetForegroundDrawList(g.CurrentWindow->Viewport)->AddRect(bb.Min, bb.Max, IM_COL32(255,0,255,255));
|
//if (g.IO.KeyCtrl) GetForegroundDrawList(g.CurrentWindow->Viewport)->AddRect(bb.Min, bb.Max, IM_COL32(255,0,255,255));
|
||||||
|
|
||||||
if (node->Flags & ImGuiDockNodeFlags_NoResize)
|
if ((child_0->GetMergedFlags() | child_1->GetMergedFlags()) & ImGuiDockNodeFlags_NoResize)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_Separator), g.Style.FrameRounding);
|
window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_Separator), g.Style.FrameRounding);
|
||||||
@ -12904,7 +12911,7 @@ void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags fla
|
|||||||
node = DockContextAddNode(ctx, id);
|
node = DockContextAddNode(ctx, id);
|
||||||
node->IsCentralNode = true;
|
node->IsCentralNode = true;
|
||||||
}
|
}
|
||||||
node->Flags = flags;
|
node->SharedFlags = flags;
|
||||||
node->WindowClass = window_class ? *window_class : ImGuiWindowClass();
|
node->WindowClass = window_class ? *window_class : ImGuiWindowClass();
|
||||||
|
|
||||||
// When a DockSpace transitioned form implicit to explicit this may be called a second time
|
// When a DockSpace transitioned form implicit to explicit this may be called a second time
|
||||||
@ -12912,10 +12919,10 @@ void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags fla
|
|||||||
if (node->LastFrameActive == g.FrameCount && !(flags & ImGuiDockNodeFlags_KeepAliveOnly))
|
if (node->LastFrameActive == g.FrameCount && !(flags & ImGuiDockNodeFlags_KeepAliveOnly))
|
||||||
{
|
{
|
||||||
IM_ASSERT(node->IsDockSpace() == false && "Cannot call DockSpace() twice a frame with the same ID");
|
IM_ASSERT(node->IsDockSpace() == false && "Cannot call DockSpace() twice a frame with the same ID");
|
||||||
node->Flags |= ImGuiDockNodeFlags_DockSpace;
|
node->LocalFlags |= ImGuiDockNodeFlags_DockSpace;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node->Flags |= ImGuiDockNodeFlags_DockSpace;
|
node->LocalFlags |= ImGuiDockNodeFlags_DockSpace;
|
||||||
|
|
||||||
// Keep alive mode, this is allow windows docked into this node so stay docked even if they are not visible
|
// Keep alive mode, this is allow windows docked into this node so stay docked even if they are not visible
|
||||||
if (flags & ImGuiDockNodeFlags_KeepAliveOnly)
|
if (flags & ImGuiDockNodeFlags_KeepAliveOnly)
|
||||||
@ -13061,7 +13068,7 @@ ImGuiID ImGui::DockBuilderAddNode(ImGuiID id, ImGuiDockNodeFlags flags)
|
|||||||
ImGuiDockNode* node = NULL;
|
ImGuiDockNode* node = NULL;
|
||||||
if (flags & ImGuiDockNodeFlags_DockSpace)
|
if (flags & ImGuiDockNodeFlags_DockSpace)
|
||||||
{
|
{
|
||||||
DockSpace(id, ImVec2(0, 0), flags | ImGuiDockNodeFlags_KeepAliveOnly);
|
DockSpace(id, ImVec2(0, 0), (flags & ~ImGuiDockNodeFlags_DockSpace) | ImGuiDockNodeFlags_KeepAliveOnly);
|
||||||
node = DockContextFindNodeByID(ctx, id);
|
node = DockContextFindNodeByID(ctx, id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -13070,7 +13077,7 @@ ImGuiID ImGui::DockBuilderAddNode(ImGuiID id, ImGuiDockNodeFlags flags)
|
|||||||
node = DockContextFindNodeByID(ctx, id);
|
node = DockContextFindNodeByID(ctx, id);
|
||||||
if (!node)
|
if (!node)
|
||||||
node = DockContextAddNode(ctx, id);
|
node = DockContextAddNode(ctx, id);
|
||||||
node->Flags = flags;
|
node->LocalFlags = flags;
|
||||||
}
|
}
|
||||||
node->LastFrameAlive = ctx->FrameCount; // Set this otherwise BeginDocked will undock during the same frame.
|
node->LastFrameAlive = ctx->FrameCount; // Set this otherwise BeginDocked will undock during the same frame.
|
||||||
return node->ID;
|
return node->ID;
|
||||||
@ -13097,7 +13104,7 @@ void ImGui::DockBuilderRemoveNodeChildNodes(ImGuiID root_id)
|
|||||||
ImGuiDockNode* root_node = root_id ? DockContextFindNodeByID(ctx, root_id) : NULL;
|
ImGuiDockNode* root_node = root_id ? DockContextFindNodeByID(ctx, root_id) : NULL;
|
||||||
if (root_id && root_node == NULL)
|
if (root_id && root_node == NULL)
|
||||||
return;
|
return;
|
||||||
bool has_document_root = false;
|
bool has_central_node = false;
|
||||||
|
|
||||||
ImGuiDataAutority backup_root_node_autority_for_pos = root_node ? root_node->AutorityForPos : ImGuiDataAutority_Auto;
|
ImGuiDataAutority backup_root_node_autority_for_pos = root_node ? root_node->AutorityForPos : ImGuiDataAutority_Auto;
|
||||||
ImGuiDataAutority backup_root_node_autority_for_size = root_node ? root_node->AutorityForSize : ImGuiDataAutority_Auto;
|
ImGuiDataAutority backup_root_node_autority_for_size = root_node ? root_node->AutorityForSize : ImGuiDataAutority_Auto;
|
||||||
@ -13111,7 +13118,7 @@ void ImGui::DockBuilderRemoveNodeChildNodes(ImGuiID root_id)
|
|||||||
if (want_removal)
|
if (want_removal)
|
||||||
{
|
{
|
||||||
if (node->IsCentralNode)
|
if (node->IsCentralNode)
|
||||||
has_document_root = true;
|
has_central_node = true;
|
||||||
if (root_id != 0)
|
if (root_id != 0)
|
||||||
DockContextQueueNotifyRemovedNode(ctx, node);
|
DockContextQueueNotifyRemovedNode(ctx, node);
|
||||||
if (root_node)
|
if (root_node)
|
||||||
@ -13149,7 +13156,7 @@ void ImGui::DockBuilderRemoveNodeChildNodes(ImGuiID root_id)
|
|||||||
dc->Nodes.Clear();
|
dc->Nodes.Clear();
|
||||||
dc->Requests.clear();
|
dc->Requests.clear();
|
||||||
}
|
}
|
||||||
else if (has_document_root)
|
else if (has_central_node)
|
||||||
{
|
{
|
||||||
root_node->IsCentralNode = true;
|
root_node->IsCentralNode = true;
|
||||||
}
|
}
|
||||||
@ -13227,7 +13234,8 @@ static ImGuiDockNode* DockBuilderCopyNodeRec(ImGuiDockNode* src_node, ImGuiID ds
|
|||||||
{
|
{
|
||||||
ImGuiContext* ctx = GImGui;
|
ImGuiContext* ctx = GImGui;
|
||||||
ImGuiDockNode* dst_node = ImGui::DockContextAddNode(ctx, dst_node_id_if_known);
|
ImGuiDockNode* dst_node = ImGui::DockContextAddNode(ctx, dst_node_id_if_known);
|
||||||
dst_node->Flags = src_node->Flags;
|
dst_node->SharedFlags = src_node->SharedFlags;
|
||||||
|
dst_node->LocalFlags = src_node->LocalFlags;
|
||||||
dst_node->Pos = src_node->Pos;
|
dst_node->Pos = src_node->Pos;
|
||||||
dst_node->Size = src_node->Size;
|
dst_node->Size = src_node->Size;
|
||||||
dst_node->SizeRef = src_node->SizeRef;
|
dst_node->SizeRef = src_node->SizeRef;
|
||||||
@ -13488,7 +13496,7 @@ void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open)
|
|||||||
g.NextWindowData.PosUndock = false; // Cancel implicit undocking of SetNextWindowPos()
|
g.NextWindowData.PosUndock = false; // Cancel implicit undocking of SetNextWindowPos()
|
||||||
window->DockIsActive = true;
|
window->DockIsActive = true;
|
||||||
window->DockTabIsVisible = false;
|
window->DockTabIsVisible = false;
|
||||||
if (node->Flags & ImGuiDockNodeFlags_KeepAliveOnly)
|
if (node->SharedFlags & ImGuiDockNodeFlags_KeepAliveOnly)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// When the window is selected we mark it as visible.
|
// When the window is selected we mark it as visible.
|
||||||
@ -14206,9 +14214,14 @@ void ImGui::ShowDockingDebug()
|
|||||||
ImGui::BulletText("VisibleWindow: 0x%08X %s", node->VisibleWindow ? node->VisibleWindow->ID : 0, node->VisibleWindow ? node->VisibleWindow->Name : "NULL");
|
ImGui::BulletText("VisibleWindow: 0x%08X %s", node->VisibleWindow ? node->VisibleWindow->ID : 0, node->VisibleWindow ? node->VisibleWindow->Name : "NULL");
|
||||||
ImGui::BulletText("SelectedTabID: 0x%08X", node->SelectedTabID);
|
ImGui::BulletText("SelectedTabID: 0x%08X", node->SelectedTabID);
|
||||||
ImGui::BulletText("LastFocusedNodeID: 0x%08X", node->LastFocusedNodeID);
|
ImGui::BulletText("LastFocusedNodeID: 0x%08X", node->LastFocusedNodeID);
|
||||||
ImGui::BulletText("Flags 0x%02X%s%s%s%s",
|
if (ImGui::TreeNode("flags", "SharedFlags 0x%03X NodeFlags 0x%03X%s%s%s%s",
|
||||||
node->Flags, node->IsDockSpace() ? ", IsDockSpace" : "", node->IsCentralNode ? ", IsCentralNode" : "",
|
node->SharedFlags, node->LocalFlags, node->IsDockSpace() ? ", IsDockSpace" : "", node->IsCentralNode ? ", IsCentralNode" : "",
|
||||||
(g.FrameCount - node->LastFrameAlive < 2) ? ", IsAlive" : "", (g.FrameCount - node->LastFrameActive < 2) ? ", IsActive" : "");
|
(g.FrameCount - node->LastFrameAlive < 2) ? ", IsAlive" : "", (g.FrameCount - node->LastFrameActive < 2) ? ", IsActive" : ""))
|
||||||
|
{
|
||||||
|
ImGui::CheckboxFlags("NodeFlags: NoSplit", (unsigned int*)&node->LocalFlags, ImGuiDockNodeFlags_NoSplit);
|
||||||
|
ImGui::CheckboxFlags("NodeFlags: NoResize", (unsigned int*)&node->LocalFlags, ImGuiDockNodeFlags_NoResize);
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
if (node->ChildNodes[0])
|
if (node->ChildNodes[0])
|
||||||
NodeDockNode(node->ChildNodes[0], "Child[0]");
|
NodeDockNode(node->ChildNodes[0], "Child[0]");
|
||||||
if (node->ChildNodes[1])
|
if (node->ChildNodes[1])
|
||||||
|
17
imgui.h
17
imgui.h
@ -878,17 +878,18 @@ enum ImGuiTabItemFlags_
|
|||||||
ImGuiTabItemFlags_NoPushId = 1 << 3 // Don't call PushID(tab->ID)/PopID() on BeginTabItem()/EndTabItem()
|
ImGuiTabItemFlags_NoPushId = 1 << 3 // Don't call PushID(tab->ID)/PopID() on BeginTabItem()/EndTabItem()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImGui::DockSpace(), inherited by child nodes.
|
// Flags for ImGui::DockSpace(), shared/inherited by child nodes.
|
||||||
|
// (Some flags can be applied to individual nodes directly)
|
||||||
enum ImGuiDockNodeFlags_
|
enum ImGuiDockNodeFlags_
|
||||||
{
|
{
|
||||||
ImGuiDockNodeFlags_None = 0,
|
ImGuiDockNodeFlags_None = 0,
|
||||||
ImGuiDockNodeFlags_KeepAliveOnly = 1 << 0, // Don't display the dockspace node but keep it alive. Windows docked into this dockspace node won't be undocked.
|
ImGuiDockNodeFlags_KeepAliveOnly = 1 << 0, // Shared // Don't display the dockspace node but keep it alive. Windows docked into this dockspace node won't be undocked.
|
||||||
//ImGuiDockNodeFlags_NoCentralNode = 1 << 1, // Disable Central Node (the node which can stay empty)
|
//ImGuiDockNodeFlags_NoCentralNode = 1 << 1, // Shared // Disable Central Node (the node which can stay empty)
|
||||||
ImGuiDockNodeFlags_NoDockingInCentralNode = 1 << 2, // Disable docking inside the Central Node, which will be always kept empty. Note: when turned off, existing docked nodes will be preserved.
|
ImGuiDockNodeFlags_NoDockingInCentralNode = 1 << 2, // Shared // Disable docking inside the Central Node, which will be always kept empty.
|
||||||
ImGuiDockNodeFlags_NoSplit = 1 << 3, // Disable splitting the node into smaller nodes. Useful e.g. when embedding dockspaces into a main root one (the root one may have splitting disabled to reduce confusion). Note: when turned off, existing splits will be preserved.
|
ImGuiDockNodeFlags_PassthruCentralNode = 1 << 3, // Shared // Enable passthru dockspace: 1) DockSpace() will render a ImGuiCol_WindowBg background covering everything excepted the Central Node when empty. Meaning the host window should probably use SetNextWindowBgAlpha(0.0f) prior to Begin() when using this. 2) When Central Node is empty: let inputs pass-through + won't display a DockingEmptyBg background. See demo for details.
|
||||||
ImGuiDockNodeFlags_NoResize = 1 << 4, // Disable resizing child nodes using the splitter/separators. Useful with programatically setup dockspaces.
|
ImGuiDockNodeFlags_NoSplit = 1 << 4, // Shared/Local // Disable splitting the node into smaller nodes. Useful e.g. when embedding dockspaces into a main root one (the root one may have splitting disabled to reduce confusion). Note: when turned off, existing splits will be preserved.
|
||||||
ImGuiDockNodeFlags_PassthruCentralNode = 1 << 5, // Enable passthru dockspace: 1) DockSpace() will render a ImGuiCol_WindowBg background covering everything excepted the Central Node when empty. Meaning the host window should probably use SetNextWindowBgAlpha(0.0f) prior to Begin() when using this. 2) When Central Node is empty: let inputs pass-through + won't display a DockingEmptyBg background. See demo for details.
|
ImGuiDockNodeFlags_NoResize = 1 << 5, // Shared/Local // Disable resizing child nodes using the splitter/separators. Useful with programatically setup dockspaces.
|
||||||
ImGuiDockNodeFlags_AutoHideTabBar = 1 << 6 // Tab bar will automatically hide when there is a single window in the dock node.
|
ImGuiDockNodeFlags_AutoHideTabBar = 1 << 6 // Shared/Local // Tab bar will automatically hide when there is a single window in the dock node.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImGui::IsWindowFocused()
|
// Flags for ImGui::IsWindowFocused()
|
||||||
|
@ -851,7 +851,9 @@ struct ImGuiTabBarRef
|
|||||||
|
|
||||||
enum ImGuiDockNodeFlagsPrivate_
|
enum ImGuiDockNodeFlagsPrivate_
|
||||||
{
|
{
|
||||||
ImGuiDockNodeFlags_DockSpace = 1 << 10
|
ImGuiDockNodeFlags_DockSpace = 1 << 10, // Local // A dockspace is a node that occupy space within an existing user window. Otherwise the node is floating and create its own window.
|
||||||
|
ImGuiDockNodeFlags_SharedFlagsInheritMask_ = ~0,
|
||||||
|
ImGuiDockNodeFlags_LocalFlagsTransferMask_ = ImGuiDockNodeFlags_NoResize | ImGuiDockNodeFlags_AutoHideTabBar // When splitting those flags are moved to the inheriting child, never duplicated
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiDataAutority_
|
enum ImGuiDataAutority_
|
||||||
@ -865,7 +867,8 @@ enum ImGuiDataAutority_
|
|||||||
struct ImGuiDockNode
|
struct ImGuiDockNode
|
||||||
{
|
{
|
||||||
ImGuiID ID;
|
ImGuiID ID;
|
||||||
ImGuiDockNodeFlags Flags;
|
ImGuiDockNodeFlags SharedFlags; // Flags shared by all nodes of a same dockspace hierarchy (inherited from the root node)
|
||||||
|
ImGuiDockNodeFlags LocalFlags; // Flags specific to this node
|
||||||
ImGuiDockNode* ParentNode;
|
ImGuiDockNode* ParentNode;
|
||||||
ImGuiDockNode* ChildNodes[2]; // [Split node only] Child nodes (left/right or top/bottom). Consider switching to an array.
|
ImGuiDockNode* ChildNodes[2]; // [Split node only] Child nodes (left/right or top/bottom). Consider switching to an array.
|
||||||
ImVector<ImGuiWindow*> Windows; // Note: unordered list! Iterate TabBar->Tabs for user-order.
|
ImVector<ImGuiWindow*> Windows; // Note: unordered list! Iterate TabBar->Tabs for user-order.
|
||||||
@ -904,10 +907,11 @@ struct ImGuiDockNode
|
|||||||
ImGuiDockNode(ImGuiID id);
|
ImGuiDockNode(ImGuiID id);
|
||||||
~ImGuiDockNode();
|
~ImGuiDockNode();
|
||||||
bool IsRootNode() const { return ParentNode == NULL; }
|
bool IsRootNode() const { return ParentNode == NULL; }
|
||||||
bool IsDockSpace() const { return (Flags & ImGuiDockNodeFlags_DockSpace) != 0; }
|
bool IsDockSpace() const { return (LocalFlags & ImGuiDockNodeFlags_DockSpace) != 0; }
|
||||||
bool IsSplitNode() const { return ChildNodes[0] != NULL; }
|
bool IsSplitNode() const { return ChildNodes[0] != NULL; }
|
||||||
bool IsLeafNode() const { return ChildNodes[0] == NULL; }
|
bool IsLeafNode() const { return ChildNodes[0] == NULL; }
|
||||||
bool IsEmpty() const { return ChildNodes[0] == NULL && Windows.Size == 0; }
|
bool IsEmpty() const { return ChildNodes[0] == NULL && Windows.Size == 0; }
|
||||||
|
ImGuiDockNodeFlags GetMergedFlags() const { return SharedFlags | LocalFlags; }
|
||||||
ImRect Rect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }
|
ImRect Rect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user