unleashed-firmware/applications/lfrfid/view/elements/string_element.cpp
Nikolay Minaylov 6264ee8c3b
[FL-2212] File validators and archive fixes #972
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2022-01-29 12:39:10 +03:00

47 lines
No EOL
971 B
C++

#include "string_element.h"
#include <gui/elements.h>
StringElement::StringElement() {
}
StringElement::~StringElement() {
}
void StringElement::draw(Canvas* canvas) {
if(text) {
string_t line;
string_init(line);
string_set_str(line, text);
canvas_set_font(canvas, font);
if(fit_width != 0) {
elements_string_fit_width(canvas, line, fit_width);
}
elements_multiline_text_aligned(canvas, x, y, horizontal, vertical, string_get_cstr(line));
string_clear(line);
}
}
bool StringElement::input(InputEvent* event) {
return false;
}
void StringElement::set_text(
const char* _text,
uint8_t _x,
uint8_t _y,
uint8_t _fit_w,
Align _horizontal,
Align _vertical,
Font _font) {
lock_model();
text = _text;
x = _x;
y = _y;
fit_width = _fit_w;
horizontal = _horizontal;
vertical = _vertical;
font = _font;
unlock_model(true);
}