MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / InitOrLoadWindowSettings

Function InitOrLoadWindowSettings

imgui_tiny_app/imgui/imgui.cpp:6914–6944  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6912}
6913
6914static 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
6946static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags)
6947{

Callers 2

CreateNewWindowFunction · 0.85
ClearWindowSettingsMethod · 0.85

Calls 3

ImVec2Function · 0.85
ApplyWindowSettingsFunction · 0.85

Tested by

no test coverage detected