| 6457 | } |
| 6458 | |
| 6459 | static void InitOrLoadWindowSettings(ImGuiWindow* window, ImGuiWindowSettings* settings) |
| 6460 | { |
| 6461 | // Initial window state with e.g. default/arbitrary window position |
| 6462 | // Use SetNextWindowPos() with the appropriate condition flag to change the initial position of a window. |
| 6463 | const ImGuiViewport* main_viewport = ImGui::GetMainViewport(); |
| 6464 | window->Pos = main_viewport->Pos + ImVec2(60, 60); |
| 6465 | window->Size = window->SizeFull = ImVec2(0, 0); |
| 6466 | window->SetWindowPosAllowFlags = window->SetWindowSizeAllowFlags = window->SetWindowCollapsedAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing; |
| 6467 | |
| 6468 | if (settings != NULL) |
| 6469 | { |
| 6470 | SetWindowConditionAllowFlags(window, ImGuiCond_FirstUseEver, false); |
| 6471 | ApplyWindowSettings(window, settings); |
| 6472 | } |
| 6473 | window->DC.CursorStartPos = window->DC.CursorMaxPos = window->DC.IdealMaxPos = window->Pos; // So first call to CalcWindowContentSizes() doesn't return crazy values |
| 6474 | |
| 6475 | if ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) != 0) |
| 6476 | { |
| 6477 | window->AutoFitFramesX = window->AutoFitFramesY = 2; |
| 6478 | window->AutoFitOnlyGrows = false; |
| 6479 | } |
| 6480 | else |
| 6481 | { |
| 6482 | if (window->Size.x <= 0.0f) |
| 6483 | window->AutoFitFramesX = 2; |
| 6484 | if (window->Size.y <= 0.0f) |
| 6485 | window->AutoFitFramesY = 2; |
| 6486 | window->AutoFitOnlyGrows = (window->AutoFitFramesX > 0) || (window->AutoFitFramesY > 0); |
| 6487 | } |
| 6488 | } |
| 6489 | |
| 6490 | static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags) |
| 6491 | { |
no test coverage detected