Modules/Widgets/public/LabelWidget.hpp
2024-11-24 22:41:14 +03:00

31 lines
No EOL
703 B
C++

#pragma once
#include "WidgetBase.hpp"
namespace tp {
template <typename Events, typename Canvas>
class LabelWidget : public Widget<Events, Canvas> {
public:
LabelWidget() = default;
void eventDraw(Canvas& canvas) override {
canvas.text(mLabel.c_str(), this->mArea, fontSize, Canvas::CC, padding, fontColor);
}
public:
void eventUpdateConfiguration(WidgetManager& wm) override {
wm.setActiveId("Label");
fontSize = wm.getNumber("Size", "FontSize");
padding = wm.getNumber("Padding", "Padding");
fontColor = wm.getColor("Default", "Front");
}
public:
std::string mLabel = "Label";
halnf fontSize = 10;
halnf padding = 0;
RGBA fontColor = { 1, 1, 1, 1 };
};
}