Internals: Settings: added ClearWindowSettings(). Extract part of CreateNewWindow() into InitOrLoadWindowSettings().

Designed to that if the window reappear in the session it won't take an additional slot.
This commit is contained in:
ocornut
2023-02-10 15:59:01 +01:00
parent b2ebd03b16
commit 082b20e46b
2 changed files with 51 additions and 21 deletions

View File

@ -1607,6 +1607,7 @@ struct ImGuiWindowSettings
ImVec2ih Size;
bool Collapsed;
bool WantApply; // Set when loaded from .ini data (to enable merging/loading .ini data into an already running context)
bool WantDelete; // Set to invalidate/delete the settings entry
ImGuiWindowSettings() { memset(this, 0, sizeof(*this)); }
char* GetName() { return (char*)(this + 1); }
@ -2771,6 +2772,7 @@ namespace ImGui
IMGUI_API ImGuiWindowSettings* CreateNewWindowSettings(const char* name);
IMGUI_API ImGuiWindowSettings* FindWindowSettingsByName(const char* name);
IMGUI_API ImGuiWindowSettings* FindWindowSettingsByWindow(ImGuiWindow* window);
IMGUI_API void ClearWindowSettings(const char* name);
// Localization
IMGUI_API void LocalizeRegisterEntries(const ImGuiLocEntry* entries, int count);