4d6b170769
* Fixing compiler warnings with -Wextra * More warnings suppression, WIP * Even more warning fixes * Added new lines at end of text files. * Padding fix * Additional fixes to warnings on different build configurations; added -Wextra to default build pipeline * Fixes for Secplus v1 * -additional warnings * +-Wredundant-decls fixes * FuriHal: print stack overflow task name in console * FuriHal: add missing include Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
48 lines
978 B
C++
48 lines
978 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);
|
|
}
|