0.4.1
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
Splitter.cpp
Go to the documentation of this file.
1// This file is part of INSTINCT, the INS Toolkit for Integrated
2// Navigation Concepts and Training by the Institute of Navigation of
3// the University of Stuttgart, Germany.
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9#include "Splitter.hpp"
10
11#include <imgui.h>
12#include <imgui_internal.h>
13
14#include <string>
15
16bool NAV::gui::widgets::Splitter(const char* str_id, bool split_vertically, float thickness,
17 float* size1, float* size2,
18 float min_size1, float min_size2,
19 float splitter_long_axis_size /* = -1.0F */)
20{
21 const ImGuiContext& g = *GImGui;
22 ImGuiWindow* window = g.CurrentWindow;
23 ImGuiID id = window->GetID(("##Splitter" + std::string(str_id)).c_str());
24 ImRect bb;
25 bb.Min = window->DC.CursorPos + (split_vertically ? ImVec2(*size1, 0.0F) : ImVec2(0.0F, *size1));
26 bb.Max = bb.Min + ImGui::CalcItemSize(split_vertically ? ImVec2(thickness, splitter_long_axis_size) : ImVec2(splitter_long_axis_size, thickness), 0.0F, 0.0F);
27 return ImGui::SplitterBehavior(bb, id, split_vertically ? ImGuiAxis_X : ImGuiAxis_Y, size1, size2, min_size1, min_size2, 0.0F);
28}
Screen Divider.
bool Splitter(const char *str_id, bool split_vertically, float thickness, float *size1, float *size2, float min_size1, float min_size2, float splitter_long_axis_size=-1.0F)
Vertical or horizontal Screen Divider.
Definition Splitter.cpp:16