/** * Open a terminal * @return pointer to the terminal window */ lv_obj_t * terminal_create(void) { static lv_style_t style_bg; lv_style_copy(&style_bg, &lv_style_pretty); style_bg.body.main_color = LV_COLOR_MAKE(0x30, 0x30, 0x30); style_bg.body.grad_color = LV_COLOR_MAKE(0x30, 0x30, 0x30); style_bg.body.border.color = LV_COLOR_WHITE; style_bg.text.color = LV_COLOR_MAKE(0xE0, 0xE0, 0xE0); win = lv_win_create(lv_scr_act(), NULL); lv_win_set_style(win, LV_WIN_STYLE_BG, &style_bg); lv_obj_set_size(win, TERMINAL_WIDTH, TERMINAL_HEIGHT); lv_win_set_sb_mode(win, LV_SB_MODE_AUTO); lv_win_add_btn(win, SYMBOL_CLOSE, win_close_action); /*Make the window's content responsive*/ lv_win_set_layout(win, LV_LAYOUT_PRETTY); /*Create a label for the text of the terminal*/ label = lv_label_create(win, NULL); lv_label_set_long_mode(label, LV_LABEL_LONG_BREAK); lv_obj_set_width(label, lv_win_get_width(win)); lv_label_set_static_text(label, txt_log); /*Use the text array directly*/ /*Create a clear button*/ clr_btn = lv_btn_create(win, NULL); lv_cont_set_fit(clr_btn, true, true); lv_btn_set_action(clr_btn, LV_BTN_ACTION_CLICK, clr_click_action); lv_obj_t * btn_label = lv_label_create(clr_btn, NULL); lv_label_set_text(btn_label, "Clear"); return win; }
/** * Create an mpty list on the window. 'win_load_file_list' will fill it. * @param app pointer to a Files application */ static void win_create_list(lv_app_inst_t * app) { my_win_data_t * win_data = app->win_data; /*Delete the previous list*/ if(win_data->file_list != NULL) { lv_obj_del(win_data->file_list); } /*Create a new list*/ win_data->file_list = lv_list_create(app->win, NULL); lv_obj_set_width(win_data->file_list, lv_win_get_width(app->win)); lv_list_set_style_img(win_data->file_list, &style_btn_symbol); lv_obj_set_style(lv_page_get_scrl(win_data->file_list), lv_style_get(LV_STYLE_TRANSP_TIGHT, NULL)); lv_obj_set_drag_parent(win_data->file_list, true); lv_obj_set_drag_parent(lv_page_get_scrl(win_data->file_list), true); lv_cont_set_fit(win_data->file_list, false, true); lv_cont_set_layout(lv_page_get_scrl(win_data->file_list), LV_CONT_LAYOUT_COL_L); }