static text: add getText()

This commit is contained in:
Raphael Coeffic
2022-06-11 15:13:11 +02:00
committed by Raphael Coeffic
parent 603d9230c8
commit 6605e2cb1c
2 changed files with 9 additions and 4 deletions
+7 -4
View File
@@ -29,17 +29,15 @@ StaticText::StaticText(Window* parent, const rect_t& rect, std::string txt,
lv_obj_set_height(lvobj, LV_SIZE_CONTENT);
lv_obj_clear_flag(lvobj, LV_OBJ_FLAG_CLICK_FOCUSABLE);
// TODO: select proper font based on 'textFlags'
// lv_obj_set_style_text_font(lvobj, LV_FONT_DEFAULT, LV_PART_MAIN);
// lv_obj_set_style_text_color(lvobj, makeLvColor(textFlags), LV_PART_MAIN);
lv_obj_set_style_text_color(lvobj, makeLvColor(textFlags), LV_PART_MAIN);
if (textFlags & CENTERED)
lv_obj_set_style_text_align(lvobj, LV_TEXT_ALIGN_CENTER, 0);
else if (textFlags & RIGHT)
lv_obj_set_style_text_align(lvobj, LV_TEXT_ALIGN_RIGHT, 0);
// if (textFlags & FONT(BOLD)) {
// }
if (windowFlags & BUTTON_BACKGROUND) {
lv_obj_set_style_bg_opa(lvobj, LV_OPA_100, LV_PART_MAIN);
setBackgroundColor(COLOR_THEME_SECONDARY2);
@@ -61,6 +59,11 @@ void StaticText::setText(std::string value)
}
}
const std::string& StaticText::getText() const
{
return text;
}
void StaticText::setBackgroundColor(LcdFlags color)
{
bgColor = color;
+2
View File
@@ -33,6 +33,8 @@ class StaticText: public Window
#endif
void setText(std::string value);
const std::string& getText() const;
void setBackgroundColor(LcdFlags color);
protected: