LkEngine 0.1.2
 
Loading...
Searching...
No Matches
TreeNode.h
1#pragma once
2
3#include "UICore.h"
4
5
6/**************************************
7 * CUSTOM IMGUI
8 **************************************/
9namespace ImGui {
10
11 bool TreeNodeBehaviorIsOpen(const ImGuiID NodeID, ImGuiTreeNodeFlags Flags = ImGuiTreeNodeFlags_None);
12
18 bool TreeNodeWithIcon(::LkEngine::TObjectPtr<::LkEngine::LTexture2D> Icon,
19 const ImGuiID ID,
20 ImGuiTreeNodeFlags TreeNodeFlags,
21 const char* Label,
22 const char* LabelEnd,
23 const ImColor IconTint = IM_COL32_WHITE,
24 const ImGuiDir OpenDirection = ImGuiDir_Down);
25}
26
27
28namespace LkEngine::UI {
29
30 FORCEINLINE bool BeginTreeNode(const char* NodeName, const bool DefaultOpen)
31 {
32 ImGuiTreeNodeFlags TreeNodeFlags = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_FramePadding;
33 if (DefaultOpen)
34 {
35 TreeNodeFlags |= ImGuiTreeNodeFlags_DefaultOpen;
36 }
37
38 return ImGui::TreeNodeEx(NodeName, TreeNodeFlags);
39 }
40
41 FORCEINLINE void EndTreeNode()
42 {
43 ImGui::TreePop();
44 }
45
46 FORCEINLINE bool TreeNode(const std::string& ID,
47 const std::string& Label,
48 const ImGuiTreeNodeFlags Flags = 0,
49 const TObjectPtr<LTexture2D>& Icon = nullptr,
50 const ImGuiDir OpenDirection = ImGuiDir_Down)
51 {
52 ImGuiWindow* Window = ImGui::GetCurrentWindow();
53 if (!Window || Window->SkipItems)
54 {
55 return false;
56 }
57
58 return ImGui::TreeNodeWithIcon(
59 Icon,
60 Window->GetID(ID.c_str()),
61 Flags,
62 Label.c_str(), /* Label Start. */
63 nullptr, /* Label End. */
64 IM_COL32_WHITE, /* Icon Tint. */
65 OpenDirection /* Arrow direction on opened node. */
66 );
67 }
68
69}
70
Core UI.
Definition ObjectPtr.h:102