#ifndef UI_LABEL_H #define UI_LABEL_H #include "UIElement.h" #include "UIStructs.h" #undef min #undef max #include class UILabel : public UIElement { std::string txt; Color cBackground = Color::fromRGB(255,255,255); Color cText = Color::fromRGB(0,0,0); public: UILabel() { ; } /** set the text to draw */ void setText(const std::string& txt) { this->txt = txt; setNeedsRedraw(); } void setColorBackground(Color c) { this->cBackground = c; } void setColorText(Color c) { this->cText = c; } /** draw the label */ void draw(UIPainter& p) override { if (opaque) { p.setFG(cBackground); p.fillRect(rect); } p.setFG(cText); p.drawText(rect.x, rect.y, txt.c_str()); } }; #endif // UI_LABEL_H