MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / BeginChildEx

Method BeginChildEx

lib/imgui/imgui.cpp:4625–4674  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4623}
4624
4625bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags flags)
4626{
4627 ImGuiContext& g = *GImGui;
4628 ImGuiWindow* parent_window = g.CurrentWindow;
4629
4630 flags |= ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_ChildWindow;
4631 flags |= (parent_window->Flags & ImGuiWindowFlags_NoMove); // Inherit the NoMove flag
4632
4633 // Size
4634 const ImVec2 content_avail = GetContentRegionAvail();
4635 ImVec2 size = ImFloor(size_arg);
4636 const int auto_fit_axises = ((size.x == 0.0f) ? (1 << ImGuiAxis_X) : 0x00) | ((size.y == 0.0f) ? (1 << ImGuiAxis_Y) : 0x00);
4637 if (size.x <= 0.0f)
4638 size.x = ImMax(content_avail.x + size.x, 4.0f); // Arbitrary minimum child size (0.0f causing too much issues)
4639 if (size.y <= 0.0f)
4640 size.y = ImMax(content_avail.y + size.y, 4.0f);
4641 SetNextWindowSize(size);
4642
4643 // Build up name. If you need to append to a same child from multiple location in the ID stack, use BeginChild(ImGuiID id) with a stable value.
4644 char title[256];
4645 if (name)
4646 ImFormatString(title, IM_ARRAYSIZE(title), "%s/%s_%08X", parent_window->Name, name, id);
4647 else
4648 ImFormatString(title, IM_ARRAYSIZE(title), "%s/%08X", parent_window->Name, id);
4649
4650 const float backup_border_size = g.Style.ChildBorderSize;
4651 if (!border)
4652 g.Style.ChildBorderSize = 0.0f;
4653 bool ret = Begin(title, NULL, flags);
4654 g.Style.ChildBorderSize = backup_border_size;
4655
4656 ImGuiWindow* child_window = g.CurrentWindow;
4657 child_window->ChildId = id;
4658 child_window->AutoFitChildAxises = (ImS8)auto_fit_axises;
4659
4660 // Set the cursor to handle case where the user called SetNextWindowPos()+BeginChild() manually.
4661 // While this is not really documented/defined, it seems that the expected thing to do.
4662 if (child_window->BeginCount == 1)
4663 parent_window->DC.CursorPos = child_window->Pos;
4664
4665 // Process navigation-in immediately so NavInit can run on first frame
4666 if (g.NavActivateId == id && !(flags & ImGuiWindowFlags_NavFlattened) && (child_window->DC.NavLayerActiveMask != 0 || child_window->DC.NavHasScroll))
4667 {
4668 FocusWindow(child_window);
4669 NavInitWindow(child_window, false);
4670 SetActiveID(id+1, child_window); // Steal ActiveId with a dummy id so that key-press won't activate child item
4671 g.ActiveIdSource = ImGuiInputSource_Nav;
4672 }
4673 return ret;
4674}
4675
4676bool ImGui::BeginChild(const char* str_id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags)
4677{

Callers

nothing calls this directly

Calls 3

ImFloorFunction · 0.85
ImMaxFunction · 0.85
ImFormatStringFunction · 0.85

Tested by

no test coverage detected