Docking context update function, called by NewFrame()
| 17960 | |
| 17961 | // Docking context update function, called by NewFrame() |
| 17962 | void ImGui::DockContextNewFrameUpdateDocking(ImGuiContext* ctx) |
| 17963 | { |
| 17964 | ImGuiContext& g = *ctx; |
| 17965 | ImGuiDockContext* dc = &ctx->DockContext; |
| 17966 | if (!(g.IO.ConfigFlags & ImGuiConfigFlags_DockingEnable)) |
| 17967 | return; |
| 17968 | |
| 17969 | // [DEBUG] Store hovered dock node. |
| 17970 | // We could in theory use DockNodeTreeFindVisibleNodeByPos() on the root host dock node, but using ->DockNode is a good shortcut. |
| 17971 | // Note this is mostly a debug thing and isn't actually used for docking target, because docking involve more detailed filtering. |
| 17972 | g.DebugHoveredDockNode = NULL; |
| 17973 | if (ImGuiWindow* hovered_window = g.HoveredWindowUnderMovingWindow) |
| 17974 | { |
| 17975 | if (hovered_window->DockNodeAsHost) |
| 17976 | g.DebugHoveredDockNode = DockNodeTreeFindVisibleNodeByPos(hovered_window->DockNodeAsHost, g.IO.MousePos); |
| 17977 | else if (hovered_window->RootWindow->DockNode) |
| 17978 | g.DebugHoveredDockNode = hovered_window->RootWindow->DockNode; |
| 17979 | } |
| 17980 | |
| 17981 | // Process Docking requests |
| 17982 | for (ImGuiDockRequest& req : dc->Requests) |
| 17983 | if (req.Type == ImGuiDockRequestType_Dock) |
| 17984 | DockContextProcessDock(ctx, &req); |
| 17985 | dc->Requests.resize(0); |
| 17986 | |
| 17987 | // Create windows for each automatic docking nodes |
| 17988 | // We can have NULL pointers when we delete nodes, but because ID are recycled this should amortize nicely (and our node count will never be very high) |
| 17989 | for (int n = 0; n < dc->Nodes.Data.Size; n++) |
| 17990 | if (ImGuiDockNode* node = (ImGuiDockNode*)dc->Nodes.Data[n].val_p) |
| 17991 | if (node->IsFloatingNode()) |
| 17992 | DockNodeUpdate(node); |
| 17993 | } |
| 17994 | |
| 17995 | void ImGui::DockContextEndFrame(ImGuiContext* ctx) |
| 17996 | { |