summaryrefslogtreecommitdiff
path: root/src/views/views.cpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-08-08 22:04:47 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-08-08 22:04:47 +0200
commitb94a7ae06b20d550c727d5192cea8baf3e8fb641 (patch)
tree3258eb27e2e3f266f8c220662ebb24ebe3071b79 /src/views/views.cpp
parent21496e32695744d4679fc11105352c61522ce601 (diff)
project crud
Diffstat (limited to 'src/views/views.cpp')
-rw-r--r--src/views/views.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/views/views.cpp b/src/views/views.cpp
new file mode 100644
index 0000000..47eff34
--- /dev/null
+++ b/src/views/views.cpp
@@ -0,0 +1,28 @@
+#include "views.hpp"
+#include "imgui.h"
+#include "../locales/locales.hpp"
+
+void view_draw_required_tag()
+{
+ ImDrawList* draw_list = ImGui::GetWindowDrawList();
+
+ const char* text = localize("form.required");
+ ImVec2 text_pos = ImGui::GetCursorScreenPos();
+ ImVec2 text_size = ImGui::CalcTextSize(text);
+ text_pos.y += text_size.y/4.0f;
+
+ ImVec4 bg_color = ImVec4(0.9f, 0.235f, 0.235f, 0.4f); // Red background
+ ImVec4 text_color = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); // White text
+ float rounding = 2.0f;
+ float padding = 2.0f;
+
+ // Background rectangle
+ ImVec2 bg_min = ImVec2(text_pos.x - padding, text_pos.y - padding);
+ ImVec2 bg_max = ImVec2(text_pos.x + text_size.x + padding, text_pos.y + text_size.y + padding);
+ draw_list->AddRectFilled(bg_min, bg_max, ImColor(bg_color), rounding);
+
+ // Foreground text
+ ImGui::PushStyleColor(ImGuiCol_Text, text_color);
+ ImGui::TextUnformatted(text);
+ ImGui::PopStyleColor();
+} \ No newline at end of file