summaryrefslogtreecommitdiff
path: root/ui/imgui_extras.cpp
blob: 1643f4f409f0a0df219d4797f1f17df85bfd045b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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();
	}
}