0.5.0
Loading...
Searching...
No Matches
HelpMarker.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 "HelpMarker.hpp"
10
11#include "imgui.h"
12#include <imgui_internal.h>
13
14void NAV::gui::widgets::HelpMarker(const char* desc, const char* symbol) // NOLINT(clang-diagnostic-unused-function)
15{
16 ImGui::TextDisabled("%s", symbol);
17
18 if (ImGui::IsItemHovered())
19 {
20 ImGui::BeginTooltip();
21 ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0F);
22 ImGui::TextUnformatted(desc);
23 ImGui::PopTextWrapPos();
24 ImGui::EndTooltip();
25 }
26}
27
28bool NAV::gui::widgets::BeginHelpMarker(const char* symbol, float textWrapLength)
29{
30 ImGui::TextDisabled("%s", symbol);
31
32 if (ImGui::IsItemHovered())
33 {
34 ImGui::BeginTooltip();
35 if (textWrapLength > 0.0F)
36 {
37 ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0F);
38 }
39 return true;
40 }
41 return false;
42}
43
45{
46 if (wrapText) { ImGui::PopTextWrapPos(); }
47 ImGui::EndTooltip();
48}
Text Help Marker (?) with Tooltip.
bool BeginHelpMarker(const char *symbol="(?)", float textWrapLength=35.0F)
Begins a Text Help Marker, e.g. '(?)', with custom content.
void EndHelpMarker(bool wrapText=true)
Ends a Text Help Marker with custom content.
void HelpMarker(const char *desc, const char *symbol="(?)")
Text Help Marker, e.g. '(?)', with Tooltip.