From 93896d550ef80da6fb3bd2874b31978a67eb4c52 Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 26 Sep 2018 22:52:24 +0200 Subject: [PATCH] Added FindOrCreateWindowSettings() internal helper. --- imgui.cpp | 7 +++++++ imgui_internal.h | 1 + 2 files changed, 8 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index 595272c91..3a63a5f59 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -12317,6 +12317,13 @@ ImGuiWindowSettings* ImGui::FindWindowSettings(ImGuiID id) return NULL; } +ImGuiWindowSettings* ImGui::FindOrCreateWindowSettings(const char* name) +{ + if (ImGuiWindowSettings* settings = FindWindowSettings(ImHash(name, 0))) + return settings; + return CreateNewWindowSettings(name); +} + void ImGui::LoadIniSettingsFromDisk(const char* ini_filename) { size_t file_data_size = 0; diff --git a/imgui_internal.h b/imgui_internal.h index 4094fa6fe..c30c7b180 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1406,6 +1406,7 @@ namespace ImGui IMGUI_API void MarkIniSettingsDirty(ImGuiWindow* window); IMGUI_API ImGuiWindowSettings* CreateNewWindowSettings(const char* name); IMGUI_API ImGuiWindowSettings* FindWindowSettings(ImGuiID id); + IMGUI_API ImGuiWindowSettings* FindOrCreateWindowSettings(const char* name); IMGUI_API ImGuiSettingsHandler* FindSettingsHandler(const char* type_name); // Basic Accessors