feat(calendar): add chinese calendar (#5940)

Signed-off-by: lhdjply <lhdjply@126.com>
This commit is contained in:
lhdjply
2024-04-08 20:06:22 +08:00
committed by GitHub
parent b74d34407f
commit 466e29a1be
19 changed files with 22918 additions and 1200 deletions

View File

@@ -5,3 +5,8 @@ Calendar with header
.. lv_example:: widgets/calendar/lv_example_calendar_1
:language: c
Chinese calendar
-------------------------------------
.. lv_example:: widgets/calendar/lv_example_calendar_2
:language: c

View File

@@ -0,0 +1,32 @@
#include "../../lv_examples.h"
#if LV_USE_CALENDAR && LV_USE_CALENDAR_CHINESE && LV_BUILD_EXAMPLES
void lv_example_calendar_2(void)
{
lv_obj_t * calendar = lv_calendar_create(lv_screen_active());
lv_obj_set_size(calendar, 300, 300);
lv_obj_align(calendar, LV_ALIGN_TOP_MID, 0, 0);
lv_calendar_set_today_date(calendar, 2024, 03, 22);
lv_calendar_set_showed_date(calendar, 2024, 03);
#if LV_USE_CALENDAR_HEADER_DROPDOWN
lv_calendar_header_dropdown_create(calendar);
#elif LV_USE_CALENDAR_HEADER_ARROW
lv_calendar_header_arrow_create(calendar);
#endif
lv_calendar_set_chinese_mode(calendar, true);
lv_obj_set_style_text_font(calendar, &lv_font_simsun_14_cjk, LV_PART_MAIN);
}
#else
void lv_example_calendar_2(void)
{
lv_obj_t * label = lv_label_create(lv_screen_active());
lv_label_set_text(label, "chinese calendar is not enabled");
lv_obj_center(label);
}
#endif

View File

@@ -47,6 +47,7 @@ void lv_example_buttonmatrix_2(void);
void lv_example_buttonmatrix_3(void);
void lv_example_calendar_1(void);
void lv_example_calendar_2(void);
void lv_example_canvas_1(void);
void lv_example_canvas_2(void);