diff options
author | Dominick Allen <djallen@librehumanitas.org> | 2024-09-26 21:01:52 -0500 |
---|---|---|
committer | Dominick Allen <djallen@librehumanitas.org> | 2024-09-26 21:01:52 -0500 |
commit | dac2e7507d0172e2a87ed5b2df9c320bc9717da6 (patch) | |
tree | ba96b13dc50465d5950fcda44e6b0a62d3caeea5 /src/imgui_context.hpp | |
parent | 8477ffbfba2f15edb9f87e9336e2c4599000c32a (diff) |
Refactoring of popup modal.
Diffstat (limited to 'src/imgui_context.hpp')
-rw-r--r-- | src/imgui_context.hpp | 24 |
1 files changed, 17 insertions, 7 deletions
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<ImguiBeginMenuBar, ImguiEndMenuBar>; + +STRUCT_FUNCTOR_ARGS(ImguiBeginMenu, Imgui::BeginMenu) +STRUCT_FUNCTOR(ImguiEndMenu, Imgui::EndMenu) + +using ImguiMenu = ConditionalRaii<ImguiBeginMenu, ImguiEndMenu>; -using ImguiMenuBar = ConditionalRaii<ImGuiBeginMenuBar, ImGuiEndMenuBar>; +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<ImguiBeginPopupModal, ImguiEndPopupModal>; -using ImguiMenu = ConditionalRaii<ImGuiBeginMenu, ImGuiEndMenu>; +// STRUCT_FUNCTOR_ARGS(Imgui -// STRUCT_FUNCTOR_ARGS(ImGui +#undef Imgui #undef STRUCT_FUNCTOR #undef STRUCT_FUNCTOR_ARGS |