207 lines
14 KiB
C
207 lines
14 KiB
C
/*
|
|||
|
|
* Copyright 2026 NXP
|
||
|
|
* NXP Proprietary. This software is owned or controlled by NXP and may only be used strictly in
|
||
|
|
* accordance with the applicable license terms. By expressly accepting such terms or by downloading, installing,
|
||
|
|
* activating and/or otherwise using the software, you are agreeing that you have read, and that you agree to
|
||
|
|
* comply with and are bound by, such license terms. If you do not agree to be bound by the applicable license
|
||
|
|
* terms, then you may not retain, install, activate or otherwise use the software.
|
||
|
|
*/
|
||
|
|
|
||
|
|
#include "lvgl.h"
|
||
|
|
#include <stdio.h>
|
||
|
|
#include "gui_guider.h"
|
||
|
|
#include "events_init.h"
|
||
|
|
#include "widgets_init.h"
|
||
|
|
#include "custom.h"
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
void setup_scr_screen_component(lv_ui *ui)
|
||
|
|
{
|
||
|
|
//Write codes screen_component
|
||
|
|
ui->screen_component = lv_obj_create(NULL);
|
||
|
|
lv_obj_set_size(ui->screen_component, 502, 410);
|
||
|
|
lv_obj_set_scrollbar_mode(ui->screen_component, LV_SCROLLBAR_MODE_OFF);
|
||
|
|
|
||
|
|
//Write style for screen_component, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||
|
|
lv_obj_set_style_bg_opa(ui->screen_component, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_bg_color(ui->screen_component, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_bg_grad_dir(ui->screen_component, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
|
||
|
|
//Write codes screen_component_btn_chouqian
|
||
|
|
ui->screen_component_btn_chouqian = lv_button_create(ui->screen_component);
|
||
|
|
lv_obj_set_pos(ui->screen_component_btn_chouqian, 282, 246);
|
||
|
|
lv_obj_set_size(ui->screen_component_btn_chouqian, 160, 90);
|
||
|
|
ui->screen_component_btn_chouqian_label = lv_label_create(ui->screen_component_btn_chouqian);
|
||
|
|
lv_label_set_text(ui->screen_component_btn_chouqian_label, "每日抽签");
|
||
|
|
lv_label_set_long_mode(ui->screen_component_btn_chouqian_label, LV_LABEL_LONG_WRAP);
|
||
|
|
lv_obj_align(ui->screen_component_btn_chouqian_label, LV_ALIGN_BOTTOM_RIGHT, -20, -20);
|
||
|
|
lv_obj_set_style_pad_all(ui->screen_component_btn_chouqian, 0, LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_width(ui->screen_component_btn_chouqian_label, LV_SIZE_CONTENT);
|
||
|
|
|
||
|
|
//Write style for screen_component_btn_chouqian, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||
|
|
lv_obj_set_style_bg_opa(ui->screen_component_btn_chouqian, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_bg_color(ui->screen_component_btn_chouqian, lv_color_hex(0x29333b), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_bg_grad_dir(ui->screen_component_btn_chouqian, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_border_width(ui->screen_component_btn_chouqian, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_radius(ui->screen_component_btn_chouqian, 15, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_shadow_width(ui->screen_component_btn_chouqian, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_color(ui->screen_component_btn_chouqian, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_font(ui->screen_component_btn_chouqian, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_opa(ui->screen_component_btn_chouqian, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_align(ui->screen_component_btn_chouqian, LV_TEXT_ALIGN_RIGHT, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
|
||
|
|
//Write codes screen_component_btn_xingzuo
|
||
|
|
ui->screen_component_btn_xingzuo = lv_button_create(ui->screen_component);
|
||
|
|
lv_obj_set_pos(ui->screen_component_btn_xingzuo, 42, 246);
|
||
|
|
lv_obj_set_size(ui->screen_component_btn_xingzuo, 160, 90);
|
||
|
|
ui->screen_component_btn_xingzuo_label = lv_label_create(ui->screen_component_btn_xingzuo);
|
||
|
|
lv_label_set_text(ui->screen_component_btn_xingzuo_label, "星座运势");
|
||
|
|
lv_label_set_long_mode(ui->screen_component_btn_xingzuo_label, LV_LABEL_LONG_WRAP);
|
||
|
|
lv_obj_align(ui->screen_component_btn_xingzuo_label, LV_ALIGN_BOTTOM_RIGHT, -20, -20);
|
||
|
|
lv_obj_set_style_pad_all(ui->screen_component_btn_xingzuo, 0, LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_width(ui->screen_component_btn_xingzuo_label, LV_SIZE_CONTENT);
|
||
|
|
|
||
|
|
//Write style for screen_component_btn_xingzuo, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||
|
|
lv_obj_set_style_bg_opa(ui->screen_component_btn_xingzuo, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_bg_color(ui->screen_component_btn_xingzuo, lv_color_hex(0x29333b), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_bg_grad_dir(ui->screen_component_btn_xingzuo, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_border_width(ui->screen_component_btn_xingzuo, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_radius(ui->screen_component_btn_xingzuo, 15, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_shadow_width(ui->screen_component_btn_xingzuo, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_color(ui->screen_component_btn_xingzuo, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_font(ui->screen_component_btn_xingzuo, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_opa(ui->screen_component_btn_xingzuo, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_align(ui->screen_component_btn_xingzuo, LV_TEXT_ALIGN_RIGHT, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
|
||
|
|
//Write codes screen_component_btn_zhengnian
|
||
|
|
ui->screen_component_btn_zhengnian = lv_button_create(ui->screen_component);
|
||
|
|
lv_obj_set_pos(ui->screen_component_btn_zhengnian, 282, 110);
|
||
|
|
lv_obj_set_size(ui->screen_component_btn_zhengnian, 160, 90);
|
||
|
|
ui->screen_component_btn_zhengnian_label = lv_label_create(ui->screen_component_btn_zhengnian);
|
||
|
|
lv_label_set_text(ui->screen_component_btn_zhengnian_label, "正念引导");
|
||
|
|
lv_label_set_long_mode(ui->screen_component_btn_zhengnian_label, LV_LABEL_LONG_WRAP);
|
||
|
|
lv_obj_align(ui->screen_component_btn_zhengnian_label, LV_ALIGN_BOTTOM_RIGHT, -20, -20);
|
||
|
|
lv_obj_set_style_pad_all(ui->screen_component_btn_zhengnian, 0, LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_width(ui->screen_component_btn_zhengnian_label, LV_SIZE_CONTENT);
|
||
|
|
|
||
|
|
//Write style for screen_component_btn_zhengnian, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||
|
|
lv_obj_set_style_bg_opa(ui->screen_component_btn_zhengnian, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_bg_color(ui->screen_component_btn_zhengnian, lv_color_hex(0x29333b), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_bg_grad_dir(ui->screen_component_btn_zhengnian, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_border_width(ui->screen_component_btn_zhengnian, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_radius(ui->screen_component_btn_zhengnian, 15, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_shadow_width(ui->screen_component_btn_zhengnian, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_color(ui->screen_component_btn_zhengnian, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_font(ui->screen_component_btn_zhengnian, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_opa(ui->screen_component_btn_zhengnian, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_align(ui->screen_component_btn_zhengnian, LV_TEXT_ALIGN_RIGHT, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
|
||
|
|
//Write codes screen_component_btn_calendar
|
||
|
|
ui->screen_component_btn_calendar = lv_button_create(ui->screen_component);
|
||
|
|
lv_obj_set_pos(ui->screen_component_btn_calendar, 42, 110);
|
||
|
|
lv_obj_set_size(ui->screen_component_btn_calendar, 160, 90);
|
||
|
|
ui->screen_component_btn_calendar_label = lv_label_create(ui->screen_component_btn_calendar);
|
||
|
|
lv_label_set_text(ui->screen_component_btn_calendar_label, "万年历");
|
||
|
|
lv_label_set_long_mode(ui->screen_component_btn_calendar_label, LV_LABEL_LONG_WRAP);
|
||
|
|
lv_obj_align(ui->screen_component_btn_calendar_label, LV_ALIGN_BOTTOM_RIGHT, -20, -20);
|
||
|
|
lv_obj_set_style_pad_all(ui->screen_component_btn_calendar, 0, LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_width(ui->screen_component_btn_calendar_label, LV_SIZE_CONTENT);
|
||
|
|
|
||
|
|
//Write style for screen_component_btn_calendar, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||
|
|
lv_obj_set_style_bg_opa(ui->screen_component_btn_calendar, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_bg_color(ui->screen_component_btn_calendar, lv_color_hex(0x29333b), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_bg_grad_dir(ui->screen_component_btn_calendar, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_border_width(ui->screen_component_btn_calendar, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_radius(ui->screen_component_btn_calendar, 15, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_shadow_width(ui->screen_component_btn_calendar, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_color(ui->screen_component_btn_calendar, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_font(ui->screen_component_btn_calendar, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_opa(ui->screen_component_btn_calendar, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_align(ui->screen_component_btn_calendar, LV_TEXT_ALIGN_RIGHT, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
|
||
|
|
//Write codes screen_component_label_component
|
||
|
|
ui->screen_component_label_component = lv_label_create(ui->screen_component);
|
||
|
|
lv_obj_set_pos(ui->screen_component_label_component, 184, 45);
|
||
|
|
lv_obj_set_size(ui->screen_component_label_component, 125, 25);
|
||
|
|
lv_label_set_text(ui->screen_component_label_component, "实用小组件");
|
||
|
|
lv_label_set_long_mode(ui->screen_component_label_component, LV_LABEL_LONG_WRAP);
|
||
|
|
|
||
|
|
//Write style for screen_component_label_component, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||
|
|
lv_obj_set_style_border_width(ui->screen_component_label_component, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_radius(ui->screen_component_label_component, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_color(ui->screen_component_label_component, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_font(ui->screen_component_label_component, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_opa(ui->screen_component_label_component, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_letter_space(ui->screen_component_label_component, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_line_space(ui->screen_component_label_component, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_text_align(ui->screen_component_label_component, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_bg_opa(ui->screen_component_label_component, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_pad_top(ui->screen_component_label_component, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_pad_right(ui->screen_component_label_component, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_pad_bottom(ui->screen_component_label_component, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_pad_left(ui->screen_component_label_component, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_shadow_width(ui->screen_component_label_component, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
|
||
|
|
//Write codes screen_component_img_PC
|
||
|
|
ui->screen_component_img_PC = lv_image_create(ui->screen_component);
|
||
|
|
lv_obj_set_pos(ui->screen_component_img_PC, 167, 114);
|
||
|
|
lv_obj_set_size(ui->screen_component_img_PC, 25, 25);
|
||
|
|
lv_obj_add_flag(ui->screen_component_img_PC, LV_OBJ_FLAG_CLICKABLE);
|
||
|
|
lv_image_set_src(ui->screen_component_img_PC, &_Perpetual_Calendar_RGB888_25x25);
|
||
|
|
lv_image_set_pivot(ui->screen_component_img_PC, 50,50);
|
||
|
|
lv_image_set_rotation(ui->screen_component_img_PC, 0);
|
||
|
|
|
||
|
|
//Write style for screen_component_img_PC, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||
|
|
lv_obj_set_style_image_recolor_opa(ui->screen_component_img_PC, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_image_opa(ui->screen_component_img_PC, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
|
||
|
|
//Write codes screen_component_img_MG
|
||
|
|
ui->screen_component_img_MG = lv_image_create(ui->screen_component);
|
||
|
|
lv_obj_set_pos(ui->screen_component_img_MG, 407, 114);
|
||
|
|
lv_obj_set_size(ui->screen_component_img_MG, 25, 25);
|
||
|
|
lv_obj_add_flag(ui->screen_component_img_MG, LV_OBJ_FLAG_CLICKABLE);
|
||
|
|
lv_image_set_src(ui->screen_component_img_MG, &_Mindfulness_Guide_RGB888_25x25);
|
||
|
|
lv_image_set_pivot(ui->screen_component_img_MG, 50,50);
|
||
|
|
lv_image_set_rotation(ui->screen_component_img_MG, 0);
|
||
|
|
|
||
|
|
//Write style for screen_component_img_MG, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||
|
|
lv_obj_set_style_image_recolor_opa(ui->screen_component_img_MG, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_image_opa(ui->screen_component_img_MG, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
|
||
|
|
//Write codes screen_component_img_Zodiac
|
||
|
|
ui->screen_component_img_Zodiac = lv_image_create(ui->screen_component);
|
||
|
|
lv_obj_set_pos(ui->screen_component_img_Zodiac, 167, 252);
|
||
|
|
lv_obj_set_size(ui->screen_component_img_Zodiac, 25, 25);
|
||
|
|
lv_obj_add_flag(ui->screen_component_img_Zodiac, LV_OBJ_FLAG_CLICKABLE);
|
||
|
|
lv_image_set_src(ui->screen_component_img_Zodiac, &_Zodiac_RGB888_25x25);
|
||
|
|
lv_image_set_pivot(ui->screen_component_img_Zodiac, 50,50);
|
||
|
|
lv_image_set_rotation(ui->screen_component_img_Zodiac, 0);
|
||
|
|
|
||
|
|
//Write style for screen_component_img_Zodiac, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||
|
|
lv_obj_set_style_image_recolor_opa(ui->screen_component_img_Zodiac, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_image_opa(ui->screen_component_img_Zodiac, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
|
||
|
|
//Write codes screen_component_img_Draw_Lots
|
||
|
|
ui->screen_component_img_Draw_Lots = lv_image_create(ui->screen_component);
|
||
|
|
lv_obj_set_pos(ui->screen_component_img_Draw_Lots, 407, 252);
|
||
|
|
lv_obj_set_size(ui->screen_component_img_Draw_Lots, 25, 25);
|
||
|
|
lv_obj_add_flag(ui->screen_component_img_Draw_Lots, LV_OBJ_FLAG_CLICKABLE);
|
||
|
|
lv_image_set_src(ui->screen_component_img_Draw_Lots, &_Draw_Lots_RGB888_25x25);
|
||
|
|
lv_image_set_pivot(ui->screen_component_img_Draw_Lots, 50,50);
|
||
|
|
lv_image_set_rotation(ui->screen_component_img_Draw_Lots, 0);
|
||
|
|
|
||
|
|
//Write style for screen_component_img_Draw_Lots, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||
|
|
lv_obj_set_style_image_recolor_opa(ui->screen_component_img_Draw_Lots, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
lv_obj_set_style_image_opa(ui->screen_component_img_Draw_Lots, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
|
|
||
|
|
//The custom code of screen_component.
|
||
|
|
|
||
|
|
|
||
|
|
//Update current screen layout.
|
||
|
|
lv_obj_update_layout(ui->screen_component);
|
||
|
|
|
||
|
|
//Init events for screen.
|
||
|
|
events_init_screen_component(ui);
|
||
|
|
}
|