Add led element
This commit is contained in:
2024-08-23 22:30:53 +02:00
parent 7b8a3ccff5
commit 163b9e2534
4 changed files with 39 additions and 0 deletions
+1
View File
@@ -13,6 +13,7 @@ target_sources(UI
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/UI_item.cpp
${CMAKE_CURRENT_LIST_DIR}/UI_label.cpp
${CMAKE_CURRENT_LIST_DIR}/UI_led.cpp
${CMAKE_CURRENT_LIST_DIR}/UI_button.cpp
${CMAKE_CURRENT_LIST_DIR}/UI_slider.cpp
${CMAKE_CURRENT_LIST_DIR}/UI_x_boxes.cpp
+1
View File
@@ -4,4 +4,5 @@
#include "UI_checkbox.hpp"
#include "UI_combobox.hpp"
#include "UI_label.hpp"
#include "UI_led.hpp"
#include "UI_slider.hpp"
+22
View File
@@ -0,0 +1,22 @@
#include "UI_led.hpp"
UI_led::UI_led(std::string id, std::string text, Color fg_color, Color bg_color) :
UI_item(id, UI_LED_TYPE, text, 12, fg_color, bg_color)
{
}
UI_led::UI_led(const json& j) : UI_item(j)
{
from_json(j);
}
void UI_led::from_json(const json& j)
{
UI_item::from_json(j);
}
json UI_led::to_json() const
{
return UI_item::to_json();
}
+15
View File
@@ -0,0 +1,15 @@
#pragma once
#include <string>
#include "UI_item.hpp"
#define UI_LED_TYPE std::string("UIled")
class UI_led : public UI_item
{
public:
UI_led(std::string id, std::string text, Color fg_color, Color bg_color);
UI_led(const json& j);
void from_json(const json& j) override;
json to_json() const override;
};