MCPcopy Create free account
hub / github.com/Wemino/MarkerPatch / EndChild

Method EndChild

include/imgui/imgui.cpp:6569–6618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6567}
6568
6569void ImGui::EndChild()
6570{
6571 ImGuiContext& g = *GImGui;
6572 ImGuiWindow* child_window = g.CurrentWindow;
6573
6574 const ImGuiID backup_within_end_child_id = g.WithinEndChildID;
6575 IM_ASSERT(child_window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() calls
6576
6577 g.WithinEndChildID = child_window->ID;
6578 ImVec2 child_size = child_window->Size;
6579 End();
6580 if (child_window->BeginCount == 1)
6581 {
6582 ImGuiWindow* parent_window = g.CurrentWindow;
6583 ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + child_size);
6584 ItemSize(child_size);
6585 const bool nav_flattened = (child_window->ChildFlags & ImGuiChildFlags_NavFlattened) != 0;
6586 if ((child_window->DC.NavLayersActiveMask != 0 || child_window->DC.NavWindowHasScrollY) && !nav_flattened)
6587 {
6588 ItemAdd(bb, child_window->ChildId);
6589 RenderNavCursor(bb, child_window->ChildId);
6590
6591 // When browsing a window that has no activable items (scroll only) we keep a highlight on the child (pass g.NavId to trick into always displaying)
6592 if (child_window->DC.NavLayersActiveMask == 0 && child_window == g.NavWindow)
6593 RenderNavCursor(ImRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2)), g.NavId, ImGuiNavRenderCursorFlags_Compact);
6594 }
6595 else
6596 {
6597 // Not navigable into
6598 // - This is a bit of a fringe use case, mostly useful for undecorated, non-scrolling contents childs, or empty childs.
6599 // - We could later decide to not apply this path if ImGuiChildFlags_FrameStyle or ImGuiChildFlags_Borders is set.
6600 ItemAdd(bb, child_window->ChildId, NULL, ImGuiItemFlags_NoNav);
6601
6602 // But when flattened we directly reach items, adjust active layer mask accordingly
6603 if (nav_flattened)
6604 parent_window->DC.NavLayersActiveMaskNext |= child_window->DC.NavLayersActiveMaskNext;
6605 }
6606 if (g.HoveredWindow == child_window)
6607 g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredWindow;
6608 child_window->DC.ChildItemStatusFlags = g.LastItemData.StatusFlags;
6609 //SetLastItemDataForChildWindowItem(child_window, child_window->Rect()); // Not needed, effectively done by ItemAdd()
6610 }
6611 else
6612 {
6613 SetLastItemDataForChildWindowItem(child_window, child_window->Rect());
6614 }
6615
6616 g.WithinEndChildID = backup_within_end_child_id;
6617 g.LogLinePosY = -FLT_MAX; // To enforce a carriage return
6618}
6619
6620ImGuiWindow* ImGui::FindFrontMostVisibleChildWindow(ImGuiWindow* window)
6621{

Callers

nothing calls this directly

Calls 3

ItemSizeFunction · 0.85
ImVec2Function · 0.85
ImRectFunction · 0.70

Tested by

no test coverage detected