more files that were left out

This commit is contained in:
kkoenig1@optonline.com
2022-06-11 15:13:11 +02:00
committed by Raphael Coeffic
parent 56968f42fa
commit 78f6adb6ea
5 changed files with 29 additions and 14 deletions
+4 -1
View File
@@ -229,7 +229,10 @@ void MainWindow::run(bool trash)
{ {
auto start = ticksNow(); auto start = ticksNow();
checkEvents(); // KLK: removed for now. This is now
// called from lvgl event processing when
// necessary
// checkEvents();
if (trash) { if (trash) {
emptyTrash(); emptyTrash();
+5
View File
@@ -42,6 +42,11 @@ class MainWindow: public Window
children.clear(); children.clear();
} }
static bool isMainWindowCreated()
{
return _instance != nullptr;
}
static MainWindow * instance() static MainWindow * instance()
{ {
if (!_instance) if (!_instance)
+15 -10
View File
@@ -43,6 +43,8 @@
#endif #endif
static lv_obj_t *kb = nullptr;
static void ta_event_cb(lv_event_t * e) static void ta_event_cb(lv_event_t * e)
{ {
lv_event_code_t code = lv_event_get_code(e); lv_event_code_t code = lv_event_get_code(e);
@@ -71,15 +73,14 @@ LvglWidgetFactory textEditFactory = LvglWidgetFactory(
}, },
[] (LvglWidgetFactory *factory) { [] (LvglWidgetFactory *factory) {
lv_style_set_border_width(&factory->style, 1); lv_style_set_border_width(&factory->style, 1);
lv_style_set_border_color(&factory->style, makeLvColor(COLOR_THEME_SECONDARY2));
lv_style_set_radius(&factory->style, 0); lv_style_set_radius(&factory->style, 0);
lv_style_set_pad_top(&factory->style, 2); lv_style_set_pad_top(&factory->style, 0);
lv_style_set_pad_bottom(&factory->style, 2); lv_style_set_pad_bottom(&factory->style, 0);
lv_style_set_pad_left(&factory->style, 2); lv_style_set_pad_left(&factory->style, 0);
lv_style_set_pad_right(&factory->style, 2); lv_style_set_pad_right(&factory->style, 0);
lv_style_set_text_font(&factory->style, &lv_font_montserrat_14); lv_style_set_bg_color(&factory->style, makeLvColor(COLOR_THEME_PRIMARY2));
lv_style_set_text_line_space(&factory->style, 0); lv_style_set_bg_opa(&factory->style, LV_OPA_100);
lv_style_set_bg_color(&factory->style, lv_color_make(10,10,10));
} }
); );
@@ -93,8 +94,11 @@ TextEdit::TextEdit(Window * parent, const rect_t & rect, char * value, uint8_t l
lv_obj_add_event_cb(lvobj, ta_event_cb, LV_EVENT_ALL, NULL); lv_obj_add_event_cb(lvobj, ta_event_cb, LV_EVENT_ALL, NULL);
lv_obj_add_style(lvobj, &textEditFactory.style, LV_PART_MAIN); lv_obj_add_style(lvobj, &textEditFactory.style, LV_PART_MAIN);
lv_obj_set_style_bg_color(lvobj, lv_color_make(255,10,10), LV_PART_MAIN); // this is for the focus state. the master style takes care of the normal background
lv_obj_set_style_bg_color(lvobj, makeLvColor(COLOR_THEME_FOCUS),
LV_PART_MAIN | LV_STATE_FOCUSED);
lv_obj_set_style_bg_opa(lvobj, LV_OPA_100, LV_PART_MAIN | LV_STATE_FOCUSED);
lv_obj_set_scrollbar_mode(lvobj, LV_SCROLLBAR_MODE_OFF); lv_obj_set_scrollbar_mode(lvobj, LV_SCROLLBAR_MODE_OFF);
lv_textarea_set_password_mode(lvobj, false); lv_textarea_set_password_mode(lvobj, false);
lv_textarea_set_one_line(lvobj, true); lv_textarea_set_one_line(lvobj, true);
@@ -104,6 +108,7 @@ TextEdit::TextEdit(Window * parent, const rect_t & rect, char * value, uint8_t l
auto label = lv_textarea_get_label(lvobj); auto label = lv_textarea_get_label(lvobj);
lv_obj_set_style_text_color(label, makeLvColor(COLOR_THEME_SECONDARY1), LV_PART_MAIN); lv_obj_set_style_text_color(label, makeLvColor(COLOR_THEME_SECONDARY1), LV_PART_MAIN);
lv_obj_set_style_text_font(label, &lv_font_montserrat_12, LV_PART_MAIN);
extra_chars = (_extra_chars) ? _extra_chars : extra_chars_default; extra_chars = (_extra_chars) ? _extra_chars : extra_chars_default;
} }
-2
View File
@@ -23,8 +23,6 @@
const char extra_chars_default[] = ":;<=>"; const char extra_chars_default[] = ":;<=>";
static lv_obj_t *kb = nullptr;
class TextEdit : public FormField { class TextEdit : public FormField {
friend class TextKeyboard; friend class TextKeyboard;
+5 -1
View File
@@ -137,7 +137,11 @@ class Window
// lv integration for colors // lv integration for colors
auto textColor = COLOR_VAL(flags); auto textColor = COLOR_VAL(flags);
auto r = GET_RED(textColor), g = GET_GREEN(textColor), b = GET_BLUE(textColor); auto r = GET_RED(textColor), g = GET_GREEN(textColor), b = GET_BLUE(textColor);
lv_obj_set_style_text_color(getLvObj(), lv_color_make(r, g, b), LV_PART_MAIN); lv_obj_set_style_text_color(lvobj, lv_color_make(r, g, b), LV_PART_MAIN);
for (auto i = 0; i < lv_obj_get_child_cnt(lvobj); i++) {
auto child = lv_obj_get_child(lvobj, i);
lv_obj_set_style_text_color(child, lv_color_make(r, g, b), LV_PART_MAIN);
}
} }
void setCloseHandler(std::function<void()> handler) void setCloseHandler(std::function<void()> handler)