mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Internals: add AddSettingsHandler(), RemoveSettingsHandler().
This commit is contained in:
18
imgui.cpp
18
imgui.cpp
@ -4479,11 +4479,11 @@ void ImGui::Initialize(ImGuiContext* context)
|
||||
ini_handler.ReadLineFn = WindowSettingsHandler_ReadLine;
|
||||
ini_handler.ApplyAllFn = WindowSettingsHandler_ApplyAll;
|
||||
ini_handler.WriteAllFn = WindowSettingsHandler_WriteAll;
|
||||
g.SettingsHandlers.push_back(ini_handler);
|
||||
AddSettingsHandler(&ini_handler);
|
||||
}
|
||||
|
||||
// Add .ini handle for ImGuiTable type
|
||||
TableSettingsInstallHandler(context);
|
||||
TableSettingsAddSettingsHandler();
|
||||
|
||||
// Create default viewport
|
||||
ImGuiViewportP* viewport = IM_NEW(ImGuiViewportP)();
|
||||
@ -11618,6 +11618,20 @@ ImGuiWindowSettings* ImGui::FindOrCreateWindowSettings(const char* name)
|
||||
return CreateNewWindowSettings(name);
|
||||
}
|
||||
|
||||
void ImGui::AddSettingsHandler(const ImGuiSettingsHandler* handler)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(FindSettingsHandler(handler->TypeName) == NULL);
|
||||
g.SettingsHandlers.push_back(*handler);
|
||||
}
|
||||
|
||||
void ImGui::RemoveSettingsHandler(const char* type_name)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (ImGuiSettingsHandler* handler = FindSettingsHandler(type_name))
|
||||
g.SettingsHandlers.erase(handler);
|
||||
}
|
||||
|
||||
ImGuiSettingsHandler* ImGui::FindSettingsHandler(const char* type_name)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
Reference in New Issue
Block a user