Dynamic Neural Field Composer 0.0.0
A C++20 library and interactive application for building and simulating Dynamic Neural Field (DNF) architectures.
Loading...
Searching...
No Matches
widgets.h
Go to the documentation of this file.
1#pragma once
2
3#include <imgui.h>
4#include <imgui_internal.h>
5#include <implot.h>
6
7#include "tools/math.h"
8
10{
11 void renderHelpMarker(const char* desc);
12 bool renderSidebarTab(const char* icon, const char* label, bool selected);
13 bool renderIconTileButton(const char* id, const char* icon, const char* label,
14 float tile, float uiScale,
15 ImU32 colBg, ImU32 colHover, ImU32 colActive,
16 ImU32 colText, ImU32 colLabel);
17 inline void Spring(float weight = 1.0f, const float spacing = 0.0f)
18 {
19 ImGui::Dummy(ImVec2(spacing, 0));
20 ImGui::SameLine(0, 0);
21 }
22 inline bool BeginHorizontal(const void* id = nullptr, float spacing = 0.0f)
23 {
24 if (id) ImGui::PushID(id);
25 ImGui::BeginGroup();
26 return true;
27 }
28
29 inline void EndHorizontal()
30 {
31 ImGui::EndGroup();
32 ImGui::PopID();
33 }
34 inline bool BeginVertical(const void* id = nullptr, float spacing = 0.0f)
35 {
36 if (id) ImGui::PushID(id);
37 ImGui::BeginGroup();
38 return true;
39 }
40
41 inline void EndVertical()
42 {
43 ImGui::EndGroup();
44 if (ImGui::GetID(static_cast<const void*>(nullptr)) != 0) ImGui::PopID();
45 }
46 class Card
47 {
48 private:
49 std::string id;
50 ImVec2 topLeftPosition;
51 ImVec2 size;
52 std::string title;
53 public:
54 Card(std::string id, const ImVec2& topLeftPosition, const ImVec2& size, std::string title);
55 [[nodiscard]] bool beginCard(const float& uiScale) const; // remember to end the card
56 static void endCard();
57 };
58}
static void endCard()
Definition widgets.cpp:180
bool beginCard(const float &uiScale) const
Definition widgets.cpp:146
bool BeginVertical(const void *id=nullptr, float spacing=0.0f)
Definition widgets.h:34
void Spring(float weight=1.0f, const float spacing=0.0f)
Definition widgets.h:17
void renderHelpMarker(const char *desc)
Definition widgets.cpp:18
bool renderSidebarTab(const char *icon, const char *label, bool selected)
Definition widgets.cpp:33
bool renderIconTileButton(const char *id, const char *icon, const char *label, float tile, float uiScale, ImU32 colBg, ImU32 colHover, ImU32 colActive, ImU32 colText, ImU32 colLabel)
Definition widgets.cpp:98
void EndHorizontal()
Definition widgets.h:29
void EndVertical()
Definition widgets.h:41
bool BeginHorizontal(const void *id=nullptr, float spacing=0.0f)
Definition widgets.h:22