diff options
author | Dominick Allen <djallen@librehumanitas.org> | 2024-09-28 17:39:03 -0500 |
---|---|---|
committer | Dominick Allen <djallen@librehumanitas.org> | 2024-09-28 17:39:03 -0500 |
commit | 876c829512301e3f20161f05d7c193540e6d1710 (patch) | |
tree | 17cb3f1956d88ce87e1bcd980ea67f0592b0bed4 /src/imgui_context.hpp | |
parent | dac2e7507d0172e2a87ed5b2df9c320bc9717da6 (diff) |
Working through file picker.
Diffstat (limited to 'src/imgui_context.hpp')
-rw-r--r-- | src/imgui_context.hpp | 51 |
1 files changed, 41 insertions, 10 deletions
diff --git a/src/imgui_context.hpp b/src/imgui_context.hpp index 413bd0b..fa04fb2 100644 --- a/src/imgui_context.hpp +++ b/src/imgui_context.hpp @@ -16,6 +16,8 @@ class ImguiContext { const ImGuiIO& getIO() const; + ImGuiIO& getIO(); + void setIOFlag(ImGuiConfigFlags_ flag) const; bool processEvent(SDL_Event& event) const; void startFrame() const; @@ -74,29 +76,58 @@ class ConditionalRaii { } \ }; -STRUCT_FUNCTOR_ARGS(ImguiBeginMenuBar, Imgui::BeginMenuBar) -STRUCT_FUNCTOR(ImguiEndMenuBar, Imgui::EndMenuBar) +STRUCT_FUNCTOR_ARGS(ImBeginMenuBar, Imgui::BeginMenuBar) +STRUCT_FUNCTOR(ImEndMenuBar, Imgui::EndMenuBar) -using ImguiMenuBar = ConditionalRaii<ImguiBeginMenuBar, ImguiEndMenuBar>; +using ImMenuBar = ConditionalRaii<ImBeginMenuBar, ImEndMenuBar>; -STRUCT_FUNCTOR_ARGS(ImguiBeginMenu, Imgui::BeginMenu) -STRUCT_FUNCTOR(ImguiEndMenu, Imgui::EndMenu) +STRUCT_FUNCTOR_ARGS(ImBeginMenu, Imgui::BeginMenu) +STRUCT_FUNCTOR(ImEndMenu, Imgui::EndMenu) -using ImguiMenu = ConditionalRaii<ImguiBeginMenu, ImguiEndMenu>; +using ImMenu = ConditionalRaii<ImBeginMenu, ImEndMenu>; -STRUCT_FUNCTOR_ARGS(ImguiBeginPopupModal, Imgui::BeginPopupModal) +STRUCT_FUNCTOR_ARGS(ImBeginPopupModal, Imgui::BeginPopupModal) // N.B. EndPopup is needed for BeginPopupModal -STRUCT_FUNCTOR(ImguiEndPopupModal, Imgui::EndPopup) +STRUCT_FUNCTOR(ImEndPopupModal, Imgui::EndPopup) + +using ImPopupModal = ConditionalRaii<ImBeginPopupModal, ImEndPopupModal>; + +STRUCT_FUNCTOR_ARGS(ImBeginTable, Imgui::BeginTable) +STRUCT_FUNCTOR(ImEndTable, Imgui::EndTable) -using ImguiPopupModal = ConditionalRaii<ImguiBeginPopupModal, ImguiEndPopupModal>; +using ImTable = ConditionalRaii<ImBeginTable, ImEndTable>; -// STRUCT_FUNCTOR_ARGS(Imgui +// STRUCT_FUNCTOR_ARGS(Im #undef Imgui #undef STRUCT_FUNCTOR #undef STRUCT_FUNCTOR_ARGS +constexpr auto ImBegin = ImGui::Begin; +constexpr auto ImEnd = ImGui::End; + +inline void ImSameLine(float xOffset = 0.0, float spacing = 0.0) +{ + ImGui::SameLine(xOffset, spacing); +} + +#define ImText ImGui::Text + +inline bool ImButton(const char* label, const ImVec2& size = ImVec2(0, 0)) +{ + return ImGui::Button(label, size); +} + +constexpr auto ImGetTime = ImGui::GetTime; +inline void ImNextRow(ImGuiTableRowFlags row_flags = 0, float min_row_height = 0.0f) +{ + ImGui::TableNextRow(row_flags, min_row_height); +} +constexpr auto ImNextColumn = ImGui::TableNextColumn; + +#define ImSelectable ImGui::Selectable + } // namespace bookmouse #endif |