MCPcopy Create free account
hub / github.com/RenderKit/embree / EndChild

Method EndChild

tutorials/common/imgui/imgui.cpp:5551–5595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5549}
5550
5551void ImGui::EndChild()
5552{
5553 ImGuiContext& g = *GImGui;
5554 ImGuiWindow* window = g.CurrentWindow;
5555
5556 IM_ASSERT(g.WithinEndChild == false);
5557 IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() calls
5558
5559 g.WithinEndChild = true;
5560 if (window->BeginCount > 1)
5561 {
5562 End();
5563 }
5564 else
5565 {
5566 ImVec2 sz = window->Size;
5567 if (window->AutoFitChildAxises & (1 << ImGuiAxis_X)) // Arbitrary minimum zero-ish child size of 4.0f causes less trouble than a 0.0f
5568 sz.x = ImMax(4.0f, sz.x);
5569 if (window->AutoFitChildAxises & (1 << ImGuiAxis_Y))
5570 sz.y = ImMax(4.0f, sz.y);
5571 End();
5572
5573 ImGuiWindow* parent_window = g.CurrentWindow;
5574 ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz);
5575 ItemSize(sz);
5576 if ((window->DC.NavLayersActiveMask != 0 || window->DC.NavHasScroll) && !(window->Flags & ImGuiWindowFlags_NavFlattened))
5577 {
5578 ItemAdd(bb, window->ChildId);
5579 RenderNavHighlight(bb, window->ChildId);
5580
5581 // 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)
5582 if (window->DC.NavLayersActiveMask == 0 && window == g.NavWindow)
5583 RenderNavHighlight(ImRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2)), g.NavId, ImGuiNavHighlightFlags_TypeThin);
5584 }
5585 else
5586 {
5587 // Not navigable into
5588 ItemAdd(bb, 0);
5589 }
5590 if (g.HoveredWindow == window)
5591 g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredWindow;
5592 }
5593 g.WithinEndChild = false;
5594 g.LogLinePosY = -FLT_MAX; // To enforce a carriage return
5595}
5596
5597// Helper to create a child window / scrolling region that looks like a normal widget frame.
5598bool ImGui::BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags extra_flags)

Callers

nothing calls this directly

Calls 4

ImMaxFunction · 0.85
ItemSizeFunction · 0.85
ImVec2Function · 0.85
ImRectFunction · 0.70

Tested by

no test coverage detected