| 5543 | } |
| 5544 | |
| 5545 | static void InitOrLoadWindowSettings(ImGuiWindow* window, ImGuiWindowSettings* settings) |
| 5546 | { |
| 5547 | // Initial window state with e.g. default/arbitrary window position |
| 5548 | // Use SetNextWindowPos() with the appropriate condition flag to change the initial position of a window. |
| 5549 | const ImGuiViewport* main_viewport = ImGui::GetMainViewport(); |
| 5550 | window->Pos = main_viewport->Pos + ImVec2(60, 60); |
| 5551 | window->SetWindowPosAllowFlags = window->SetWindowSizeAllowFlags = window->SetWindowCollapsedAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing; |
| 5552 | |
| 5553 | if (settings != NULL) |
| 5554 | { |
| 5555 | SetWindowConditionAllowFlags(window, ImGuiCond_FirstUseEver, false); |
| 5556 | ApplyWindowSettings(window, settings); |
| 5557 | } |
| 5558 | window->DC.CursorStartPos = window->DC.CursorMaxPos = window->DC.IdealMaxPos = window->Pos; // So first call to CalcWindowContentSizes() doesn't return crazy values |
| 5559 | |
| 5560 | if ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) != 0) |
| 5561 | { |
| 5562 | window->AutoFitFramesX = window->AutoFitFramesY = 2; |
| 5563 | window->AutoFitOnlyGrows = false; |
| 5564 | } |
| 5565 | else |
| 5566 | { |
| 5567 | if (window->Size.x <= 0.0f) |
| 5568 | window->AutoFitFramesX = 2; |
| 5569 | if (window->Size.y <= 0.0f) |
| 5570 | window->AutoFitFramesY = 2; |
| 5571 | window->AutoFitOnlyGrows = (window->AutoFitFramesX > 0) || (window->AutoFitFramesY > 0); |
| 5572 | } |
| 5573 | } |
| 5574 | |
| 5575 | static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags) |
| 5576 | { |
no test coverage detected