From 6605e2cb1ccc383b93ff10917ba6d40485126491 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Sat, 23 Apr 2022 10:02:24 +0200 Subject: [PATCH] static text: add getText() --- radio/src/thirdparty/libopenui/src/static.cpp | 11 +++++++---- radio/src/thirdparty/libopenui/src/static.h | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/radio/src/thirdparty/libopenui/src/static.cpp b/radio/src/thirdparty/libopenui/src/static.cpp index 18d84aaf3..9dc09a471 100644 --- a/radio/src/thirdparty/libopenui/src/static.cpp +++ b/radio/src/thirdparty/libopenui/src/static.cpp @@ -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; diff --git a/radio/src/thirdparty/libopenui/src/static.h b/radio/src/thirdparty/libopenui/src/static.h index 5269e93df..1659dd7d4 100644 --- a/radio/src/thirdparty/libopenui/src/static.h +++ b/radio/src/thirdparty/libopenui/src/static.h @@ -33,6 +33,8 @@ class StaticText: public Window #endif void setText(std::string value); + const std::string& getText() const; + void setBackgroundColor(LcdFlags color); protected: