| 4966 | } |
| 4967 | |
| 4968 | bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags flags) |
| 4969 | { |
| 4970 | ImGuiContext& g = *GImGui; |
| 4971 | ImGuiWindow* parent_window = g.CurrentWindow; |
| 4972 | |
| 4973 | flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_ChildWindow; |
| 4974 | flags |= (parent_window->Flags & ImGuiWindowFlags_NoMove); // Inherit the NoMove flag |
| 4975 | |
| 4976 | // Size |
| 4977 | const ImVec2 content_avail = GetContentRegionAvail(); |
| 4978 | ImVec2 size = ImFloor(size_arg); |
| 4979 | const int auto_fit_axises = ((size.x == 0.0f) ? (1 << ImGuiAxis_X) : 0x00) | ((size.y == 0.0f) ? (1 << ImGuiAxis_Y) : 0x00); |
| 4980 | if (size.x <= 0.0f) |
| 4981 | size.x = ImMax(content_avail.x + size.x, 4.0f); // Arbitrary minimum child size (0.0f causing too much issues) |
| 4982 | if (size.y <= 0.0f) |
| 4983 | size.y = ImMax(content_avail.y + size.y, 4.0f); |
| 4984 | SetNextWindowSize(size); |
| 4985 | |
| 4986 | // 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. |
| 4987 | if (name) |
| 4988 | ImFormatString(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), "%s/%s_%08X", parent_window->Name, name, id); |
| 4989 | else |
| 4990 | ImFormatString(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), "%s/%08X", parent_window->Name, id); |
| 4991 | |
| 4992 | const float backup_border_size = g.Style.ChildBorderSize; |
| 4993 | if (!border) |
| 4994 | g.Style.ChildBorderSize = 0.0f; |
| 4995 | bool ret = Begin(g.TempBuffer, NULL, flags); |
| 4996 | g.Style.ChildBorderSize = backup_border_size; |
| 4997 | |
| 4998 | ImGuiWindow* child_window = g.CurrentWindow; |
| 4999 | child_window->ChildId = id; |
| 5000 | child_window->AutoFitChildAxises = (ImS8)auto_fit_axises; |
| 5001 | |
| 5002 | // Set the cursor to handle case where the user called SetNextWindowPos()+BeginChild() manually. |
| 5003 | // While this is not really documented/defined, it seems that the expected thing to do. |
| 5004 | if (child_window->BeginCount == 1) |
| 5005 | parent_window->DC.CursorPos = child_window->Pos; |
| 5006 | |
| 5007 | // Process navigation-in immediately so NavInit can run on first frame |
| 5008 | if (g.NavActivateId == id && !(flags & ImGuiWindowFlags_NavFlattened) && (child_window->DC.NavLayersActiveMask != 0 || child_window->DC.NavHasScroll)) |
| 5009 | { |
| 5010 | FocusWindow(child_window); |
| 5011 | NavInitWindow(child_window, false); |
| 5012 | SetActiveID(id + 1, child_window); // Steal ActiveId with another arbitrary id so that key-press won't activate child item |
| 5013 | g.ActiveIdSource = ImGuiInputSource_Nav; |
| 5014 | } |
| 5015 | return ret; |
| 5016 | } |
| 5017 | |
| 5018 | bool ImGui::BeginChild(const char* str_id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags) |
| 5019 | { |
nothing calls this directly
no test coverage detected