Update LVGL to v9.1.0
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
|
||||
Basic grid navigation
|
||||
"""""""""""""""""""""
|
||||
---------------------
|
||||
|
||||
.. lv_example:: others/gridnav/lv_example_gridnav_1
|
||||
:language: c
|
||||
|
||||
Grid navigation on a list
|
||||
""""""""""""""""""""""""
|
||||
-------------------------
|
||||
|
||||
.. lv_example:: others/gridnav/lv_example_gridnav_2
|
||||
:language: c
|
||||
|
||||
Nested grid navigations
|
||||
"""""""""""""""""""""""
|
||||
-----------------------
|
||||
|
||||
.. lv_example:: others/gridnav/lv_example_gridnav_3
|
||||
:language: c
|
||||
|
||||
Simple navigation on a list widget
|
||||
"""""""""""""""""""""""
|
||||
----------------------------------
|
||||
|
||||
.. lv_example:: others/gridnav/lv_example_gridnav_4
|
||||
:language: c
|
||||
@@ -9,7 +9,7 @@ void lv_example_gridnav_1(void)
|
||||
/*It's assumed that the default group is set and
|
||||
*there is a keyboard indev*/
|
||||
|
||||
lv_obj_t * cont1 = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * cont1 = lv_obj_create(lv_screen_active());
|
||||
lv_gridnav_add(cont1, LV_GRIDNAV_CTRL_NONE);
|
||||
|
||||
/*Use flex here, but works with grid or manually placed objects as well*/
|
||||
@@ -25,19 +25,19 @@ void lv_example_gridnav_1(void)
|
||||
|
||||
uint32_t i;
|
||||
for(i = 0; i < 10; i++) {
|
||||
lv_obj_t * obj = lv_btn_create(cont1);
|
||||
lv_obj_t * obj = lv_button_create(cont1);
|
||||
lv_obj_set_size(obj, 70, LV_SIZE_CONTENT);
|
||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_CHECKABLE);
|
||||
lv_group_remove_obj(obj); /*Not needed, we use the gridnav instead*/
|
||||
|
||||
lv_obj_t * label = lv_label_create(obj);
|
||||
lv_label_set_text_fmt(label, "%d", i);
|
||||
label = lv_label_create(obj);
|
||||
lv_label_set_text_fmt(label, "%"LV_PRIu32"", i);
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
/* Create a second container with rollover grid nav mode.*/
|
||||
|
||||
lv_obj_t * cont2 = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * cont2 = lv_obj_create(lv_screen_active());
|
||||
lv_gridnav_add(cont2, LV_GRIDNAV_CTRL_ROLLOVER);
|
||||
lv_obj_set_style_bg_color(cont2, lv_palette_lighten(LV_PALETTE_BLUE, 5), LV_STATE_FOCUSED);
|
||||
lv_obj_set_size(cont2, lv_pct(50), lv_pct(100));
|
||||
|
||||
@@ -9,24 +9,23 @@ void lv_example_gridnav_2(void)
|
||||
/*It's assumed that the default group is set and
|
||||
*there is a keyboard indev*/
|
||||
|
||||
lv_obj_t * list1 = lv_list_create(lv_scr_act());
|
||||
lv_obj_t * list1 = lv_list_create(lv_screen_active());
|
||||
lv_gridnav_add(list1, LV_GRIDNAV_CTRL_NONE);
|
||||
lv_obj_set_size(list1, lv_pct(45), lv_pct(80));
|
||||
lv_obj_align(list1, LV_ALIGN_LEFT_MID, 5, 0);
|
||||
lv_obj_set_style_bg_color(list1, lv_palette_lighten(LV_PALETTE_BLUE, 5), LV_STATE_FOCUSED);
|
||||
lv_group_add_obj(lv_group_get_default(), list1);
|
||||
|
||||
|
||||
char buf[32];
|
||||
uint32_t i;
|
||||
for(i = 0; i < 15; i++) {
|
||||
lv_snprintf(buf, sizeof(buf), "File %d", i + 1);
|
||||
lv_obj_t * item = lv_list_add_btn(list1, LV_SYMBOL_FILE, buf);
|
||||
lv_obj_t * item = lv_list_add_button(list1, LV_SYMBOL_FILE, buf);
|
||||
lv_obj_set_style_bg_opa(item, 0, 0);
|
||||
lv_group_remove_obj(item); /*Not needed, we use the gridnav instead*/
|
||||
}
|
||||
|
||||
lv_obj_t * list2 = lv_list_create(lv_scr_act());
|
||||
lv_obj_t * list2 = lv_list_create(lv_screen_active());
|
||||
lv_gridnav_add(list2, LV_GRIDNAV_CTRL_ROLLOVER);
|
||||
lv_obj_set_size(list2, lv_pct(45), lv_pct(80));
|
||||
lv_obj_align(list2, LV_ALIGN_RIGHT_MID, -5, 0);
|
||||
@@ -35,7 +34,7 @@ void lv_example_gridnav_2(void)
|
||||
|
||||
for(i = 0; i < 15; i++) {
|
||||
lv_snprintf(buf, sizeof(buf), "Folder %d", i + 1);
|
||||
lv_obj_t * item = lv_list_add_btn(list2, LV_SYMBOL_DIRECTORY, buf);
|
||||
lv_obj_t * item = lv_list_add_button(list2, LV_SYMBOL_DIRECTORY, buf);
|
||||
lv_obj_set_style_bg_opa(item, 0, 0);
|
||||
lv_group_remove_obj(item);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
static void cont_sub_event_cb(lv_event_t * e)
|
||||
{
|
||||
uint32_t k = lv_event_get_key(e);
|
||||
lv_obj_t * obj = lv_event_get_current_target(e);
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
if(k == LV_KEY_ENTER) {
|
||||
lv_group_focus_obj(obj);
|
||||
}
|
||||
@@ -22,7 +22,7 @@ void lv_example_gridnav_3(void)
|
||||
/*It's assumed that the default group is set and
|
||||
*there is a keyboard indev*/
|
||||
|
||||
lv_obj_t * cont_main = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * cont_main = lv_obj_create(lv_screen_active());
|
||||
lv_gridnav_add(cont_main, LV_GRIDNAV_CTRL_ROLLOVER | LV_GRIDNAV_CTRL_SCROLL_FIRST);
|
||||
|
||||
/*Only the container needs to be in a group*/
|
||||
@@ -36,17 +36,16 @@ void lv_example_gridnav_3(void)
|
||||
lv_obj_t * btn;
|
||||
lv_obj_t * label;
|
||||
|
||||
btn = lv_btn_create(cont_main);
|
||||
btn = lv_button_create(cont_main);
|
||||
lv_group_remove_obj(btn);
|
||||
label = lv_label_create(btn);
|
||||
lv_label_set_text(label, "Button 1");
|
||||
|
||||
btn = lv_btn_create(cont_main);
|
||||
btn = lv_button_create(cont_main);
|
||||
lv_group_remove_obj(btn);
|
||||
label = lv_label_create(btn);
|
||||
lv_label_set_text(label, "Button 2");
|
||||
|
||||
|
||||
/*Create an other container with long text to show how LV_GRIDNAV_CTRL_SCROLL_FIRST works*/
|
||||
lv_obj_t * cont_sub1 = lv_obj_create(cont_main);
|
||||
lv_obj_set_size(cont_sub1, lv_pct(100), 100);
|
||||
@@ -83,19 +82,16 @@ void lv_example_gridnav_3(void)
|
||||
lv_label_set_text(label, "Use ENTER/ESC to focus/defocus this container");
|
||||
lv_obj_set_width(label, lv_pct(100));
|
||||
|
||||
btn = lv_btn_create(cont_sub2);
|
||||
btn = lv_button_create(cont_sub2);
|
||||
lv_group_remove_obj(btn);
|
||||
label = lv_label_create(btn);
|
||||
lv_label_set_text(label, "Button 3");
|
||||
|
||||
btn = lv_btn_create(cont_sub2);
|
||||
btn = lv_button_create(cont_sub2);
|
||||
lv_group_remove_obj(btn);
|
||||
label = lv_label_create(btn);
|
||||
lv_label_set_text(label, "Button 4");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_GRIDNAV && LV_USE_FLEX && LV_BUILD_EXAMPLES
|
||||
|
||||
|
||||
static void event_handler(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
lv_obj_t * list = lv_obj_get_parent(obj);
|
||||
LV_LOG_USER("Clicked: %s", lv_list_get_btn_text(list, obj));
|
||||
LV_UNUSED(list); /*If logging is disabled*/
|
||||
LV_LOG_USER("Clicked: %s", lv_list_get_button_text(list, obj));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -17,9 +17,9 @@ void lv_example_gridnav_4(void)
|
||||
/*It's assumed that the default group is set and
|
||||
*there is a keyboard indev*/
|
||||
|
||||
lv_obj_t * list = lv_list_create(lv_scr_act());
|
||||
lv_obj_t * list = lv_list_create(lv_screen_active());
|
||||
lv_gridnav_add(list, LV_GRIDNAV_CTRL_ROLLOVER);
|
||||
lv_obj_align(list, LV_ALIGN_LEFT_MID, 0, 10);
|
||||
lv_obj_align(list, LV_ALIGN_LEFT_MID, 10, 0);
|
||||
lv_group_add_obj(lv_group_get_default(), list);
|
||||
|
||||
uint32_t i;
|
||||
@@ -33,13 +33,13 @@ void lv_example_gridnav_4(void)
|
||||
}
|
||||
|
||||
lv_snprintf(buf, sizeof(buf), "File %d", i + 1);
|
||||
lv_obj_t * item = lv_list_add_btn(list, LV_SYMBOL_FILE, buf);
|
||||
lv_obj_t * item = lv_list_add_button(list, LV_SYMBOL_FILE, buf);
|
||||
lv_obj_add_event_cb(item, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
lv_group_remove_obj(item); /*The default group adds it automatically*/
|
||||
}
|
||||
|
||||
lv_obj_t * btn = lv_btn_create(lv_scr_act());
|
||||
lv_obj_align(btn, LV_ALIGN_RIGHT_MID, 0, -10);
|
||||
lv_obj_t * btn = lv_button_create(lv_screen_active());
|
||||
lv_obj_align(btn, LV_ALIGN_RIGHT_MID, -10, 0);
|
||||
lv_obj_t * label = lv_label_create(btn);
|
||||
lv_label_set_text(label, "Button");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user