MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / EndChild

Method EndChild

extern/imgui/imgui.cpp:5885–5929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5883}
5884
5885void ImGui::EndChild()
5886{
5887 ImGuiContext& g = *GImGui;
5888 ImGuiWindow* window = g.CurrentWindow;
5889
5890 IM_ASSERT(g.WithinEndChild == false);
5891 IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() calls
5892
5893 g.WithinEndChild = true;
5894 if (window->BeginCount > 1)
5895 {
5896 End();
5897 }
5898 else
5899 {
5900 ImVec2 sz = window->Size;
5901 if (window->AutoFitChildAxises & (1 << ImGuiAxis_X)) // Arbitrary minimum zero-ish child size of 4.0f causes less trouble than a 0.0f
5902 sz.x = ImMax(4.0f, sz.x);
5903 if (window->AutoFitChildAxises & (1 << ImGuiAxis_Y))
5904 sz.y = ImMax(4.0f, sz.y);
5905 End();
5906
5907 ImGuiWindow* parent_window = g.CurrentWindow;
5908 ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz);
5909 ItemSize(sz);
5910 if ((window->DC.NavLayersActiveMask != 0 || window->DC.NavHasScroll) && !(window->Flags & ImGuiWindowFlags_NavFlattened))
5911 {
5912 ItemAdd(bb, window->ChildId);
5913 RenderNavHighlight(bb, window->ChildId);
5914
5915 // 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)
5916 if (window->DC.NavLayersActiveMask == 0 && window == g.NavWindow)
5917 RenderNavHighlight(ImRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2)), g.NavId, ImGuiNavHighlightFlags_TypeThin);
5918 }
5919 else
5920 {
5921 // Not navigable into
5922 ItemAdd(bb, 0);
5923 }
5924 if (g.HoveredWindow == window)
5925 g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredWindow;
5926 }
5927 g.WithinEndChild = false;
5928 g.LogLinePosY = -FLT_MAX; // To enforce a carriage return
5929}
5930
5931// Helper to create a child window / scrolling region that looks like a normal widget frame.
5932bool 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