host_node may be NULL if the window doesn't have a DockNode already. FIXME-DOCK: This is misnamed since it's also doing the filtering.
| 19882 | // host_node may be NULL if the window doesn't have a DockNode already. |
| 19883 | // FIXME-DOCK: This is misnamed since it's also doing the filtering. |
| 19884 | static void ImGui::DockNodePreviewDockSetup(ImGuiWindow* host_window, ImGuiDockNode* host_node, ImGuiWindow* payload_window, ImGuiDockNode* payload_node, ImGuiDockPreviewData* data, bool is_explicit_target, bool is_outer_docking) |
| 19885 | { |
| 19886 | ImGuiContext& g = *GImGui; |
| 19887 | |
| 19888 | // There is an edge case when docking into a dockspace which only has inactive nodes. |
| 19889 | // In this case DockNodeTreeFindNodeByPos() will have selected a leaf node which is inactive. |
| 19890 | // Because the inactive leaf node doesn't have proper pos/size yet, we'll use the root node as reference. |
| 19891 | if (payload_node == NULL) |
| 19892 | payload_node = payload_window->DockNodeAsHost; |
| 19893 | ImGuiDockNode* ref_node_for_rect = (host_node && !host_node->IsVisible) ? DockNodeGetRootNode(host_node) : host_node; |
| 19894 | if (ref_node_for_rect) |
| 19895 | IM_ASSERT(ref_node_for_rect->IsVisible == true); |
| 19896 | |
| 19897 | // Filter, figure out where we are allowed to dock |
| 19898 | ImGuiDockNodeFlags src_node_flags = payload_node ? payload_node->MergedFlags : payload_window->WindowClass.DockNodeFlagsOverrideSet; |
| 19899 | ImGuiDockNodeFlags dst_node_flags = host_node ? host_node->MergedFlags : host_window->WindowClass.DockNodeFlagsOverrideSet; |
| 19900 | data->IsCenterAvailable = true; |
| 19901 | if (is_outer_docking) |
| 19902 | data->IsCenterAvailable = false; |
| 19903 | else if (g.IO.ConfigDockingNoDockingOver) |
| 19904 | data->IsCenterAvailable = false; |
| 19905 | else if (dst_node_flags & ImGuiDockNodeFlags_NoDockingOverMe) |
| 19906 | data->IsCenterAvailable = false; |
| 19907 | else if (host_node && (dst_node_flags & ImGuiDockNodeFlags_NoDockingOverCentralNode) && host_node->IsCentralNode()) |
| 19908 | data->IsCenterAvailable = false; |
| 19909 | else if ((!host_node || !host_node->IsEmpty()) && payload_node && payload_node->IsSplitNode() && (payload_node->OnlyNodeWithWindows == NULL)) // Is _visibly_ split? |
| 19910 | data->IsCenterAvailable = false; |
| 19911 | else if ((src_node_flags & ImGuiDockNodeFlags_NoDockingOverOther) && (!host_node || !host_node->IsEmpty())) |
| 19912 | data->IsCenterAvailable = false; |
| 19913 | else if ((src_node_flags & ImGuiDockNodeFlags_NoDockingOverEmpty) && host_node && host_node->IsEmpty()) |
| 19914 | data->IsCenterAvailable = false; |
| 19915 | |
| 19916 | data->IsSidesAvailable = true; |
| 19917 | if ((dst_node_flags & ImGuiDockNodeFlags_NoDockingSplit) || g.IO.ConfigDockingNoSplit) |
| 19918 | data->IsSidesAvailable = false; |
| 19919 | else if (!is_outer_docking && host_node && host_node->ParentNode == NULL && host_node->IsCentralNode()) |
| 19920 | data->IsSidesAvailable = false; |
| 19921 | else if (src_node_flags & ImGuiDockNodeFlags_NoDockingSplitOther) |
| 19922 | data->IsSidesAvailable = false; |
| 19923 | |
| 19924 | // Build a tentative future node (reuse same structure because it is practical. Shape will be readjusted when previewing a split) |
| 19925 | data->FutureNode.HasCloseButton = (host_node ? host_node->HasCloseButton : host_window->HasCloseButton) || (payload_window->HasCloseButton); |
| 19926 | data->FutureNode.HasWindowMenuButton = host_node ? true : ((host_window->Flags & ImGuiWindowFlags_NoCollapse) == 0); |
| 19927 | data->FutureNode.Pos = ref_node_for_rect ? ref_node_for_rect->Pos : host_window->Pos; |
| 19928 | data->FutureNode.Size = ref_node_for_rect ? ref_node_for_rect->Size : host_window->Size; |
| 19929 | |
| 19930 | // Calculate drop shapes geometry for allowed splitting directions |
| 19931 | IM_ASSERT(ImGuiDir_None == -1); |
| 19932 | data->SplitNode = host_node; |
| 19933 | data->SplitDir = ImGuiDir_None; |
| 19934 | data->IsSplitDirExplicit = false; |
| 19935 | if (!host_window->Collapsed) |
| 19936 | for (int dir = ImGuiDir_None; dir < ImGuiDir_COUNT; dir++) |
| 19937 | { |
| 19938 | if (dir == ImGuiDir_None && !data->IsCenterAvailable) |
| 19939 | continue; |
| 19940 | if (dir != ImGuiDir_None && !data->IsSidesAvailable) |
| 19941 | continue; |
nothing calls this directly
no test coverage detected