Files
ESP8266lib/ext/lcd/ui/UILabel.h
kazu 5cb02880b3 many updates..
new sensors.. display.. led.. drawing.. stuff..
2019-01-17 23:12:01 +01:00

46 lines
644 B
C++

#ifndef UI_LABEL_H
#define UI_LABEL_H
#include "UIElement.h"
#include "UIStructs.h"
#undef min
#undef max
#include <string>
class UILabel : public UIElement {
std::string txt;
Color cBackground = Color::fromRGB(255,255,255);
Color cText = Color::fromRGB(0,0,0);
public:
UILabel() {
;
}
void setText(const std::string& txt) {
this->txt = txt;
setNeedsRedraw();
}
void draw(UIPainter& p) {
p.setFG(cBackground);
p.fillRect(rect);
//const uint16_t txtW = fnt_f1.getWidth(txt);
//const uint16_t txtH = fnt_f1.getHeight();
p.setFG(cText);
p.drawText(rect.x, rect.y, txt.c_str());
}
};
#endif // UI_LABEL_H