summaryrefslogtreecommitdiff
path: root/ui/imgui_extras.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-04-02 23:22:12 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2025-04-02 23:22:12 +0100
commit2245fc8a3bb521afc2e6dd575cd1757ecab23558 (patch)
treec4565e14b2e9b01c970b3ee5816f6ec849b61e92 /ui/imgui_extras.cpp
parentMerge remote-tracking branch 'origin/ptrs' (diff)
parentRemove the old unused network.png icon (diff)
downloadilt-main.tar.bz2
ilt-main.tar.xz
ilt-main.zip
Merge branch 'imgui'HEADmain
Diffstat (limited to 'ui/imgui_extras.cpp')
-rw-r--r--ui/imgui_extras.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/ui/imgui_extras.cpp b/ui/imgui_extras.cpp
new file mode 100644
index 0000000..1643f4f
--- /dev/null
+++ b/ui/imgui_extras.cpp
@@ -0,0 +1,33 @@
+#define IMGUI_INTERNAL
+#include "imgui_extras.h"
+
+namespace IltGui {
+ bool
+ BeginToolbar(const char * name, ImGuiDir dir, float axisSize, ImGuiWindowFlags windowFlags)
+ {
+ return BeginToolbar(name, ImGui::GetMainViewport(), dir, axisSize, windowFlags);
+ }
+
+ bool
+ BeginToolbar(
+ const char * name, ImGuiViewport * viewport, ImGuiDir dir, float axisSize, ImGuiWindowFlags windowFlags)
+ {
+ bool isOpen = ImGui::BeginViewportSideBar(name, viewport, dir, axisSize,
+ windowFlags | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings);
+ if (isOpen) {
+ if (dir == ImGuiDir_Up || dir == ImGuiDir_Down) {
+ ImGui::GetCurrentWindow()->DC.LayoutType = ImGuiLayoutType_Horizontal;
+ }
+ }
+ else {
+ ImGui::End();
+ }
+ return isOpen;
+ }
+
+ void
+ EndToolbar()
+ {
+ ImGui::End();
+ }
+}