| 5605 | } |
| 5606 | |
| 5607 | static void InitOrLoadWindowSettings(ImGuiWindow* window, ImGuiWindowSettings* settings) |
| 5608 | { |
| 5609 | // Initial window state with e.g. default/arbitrary window position |
| 5610 | // Use SetNextWindowPos() with the appropriate condition flag to change the initial position of a window. |
| 5611 | const ImGuiViewport* main_viewport = ImGui::GetMainViewport(); |
| 5612 | window->Pos = main_viewport->Pos + ImVec2(60, 60); |
| 5613 | window->Size = window->SizeFull = ImVec2(0, 0); |
| 5614 | window->SetWindowPosAllowFlags = window->SetWindowSizeAllowFlags = window->SetWindowCollapsedAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing; |
| 5615 | |
| 5616 | if (settings != NULL) |
| 5617 | { |
| 5618 | SetWindowConditionAllowFlags(window, ImGuiCond_FirstUseEver, false); |
| 5619 | ApplyWindowSettings(window, settings); |
| 5620 | } |
| 5621 | window->DC.CursorStartPos = window->DC.CursorMaxPos = window->DC.IdealMaxPos = window->Pos; // So first call to CalcWindowContentSizes() doesn't return crazy values |
| 5622 | |
| 5623 | if ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) != 0) |
| 5624 | { |
| 5625 | window->AutoFitFramesX = window->AutoFitFramesY = 2; |
| 5626 | window->AutoFitOnlyGrows = false; |
| 5627 | } |
| 5628 | else |
| 5629 | { |
| 5630 | if (window->Size.x <= 0.0f) |
| 5631 | window->AutoFitFramesX = 2; |
| 5632 | if (window->Size.y <= 0.0f) |
| 5633 | window->AutoFitFramesY = 2; |
| 5634 | window->AutoFitOnlyGrows = (window->AutoFitFramesX > 0) || (window->AutoFitFramesY > 0); |
| 5635 | } |
| 5636 | } |
| 5637 | |
| 5638 | static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags) |
| 5639 | { |
no test coverage detected