update lv_objx_templ
This commit is contained in:
@@ -30,10 +30,13 @@
|
|||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
static bool lv_templ_design(lv_obj_t * templ, const area_t * mask, lv_design_mode_t mode);
|
static bool lv_templ_design(lv_obj_t * templ, const area_t * mask, lv_design_mode_t mode);
|
||||||
|
static lv_res_t lv_templ_signal(lv_obj_t * templ, lv_signal_t sign, void * param);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
**********************/
|
**********************/
|
||||||
|
static lv_signal_func_t ancestor_signal;
|
||||||
|
static lv_design_func_t ancestor_design;
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
@@ -63,6 +66,8 @@ lv_obj_t * lv_templ_create(lv_obj_t * par, lv_obj_t * copy)
|
|||||||
/*Allocate the template type specific extended data*/
|
/*Allocate the template type specific extended data*/
|
||||||
lv_templ_ext_t * ext = lv_obj_alloc_ext(new_templ, sizeof(lv_templ_ext_t));
|
lv_templ_ext_t * ext = lv_obj_alloc_ext(new_templ, sizeof(lv_templ_ext_t));
|
||||||
dm_assert(ext);
|
dm_assert(ext);
|
||||||
|
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_func(new_templ);
|
||||||
|
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_func(new_templ);
|
||||||
|
|
||||||
/*Initialize the allocated 'ext' */
|
/*Initialize the allocated 'ext' */
|
||||||
ext->xyz = 0;
|
ext->xyz = 0;
|
||||||
@@ -86,32 +91,6 @@ lv_obj_t * lv_templ_create(lv_obj_t * par, lv_obj_t * copy)
|
|||||||
return new_templ;
|
return new_templ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Signal function of the template
|
|
||||||
* @param templ pointer to a template object
|
|
||||||
* @param sign a signal type from lv_signal_t enum
|
|
||||||
* @param param pointer to a signal specific variable
|
|
||||||
* @return true: the object is still valid (not deleted), false: the object become invalid
|
|
||||||
*/
|
|
||||||
bool lv_templ_signal(lv_obj_t * templ, lv_signal_t sign, void * param)
|
|
||||||
{
|
|
||||||
bool valid;
|
|
||||||
|
|
||||||
/* Include the ancient signal function */
|
|
||||||
/* TODO update it to the ancestor's signal function*/
|
|
||||||
valid = lv_ANCESTOR_signal(templ, sign, param);
|
|
||||||
|
|
||||||
/* The object can be deleted so check its validity and then
|
|
||||||
* make the object specific signal handling */
|
|
||||||
if(valid != false) {
|
|
||||||
if(sign == LV_SIGNAL_CLEANUP) {
|
|
||||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*======================
|
/*======================
|
||||||
* Add/remove functions
|
* Add/remove functions
|
||||||
*=====================*/
|
*=====================*/
|
||||||
@@ -150,7 +129,6 @@ bool lv_templ_signal(lv_obj_t * templ, lv_signal_t sign, void * param)
|
|||||||
* STATIC FUNCTIONS
|
* STATIC FUNCTIONS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the drawing related tasks of the templates
|
* Handle the drawing related tasks of the templates
|
||||||
* @param templ pointer to an object
|
* @param templ pointer to an object
|
||||||
@@ -179,5 +157,27 @@ static bool lv_templ_design(lv_obj_t * templ, const area_t * mask, lv_design_mod
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal function of the template
|
||||||
|
* @param templ pointer to a template object
|
||||||
|
* @param sign a signal type from lv_signal_t enum
|
||||||
|
* @param param pointer to a signal specific variable
|
||||||
|
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
|
||||||
|
*/
|
||||||
|
static lv_res_t lv_templ_signal(lv_obj_t * templ, lv_signal_t sign, void * param)
|
||||||
|
{
|
||||||
|
lv_res_t res;
|
||||||
|
|
||||||
|
/* Include the ancient signal function */
|
||||||
|
res = lv_ancestor_signal(templ, sign, param);
|
||||||
|
if(res != LV_RES_OK) return res;
|
||||||
|
|
||||||
|
|
||||||
|
if(sign == LV_SIGNAL_CLEANUP) {
|
||||||
|
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user