Update LVGL to v9.1.0
This commit is contained in:
@@ -1,16 +1,12 @@
|
||||
|
||||
Basic fragment usage
|
||||
"""""""""""""""""""
|
||||
--------------------
|
||||
|
||||
.. lv_example:: others/fragment/lv_example_fragment_1
|
||||
:language: c
|
||||
|
||||
|
||||
|
||||
Stack navigation example
|
||||
"""""""""""""""""""
|
||||
------------------------
|
||||
|
||||
.. lv_example:: others/fragment/lv_example_fragment_2
|
||||
:language: c
|
||||
|
||||
|
||||
:language: c
|
||||
|
||||
@@ -24,7 +24,6 @@ extern "C" {
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void lv_example_fragment_1(void);
|
||||
|
||||
void lv_example_fragment_2(void);
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -10,7 +10,7 @@ static void sample_fragment_ctor(lv_fragment_t * self, void * args);
|
||||
|
||||
static lv_obj_t * sample_fragment_create_obj(lv_fragment_t * self, lv_obj_t * parent);
|
||||
|
||||
static void sample_container_del(lv_event_t * e);
|
||||
static void sample_container_delete(lv_event_t * e);
|
||||
|
||||
static lv_obj_t * root = NULL;
|
||||
|
||||
@@ -22,22 +22,21 @@ struct sample_fragment_t {
|
||||
static const lv_fragment_class_t sample_cls = {
|
||||
.constructor_cb = sample_fragment_ctor,
|
||||
.create_obj_cb = sample_fragment_create_obj,
|
||||
.instance_size = sizeof(struct sample_fragment_t)
|
||||
};
|
||||
.instance_size = sizeof(struct sample_fragment_t),
|
||||
};
|
||||
|
||||
void lv_example_fragment_1(void)
|
||||
{
|
||||
root = lv_obj_create(lv_scr_act());
|
||||
root = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(root, LV_PCT(100), LV_PCT(100));
|
||||
lv_fragment_manager_t * manager = lv_fragment_manager_create(NULL);
|
||||
/* Clean up the fragment manager before objects in containers got deleted */
|
||||
lv_obj_add_event_cb(root, sample_container_del, LV_EVENT_DELETE, manager);
|
||||
lv_obj_add_event_cb(root, sample_container_delete, LV_EVENT_DELETE, manager);
|
||||
|
||||
lv_fragment_t * fragment = lv_fragment_create(&sample_cls, "Fragment");
|
||||
lv_fragment_manager_replace(manager, fragment, &root);
|
||||
}
|
||||
|
||||
|
||||
static void sample_fragment_ctor(lv_fragment_t * self, void * args)
|
||||
{
|
||||
((struct sample_fragment_t *) self)->name = args;
|
||||
@@ -51,10 +50,10 @@ static lv_obj_t * sample_fragment_create_obj(lv_fragment_t * self, lv_obj_t * pa
|
||||
return label;
|
||||
}
|
||||
|
||||
static void sample_container_del(lv_event_t * e)
|
||||
static void sample_container_delete(lv_event_t * e)
|
||||
{
|
||||
lv_fragment_manager_t * manager = (lv_fragment_manager_t *) lv_event_get_user_data(e);
|
||||
lv_fragment_manager_del(manager);
|
||||
lv_fragment_manager_delete(manager);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
#include "../../lv_examples.h"
|
||||
|
||||
#if LV_USE_FRAGMENT && LV_USE_WIN && LV_BUILD_EXAMPLES
|
||||
#if LV_USE_FRAGMENT && LV_USE_WIN && LV_USE_GRID && LV_BUILD_EXAMPLES
|
||||
|
||||
static void sample_fragment_ctor(lv_fragment_t * self, void * args);
|
||||
|
||||
@@ -14,7 +14,7 @@ static void sample_push_click(lv_event_t * e);
|
||||
|
||||
static void sample_pop_click(lv_event_t * e);
|
||||
|
||||
static void sample_container_del(lv_event_t * e);
|
||||
static void sample_container_delete(lv_event_t * e);
|
||||
|
||||
static void sample_fragment_inc_click(lv_event_t * e);
|
||||
|
||||
@@ -28,28 +28,28 @@ typedef struct sample_fragment_t {
|
||||
static const lv_fragment_class_t sample_cls = {
|
||||
.constructor_cb = sample_fragment_ctor,
|
||||
.create_obj_cb = sample_fragment_create_obj,
|
||||
.instance_size = sizeof(sample_fragment_t)
|
||||
.instance_size = sizeof(sample_fragment_t),
|
||||
};
|
||||
|
||||
static lv_obj_t * container = NULL;
|
||||
|
||||
void lv_example_fragment_2(void)
|
||||
{
|
||||
lv_obj_t * root = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * root = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(root, LV_PCT(100), LV_PCT(100));
|
||||
lv_obj_set_layout(root, LV_LAYOUT_GRID);
|
||||
static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||
static const lv_coord_t row_dsc[] = {LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
|
||||
static const int32_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||
static const int32_t row_dsc[] = {LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
|
||||
lv_obj_set_grid_dsc_array(root, col_dsc, row_dsc);
|
||||
container = lv_obj_create(root);
|
||||
lv_obj_remove_style_all(container);
|
||||
lv_obj_set_grid_cell(container, LV_GRID_ALIGN_STRETCH, 0, 2, LV_GRID_ALIGN_STRETCH, 0, 1);
|
||||
|
||||
lv_obj_t * push_btn = lv_btn_create(root);
|
||||
lv_obj_t * push_btn = lv_button_create(root);
|
||||
lv_obj_t * push_label = lv_label_create(push_btn);
|
||||
lv_label_set_text(push_label, "Push");
|
||||
|
||||
lv_obj_t * pop_btn = lv_btn_create(root);
|
||||
lv_obj_t * pop_btn = lv_button_create(root);
|
||||
lv_obj_t * pop_label = lv_label_create(pop_btn);
|
||||
lv_label_set_text(pop_label, "Pop");
|
||||
lv_obj_set_grid_cell(push_btn, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_CENTER, 1, 1);
|
||||
@@ -57,7 +57,7 @@ void lv_example_fragment_2(void)
|
||||
|
||||
lv_fragment_manager_t * manager = lv_fragment_manager_create(NULL);
|
||||
/* Clean up the fragment manager before objects in containers got deleted */
|
||||
lv_obj_add_event_cb(root, sample_container_del, LV_EVENT_DELETE, manager);
|
||||
lv_obj_add_event_cb(root, sample_container_delete, LV_EVENT_DELETE, manager);
|
||||
|
||||
int depth = 0;
|
||||
lv_fragment_t * fragment = lv_fragment_create(&sample_cls, &depth);
|
||||
@@ -66,7 +66,6 @@ void lv_example_fragment_2(void)
|
||||
lv_obj_add_event_cb(pop_btn, sample_pop_click, LV_EVENT_CLICKED, manager);
|
||||
}
|
||||
|
||||
|
||||
static void sample_fragment_ctor(lv_fragment_t * self, void * args)
|
||||
{
|
||||
LV_UNUSED(args);
|
||||
@@ -89,7 +88,7 @@ static lv_obj_t * sample_fragment_create_obj(lv_fragment_t * self, lv_obj_t * pa
|
||||
fragment->label = label;
|
||||
lv_label_set_text_fmt(label, "The button has been pressed %d times", fragment->counter);
|
||||
|
||||
lv_obj_t * inc_btn = lv_btn_create(content);
|
||||
lv_obj_t * inc_btn = lv_button_create(content);
|
||||
lv_obj_t * inc_label = lv_label_create(inc_btn);
|
||||
lv_label_set_text(inc_label, "+1");
|
||||
lv_obj_add_event_cb(inc_btn, sample_fragment_inc_click, LV_EVENT_CLICKED, fragment);
|
||||
@@ -111,10 +110,10 @@ static void sample_pop_click(lv_event_t * e)
|
||||
lv_fragment_manager_pop(manager);
|
||||
}
|
||||
|
||||
static void sample_container_del(lv_event_t * e)
|
||||
static void sample_container_delete(lv_event_t * e)
|
||||
{
|
||||
lv_fragment_manager_t * manager = (lv_fragment_manager_t *) lv_event_get_user_data(e);
|
||||
lv_fragment_manager_del(manager);
|
||||
lv_fragment_manager_delete(manager);
|
||||
}
|
||||
|
||||
static void sample_fragment_inc_click(lv_event_t * e)
|
||||
|
||||
Reference in New Issue
Block a user