| 6912 | } |
| 6913 | |
| 6914 | static void InitOrLoadWindowSettings(ImGuiWindow* window, ImGuiWindowSettings* settings) |
| 6915 | { |
| 6916 | // Initial window state with e.g. default/arbitrary window position |
| 6917 | // Use SetNextWindowPos() with the appropriate condition flag to change the initial position of a window. |
| 6918 | const ImGuiViewport* main_viewport = ImGui::GetMainViewport(); |
| 6919 | window->Pos = main_viewport->Pos + ImVec2(60, 60); |
| 6920 | window->Size = window->SizeFull = ImVec2(0, 0); |
| 6921 | window->ViewportPos = main_viewport->Pos; |
| 6922 | window->SetWindowPosAllowFlags = window->SetWindowSizeAllowFlags = window->SetWindowCollapsedAllowFlags = window->SetWindowDockAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing; |
| 6923 | |
| 6924 | if (settings != NULL) |
| 6925 | { |
| 6926 | SetWindowConditionAllowFlags(window, ImGuiCond_FirstUseEver, false); |
| 6927 | ApplyWindowSettings(window, settings); |
| 6928 | } |
| 6929 | window->DC.CursorStartPos = window->DC.CursorMaxPos = window->DC.IdealMaxPos = window->Pos; // So first call to CalcWindowContentSizes() doesn't return crazy values |
| 6930 | |
| 6931 | if ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) != 0) |
| 6932 | { |
| 6933 | window->AutoFitFramesX = window->AutoFitFramesY = 2; |
| 6934 | window->AutoFitOnlyGrows = false; |
| 6935 | } |
| 6936 | else |
| 6937 | { |
| 6938 | if (window->Size.x <= 0.0f) |
| 6939 | window->AutoFitFramesX = 2; |
| 6940 | if (window->Size.y <= 0.0f) |
| 6941 | window->AutoFitFramesY = 2; |
| 6942 | window->AutoFitOnlyGrows = (window->AutoFitFramesX > 0) || (window->AutoFitFramesY > 0); |
| 6943 | } |
| 6944 | } |
| 6945 | |
| 6946 | static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags) |
| 6947 | { |
no test coverage detected