From dac2e7507d0172e2a87ed5b2df9c320bc9717da6 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Thu, 26 Sep 2024 21:01:52 -0500 Subject: Refactoring of popup modal. --- src/imgui_context.hpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/imgui_context.hpp') diff --git a/src/imgui_context.hpp b/src/imgui_context.hpp index c6059d6..413bd0b 100644 --- a/src/imgui_context.hpp +++ b/src/imgui_context.hpp @@ -54,6 +54,8 @@ class ConditionalRaii { bool m_expr; }; +#define Imgui ImGui + #define STRUCT_FUNCTOR(FUNCTOR_NAME, FUNCTOR_FUNCTION) \ struct FUNCTOR_NAME { \ auto operator()() -> decltype(FUNCTOR_FUNCTION()) \ @@ -72,17 +74,25 @@ class ConditionalRaii { } \ }; -STRUCT_FUNCTOR_ARGS(ImGuiBeginMenuBar, ImGui::BeginMenuBar) -STRUCT_FUNCTOR(ImGuiEndMenuBar, ImGui::EndMenuBar) +STRUCT_FUNCTOR_ARGS(ImguiBeginMenuBar, Imgui::BeginMenuBar) +STRUCT_FUNCTOR(ImguiEndMenuBar, Imgui::EndMenuBar) + +using ImguiMenuBar = ConditionalRaii; + +STRUCT_FUNCTOR_ARGS(ImguiBeginMenu, Imgui::BeginMenu) +STRUCT_FUNCTOR(ImguiEndMenu, Imgui::EndMenu) + +using ImguiMenu = ConditionalRaii; -using ImguiMenuBar = ConditionalRaii; +STRUCT_FUNCTOR_ARGS(ImguiBeginPopupModal, Imgui::BeginPopupModal) +// N.B. EndPopup is needed for BeginPopupModal +STRUCT_FUNCTOR(ImguiEndPopupModal, Imgui::EndPopup) -STRUCT_FUNCTOR_ARGS(ImGuiBeginMenu, ImGui::BeginMenu) -STRUCT_FUNCTOR(ImGuiEndMenu, ImGui::EndMenu) +using ImguiPopupModal = ConditionalRaii; -using ImguiMenu = ConditionalRaii; +// STRUCT_FUNCTOR_ARGS(Imgui -// STRUCT_FUNCTOR_ARGS(ImGui +#undef Imgui #undef STRUCT_FUNCTOR #undef STRUCT_FUNCTOR_ARGS -- cgit v1.2.3