| 5820 | } |
| 5821 | |
| 5822 | bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags flags) |
| 5823 | { |
| 5824 | ImGuiContext& g = *GImGui; |
| 5825 | ImGuiWindow* parent_window = g.CurrentWindow; |
| 5826 | |
| 5827 | flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_NoDocking; |
| 5828 | flags |= (parent_window->Flags & ImGuiWindowFlags_NoMove); // Inherit the NoMove flag |
| 5829 | |
| 5830 | // Size |
| 5831 | const ImVec2 content_avail = GetContentRegionAvail(); |
| 5832 | ImVec2 size = ImFloor(size_arg); |
| 5833 | const int auto_fit_axises = ((size.x == 0.0f) ? (1 << ImGuiAxis_X) : 0x00) | ((size.y == 0.0f) ? (1 << ImGuiAxis_Y) : 0x00); |
| 5834 | if (size.x <= 0.0f) |
| 5835 | size.x = ImMax(content_avail.x + size.x, 4.0f); // Arbitrary minimum child size (0.0f causing too many issues) |
| 5836 | if (size.y <= 0.0f) |
| 5837 | size.y = ImMax(content_avail.y + size.y, 4.0f); |
| 5838 | SetNextWindowSize(size); |
| 5839 | |
| 5840 | // 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. |
| 5841 | const char* temp_window_name; |
| 5842 | if (name) |
| 5843 | ImFormatStringToTempBuffer(&temp_window_name, NULL, "%s/%s_%08X", parent_window->Name, name, id); |
| 5844 | else |
| 5845 | ImFormatStringToTempBuffer(&temp_window_name, NULL, "%s/%08X", parent_window->Name, id); |
| 5846 | |
| 5847 | const float backup_border_size = g.Style.ChildBorderSize; |
| 5848 | if (!border) |
| 5849 | g.Style.ChildBorderSize = 0.0f; |
| 5850 | bool ret = Begin(temp_window_name, NULL, flags); |
| 5851 | g.Style.ChildBorderSize = backup_border_size; |
| 5852 | |
| 5853 | ImGuiWindow* child_window = g.CurrentWindow; |
| 5854 | child_window->ChildId = id; |
| 5855 | child_window->AutoFitChildAxises = (ImS8)auto_fit_axises; |
| 5856 | |
| 5857 | // Set the cursor to handle case where the user called SetNextWindowPos()+BeginChild() manually. |
| 5858 | // While this is not really documented/defined, it seems that the expected thing to do. |
| 5859 | if (child_window->BeginCount == 1) |
| 5860 | parent_window->DC.CursorPos = child_window->Pos; |
| 5861 | |
| 5862 | // Process navigation-in immediately so NavInit can run on first frame |
| 5863 | if (g.NavActivateId == id && !(flags & ImGuiWindowFlags_NavFlattened) && (child_window->DC.NavLayersActiveMask != 0 || child_window->DC.NavHasScroll)) |
| 5864 | { |
| 5865 | FocusWindow(child_window); |
| 5866 | NavInitWindow(child_window, false); |
| 5867 | SetActiveID(id + 1, child_window); // Steal ActiveId with another arbitrary id so that key-press won't activate child item |
| 5868 | g.ActiveIdSource = ImGuiInputSource_Nav; |
| 5869 | } |
| 5870 | return ret; |
| 5871 | } |
| 5872 | |
| 5873 | bool ImGui::BeginChild(const char* str_id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags) |
| 5874 | { |
nothing calls this directly
no test coverage detected