mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
debug: add assterts to lv_obj and update signal functions
This commit is contained in:
parent
e9b6fcd58d
commit
ede392b7c9
@ -164,15 +164,13 @@ void lv_debug_log_error(const char * msg, unsigned long int value)
|
||||
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find)
|
||||
{
|
||||
/*Check all children of `parent`*/
|
||||
lv_obj_t * child = lv_obj_get_child(parent, NULL);
|
||||
while(child) {
|
||||
lv_obj_t * child;
|
||||
LV_LL_READ(parent->child_ll, child) {
|
||||
if(child == obj_to_find) return true;
|
||||
|
||||
/*Check the children*/
|
||||
bool found = obj_valid_child(child, obj_to_find);
|
||||
if(found) return true;
|
||||
|
||||
child = lv_obj_get_child(parent, child);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -99,7 +99,7 @@ void lv_debug_log_error(const char * msg, uint64_t value);
|
||||
|
||||
#if LV_USE_ASSERT_STR
|
||||
# ifndef LV_ASSERT_STR
|
||||
# define LV_ASSERT_STR(str) LV_DEBUG_ASSERT(LV_DEBUG_IS_STR(str), "Strange or invalid string", p);
|
||||
# define LV_ASSERT_STR(str) LV_DEBUG_ASSERT(LV_DEBUG_IS_STR(str), "Strange or invalid string", str);
|
||||
# endif
|
||||
#else
|
||||
# define LV_ASSERT_STR(p) true
|
||||
@ -117,7 +117,7 @@ void lv_debug_log_error(const char * msg, uint64_t value);
|
||||
|
||||
#if LV_USE_ASSERT_STYLE
|
||||
# ifndef LV_ASSERT_STYLE
|
||||
# define LV_ASSERT_STYLE(style_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE(style_p, obj_type), "Invalid style", style_p);
|
||||
# define LV_ASSERT_STYLE(style_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE(style_p), "Invalid style", style_p);
|
||||
# endif
|
||||
#else
|
||||
# define LV_ASSERT_STYLE(style) true
|
||||
|
@ -30,6 +30,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_obj"
|
||||
#define LV_OBJ_DEF_WIDTH (LV_DPI)
|
||||
#define LV_OBJ_DEF_HEIGHT (2 * LV_DPI / 3)
|
||||
|
||||
@ -182,8 +183,8 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
new_obj->style_p = &lv_style_scr;
|
||||
}
|
||||
/*Set the callbacks*/
|
||||
lv_obj_set_signal_cb(new_obj, lv_obj_signal);
|
||||
lv_obj_set_design_cb(new_obj, lv_obj_design);
|
||||
new_obj->signal_cb = lv_obj_signal;
|
||||
new_obj->design_cb = lv_obj_design;
|
||||
new_obj->event_cb = NULL;
|
||||
|
||||
/*Init. user date*/
|
||||
@ -214,6 +215,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
/*parent != NULL create normal obj. on a parent*/
|
||||
else {
|
||||
LV_LOG_TRACE("Object create started");
|
||||
LV_ASSERT_OBJ(parent, LV_OBJX_NAME);
|
||||
|
||||
new_obj = lv_ll_ins_head(&parent->child_ll);
|
||||
LV_ASSERT_MEM(new_obj);
|
||||
@ -255,8 +257,8 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
/*Set the callbacks*/
|
||||
lv_obj_set_signal_cb(new_obj, lv_obj_signal);
|
||||
lv_obj_set_design_cb(new_obj, lv_obj_design);
|
||||
new_obj->signal_cb = lv_obj_signal;
|
||||
new_obj->design_cb = lv_obj_design;
|
||||
new_obj->event_cb = NULL;
|
||||
|
||||
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL
|
||||
@ -295,6 +297,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
|
||||
/*Copy the attributes if required*/
|
||||
if(copy != NULL) {
|
||||
LV_ASSERT_OBJ(copy, LV_OBJX_NAME);
|
||||
lv_area_copy(&new_obj->coords, ©->coords);
|
||||
new_obj->ext_draw_pad = copy->ext_draw_pad;
|
||||
|
||||
@ -375,6 +378,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
*/
|
||||
lv_res_t lv_obj_del(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
lv_obj_invalidate(obj);
|
||||
|
||||
/*Delete from the group*/
|
||||
@ -408,15 +412,6 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
|
||||
|
||||
lv_event_mark_deleted(obj);
|
||||
|
||||
/*Remove the object from parent's children list*/
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
if(par == NULL) { /*It is a screen*/
|
||||
lv_disp_t * d = lv_obj_get_disp(obj);
|
||||
lv_ll_rem(&d->scr_ll, obj);
|
||||
} else {
|
||||
lv_ll_rem(&(par->child_ll), obj);
|
||||
}
|
||||
|
||||
/* Reset all input devices if the object to delete is used*/
|
||||
lv_indev_t * indev = lv_indev_get_next(NULL);
|
||||
while(indev) {
|
||||
@ -439,6 +434,15 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
|
||||
* Now clean up the object specific data*/
|
||||
obj->signal_cb(obj, LV_SIGNAL_CLEANUP, NULL);
|
||||
|
||||
/*Remove the object from parent's children list*/
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
if(par == NULL) { /*It is a screen*/
|
||||
lv_disp_t * d = lv_obj_get_disp(obj);
|
||||
lv_ll_rem(&d->scr_ll, obj);
|
||||
} else {
|
||||
lv_ll_rem(&(par->child_ll), obj);
|
||||
}
|
||||
|
||||
/*Delete the base objects*/
|
||||
if(obj->ext_attr != NULL) lv_mem_free(obj->ext_attr);
|
||||
lv_mem_free(obj); /*Free the object itself*/
|
||||
@ -459,6 +463,7 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
|
||||
*/
|
||||
void lv_obj_del_async(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
lv_async_call(lv_obj_del_async_cb, obj);
|
||||
}
|
||||
|
||||
@ -468,6 +473,7 @@ void lv_obj_del_async(lv_obj_t * obj)
|
||||
*/
|
||||
void lv_obj_clean(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
lv_obj_t * child = lv_obj_get_child(obj, NULL);
|
||||
lv_obj_t * child_next;
|
||||
while(child) {
|
||||
@ -485,6 +491,8 @@ void lv_obj_clean(lv_obj_t * obj)
|
||||
*/
|
||||
void lv_obj_invalidate(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
if(lv_obj_get_hidden(obj)) return;
|
||||
|
||||
/*Invalidate the object only if it belongs to the 'LV_GC_ROOT(_lv_act_scr)'*/
|
||||
@ -532,6 +540,9 @@ void lv_obj_invalidate(const lv_obj_t * obj)
|
||||
*/
|
||||
void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
LV_ASSERT_OBJ(parent, LV_OBJX_NAME);
|
||||
|
||||
if(obj->par == NULL) {
|
||||
LV_LOG_WARN("Can't set the parent of a screen");
|
||||
return;
|
||||
@ -569,6 +580,8 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent)
|
||||
*/
|
||||
void lv_obj_move_foreground(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
|
||||
/*Do nothing of already in the foreground*/
|
||||
@ -590,6 +603,8 @@ void lv_obj_move_foreground(lv_obj_t * obj)
|
||||
*/
|
||||
void lv_obj_move_background(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
|
||||
/*Do nothing of already in the background*/
|
||||
@ -617,6 +632,8 @@ void lv_obj_move_background(lv_obj_t * obj)
|
||||
*/
|
||||
void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
/*Convert x and y to absolute coordinates*/
|
||||
lv_obj_t * par = obj->par;
|
||||
|
||||
@ -664,6 +681,8 @@ void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
|
||||
*/
|
||||
void lv_obj_set_x(lv_obj_t * obj, lv_coord_t x)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_set_pos(obj, x, lv_obj_get_y(obj));
|
||||
}
|
||||
|
||||
@ -674,6 +693,8 @@ void lv_obj_set_x(lv_obj_t * obj, lv_coord_t x)
|
||||
*/
|
||||
void lv_obj_set_y(lv_obj_t * obj, lv_coord_t y)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_set_pos(obj, lv_obj_get_x(obj), y);
|
||||
}
|
||||
|
||||
@ -685,6 +706,8 @@ void lv_obj_set_y(lv_obj_t * obj, lv_coord_t y)
|
||||
*/
|
||||
void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
|
||||
/* Do nothing if the size is not changed */
|
||||
/* It is very important else recursive resizing can
|
||||
@ -734,6 +757,8 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
*/
|
||||
void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_set_size(obj, w, lv_obj_get_height(obj));
|
||||
}
|
||||
|
||||
@ -744,6 +769,8 @@ void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w)
|
||||
*/
|
||||
void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_set_size(obj, lv_obj_get_width(obj), h);
|
||||
}
|
||||
|
||||
@ -757,6 +784,8 @@ void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h)
|
||||
*/
|
||||
void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_mod, lv_coord_t y_mod)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_coord_t new_x = lv_obj_get_x(obj);
|
||||
lv_coord_t new_y = lv_obj_get_y(obj);
|
||||
|
||||
@ -764,6 +793,9 @@ void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_co
|
||||
base = lv_obj_get_parent(obj);
|
||||
}
|
||||
|
||||
LV_ASSERT_OBJ(base, LV_OBJX_NAME);
|
||||
|
||||
|
||||
switch(align) {
|
||||
case LV_ALIGN_CENTER:
|
||||
new_x = lv_obj_get_width(base) / 2 - lv_obj_get_width(obj) / 2;
|
||||
@ -902,6 +934,8 @@ void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_co
|
||||
*/
|
||||
void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_mod, lv_coord_t y_mod)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_coord_t new_x = lv_obj_get_x(obj);
|
||||
lv_coord_t new_y = lv_obj_get_y(obj);
|
||||
|
||||
@ -912,6 +946,9 @@ void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align,
|
||||
base = lv_obj_get_parent(obj);
|
||||
}
|
||||
|
||||
LV_ASSERT_OBJ(base, LV_OBJX_NAME);
|
||||
|
||||
|
||||
switch(align) {
|
||||
case LV_ALIGN_CENTER:
|
||||
new_x = lv_obj_get_width(base) / 2 - obj_w_half;
|
||||
@ -1046,6 +1083,8 @@ void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align,
|
||||
*/
|
||||
void lv_obj_realign(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
#if LV_USE_OBJ_REALIGN
|
||||
if(obj->realign.origo_align)
|
||||
lv_obj_align_origo(obj, obj->realign.base, obj->realign.align, obj->realign.xofs, obj->realign.yofs);
|
||||
@ -1065,6 +1104,8 @@ void lv_obj_realign(lv_obj_t * obj)
|
||||
*/
|
||||
void lv_obj_set_auto_realign(lv_obj_t * obj, bool en)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
#if LV_USE_OBJ_REALIGN
|
||||
obj->realign.auto_realign = en ? 1 : 0;
|
||||
#else
|
||||
@ -1083,6 +1124,8 @@ void lv_obj_set_auto_realign(lv_obj_t * obj, bool en)
|
||||
*/
|
||||
void lv_obj_set_ext_click_area(lv_obj_t * obj, uint8_t w, uint8_t h)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
obj->ext_click_pad_hor = w;
|
||||
obj->ext_click_pad_ver = h;
|
||||
}
|
||||
@ -1100,6 +1143,8 @@ void lv_obj_set_ext_click_area(lv_obj_t * obj, uint8_t w, uint8_t h)
|
||||
*/
|
||||
void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right, lv_coord_t top, lv_coord_t bottom)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL
|
||||
obj->ext_click_pad.x1 = left;
|
||||
obj->ext_click_pad.x2 = right;
|
||||
@ -1128,6 +1173,9 @@ void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right
|
||||
*/
|
||||
void lv_obj_set_style(lv_obj_t * obj, const lv_style_t * style)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
LV_ASSERT_STYLE(style);
|
||||
|
||||
obj->style_p = style;
|
||||
|
||||
/*Send a signal about style change to every children with NULL style*/
|
||||
@ -1143,6 +1191,8 @@ void lv_obj_set_style(lv_obj_t * obj, const lv_style_t * style)
|
||||
*/
|
||||
void lv_obj_refresh_style(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_invalidate(obj);
|
||||
obj->signal_cb(obj, LV_SIGNAL_STYLE_CHG, NULL);
|
||||
lv_obj_invalidate(obj);
|
||||
@ -1155,6 +1205,8 @@ void lv_obj_refresh_style(lv_obj_t * obj)
|
||||
*/
|
||||
void lv_obj_report_style_mod(lv_style_t * style)
|
||||
{
|
||||
LV_ASSERT_STYLE(style);
|
||||
|
||||
lv_disp_t * d = lv_disp_get_next(NULL);
|
||||
|
||||
while(d) {
|
||||
@ -1182,6 +1234,8 @@ void lv_obj_report_style_mod(lv_style_t * style)
|
||||
*/
|
||||
void lv_obj_set_hidden(lv_obj_t * obj, bool en)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
if(!obj->hidden) lv_obj_invalidate(obj); /*Invalidate when not hidden (hidden objects are ignored) */
|
||||
|
||||
obj->hidden = en == false ? 0 : 1;
|
||||
@ -1199,6 +1253,8 @@ void lv_obj_set_hidden(lv_obj_t * obj, bool en)
|
||||
*/
|
||||
void lv_obj_set_click(lv_obj_t * obj, bool en)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
obj->click = (en == true ? 1 : 0);
|
||||
}
|
||||
|
||||
@ -1210,6 +1266,8 @@ void lv_obj_set_click(lv_obj_t * obj, bool en)
|
||||
*/
|
||||
void lv_obj_set_top(lv_obj_t * obj, bool en)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
obj->top = (en == true ? 1 : 0);
|
||||
}
|
||||
|
||||
@ -1220,6 +1278,8 @@ void lv_obj_set_top(lv_obj_t * obj, bool en)
|
||||
*/
|
||||
void lv_obj_set_drag(lv_obj_t * obj, bool en)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
if(en == true) lv_obj_set_click(obj, true); /*Drag is useless without enabled clicking*/
|
||||
obj->drag = (en == true ? 1 : 0);
|
||||
}
|
||||
@ -1231,6 +1291,8 @@ void lv_obj_set_drag(lv_obj_t * obj, bool en)
|
||||
*/
|
||||
void lv_obj_set_drag_dir(lv_obj_t * obj, lv_drag_dir_t drag_dir)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
obj->drag_dir = drag_dir;
|
||||
|
||||
if(obj->drag_dir != 0) lv_obj_set_drag(obj, true); /*Drag direction requires drag*/
|
||||
@ -1243,6 +1305,8 @@ void lv_obj_set_drag_dir(lv_obj_t * obj, lv_drag_dir_t drag_dir)
|
||||
*/
|
||||
void lv_obj_set_drag_throw(lv_obj_t * obj, bool en)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
obj->drag_throw = (en == true ? 1 : 0);
|
||||
}
|
||||
|
||||
@ -1254,6 +1318,8 @@ void lv_obj_set_drag_throw(lv_obj_t * obj, bool en)
|
||||
*/
|
||||
void lv_obj_set_drag_parent(lv_obj_t * obj, bool en)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
obj->drag_parent = (en == true ? 1 : 0);
|
||||
}
|
||||
|
||||
@ -1264,6 +1330,8 @@ void lv_obj_set_drag_parent(lv_obj_t * obj, bool en)
|
||||
*/
|
||||
void lv_obj_set_parent_event(lv_obj_t * obj, bool en)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
obj->parent_event = (en == true ? 1 : 0);
|
||||
}
|
||||
|
||||
@ -1274,6 +1342,8 @@ void lv_obj_set_parent_event(lv_obj_t * obj, bool en)
|
||||
*/
|
||||
void lv_obj_set_opa_scale_enable(lv_obj_t * obj, bool en)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
obj->opa_scale_en = en ? 1 : 0;
|
||||
}
|
||||
|
||||
@ -1287,6 +1357,8 @@ void lv_obj_set_opa_scale_enable(lv_obj_t * obj, bool en)
|
||||
*/
|
||||
void lv_obj_set_opa_scale(lv_obj_t * obj, lv_opa_t opa_scale)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
obj->opa_scale = opa_scale;
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
@ -1298,6 +1370,8 @@ void lv_obj_set_opa_scale(lv_obj_t * obj, lv_opa_t opa_scale)
|
||||
*/
|
||||
void lv_obj_set_protect(lv_obj_t * obj, uint8_t prot)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
obj->protect |= prot;
|
||||
}
|
||||
|
||||
@ -1308,6 +1382,8 @@ void lv_obj_set_protect(lv_obj_t * obj, uint8_t prot)
|
||||
*/
|
||||
void lv_obj_clear_protect(lv_obj_t * obj, uint8_t prot)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
prot = (~prot) & 0xFF;
|
||||
obj->protect &= prot;
|
||||
}
|
||||
@ -1320,6 +1396,8 @@ void lv_obj_clear_protect(lv_obj_t * obj, uint8_t prot)
|
||||
*/
|
||||
void lv_obj_set_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
obj->event_cb = event_cb;
|
||||
}
|
||||
|
||||
@ -1334,6 +1412,8 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data)
|
||||
{
|
||||
if(obj == NULL) return LV_RES_OK;
|
||||
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_res_t res;
|
||||
res = lv_event_send_func(obj->event_cb, obj, event, data);
|
||||
return res;
|
||||
@ -1351,6 +1431,8 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data)
|
||||
*/
|
||||
lv_res_t lv_event_send_func(lv_event_cb_t event_xcb, lv_obj_t * obj, lv_event_t event, const void * data)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
/* Build a simple linked list from the objects used in the events
|
||||
* It's important to know if an this object was deleted by a nested event
|
||||
* called from this `even_cb`. */
|
||||
@ -1415,6 +1497,8 @@ const void * lv_event_get_data(void)
|
||||
*/
|
||||
void lv_obj_set_signal_cb(lv_obj_t * obj, lv_signal_cb_t signal_cb)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
obj->signal_cb = signal_cb;
|
||||
}
|
||||
|
||||
@ -1425,6 +1509,8 @@ void lv_obj_set_signal_cb(lv_obj_t * obj, lv_signal_cb_t signal_cb)
|
||||
*/
|
||||
void lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
if(obj->signal_cb) obj->signal_cb(obj, signal, param);
|
||||
}
|
||||
|
||||
@ -1435,6 +1521,8 @@ void lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param)
|
||||
*/
|
||||
void lv_obj_set_design_cb(lv_obj_t * obj, lv_design_cb_t design_cb)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
obj->design_cb = design_cb;
|
||||
}
|
||||
|
||||
@ -1450,6 +1538,8 @@ void lv_obj_set_design_cb(lv_obj_t * obj, lv_design_cb_t design_cb)
|
||||
*/
|
||||
void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
obj->ext_attr = lv_mem_realloc(obj->ext_attr, ext_size);
|
||||
|
||||
return (void *)obj->ext_attr;
|
||||
@ -1461,6 +1551,8 @@ void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size)
|
||||
*/
|
||||
void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
obj->ext_draw_pad = 0;
|
||||
obj->signal_cb(obj, LV_SIGNAL_REFR_EXT_DRAW_PAD, NULL);
|
||||
|
||||
@ -1478,6 +1570,8 @@ void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj)
|
||||
*/
|
||||
lv_obj_t * lv_obj_get_screen(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
const lv_obj_t * par = obj;
|
||||
const lv_obj_t * act_p;
|
||||
|
||||
@ -1496,6 +1590,8 @@ lv_obj_t * lv_obj_get_screen(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_disp_t * lv_obj_get_disp(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
const lv_obj_t * scr;
|
||||
|
||||
if(obj->par == NULL)
|
||||
@ -1528,6 +1624,8 @@ lv_disp_t * lv_obj_get_disp(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_obj_t * lv_obj_get_parent(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->par;
|
||||
}
|
||||
|
||||
@ -1540,6 +1638,8 @@ lv_obj_t * lv_obj_get_parent(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_obj_t * lv_obj_get_child(const lv_obj_t * obj, const lv_obj_t * child)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_t * result = NULL;
|
||||
|
||||
if(child == NULL) {
|
||||
@ -1560,6 +1660,8 @@ lv_obj_t * lv_obj_get_child(const lv_obj_t * obj, const lv_obj_t * child)
|
||||
*/
|
||||
lv_obj_t * lv_obj_get_child_back(const lv_obj_t * obj, const lv_obj_t * child)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_t * result = NULL;
|
||||
|
||||
if(child == NULL) {
|
||||
@ -1578,6 +1680,8 @@ lv_obj_t * lv_obj_get_child_back(const lv_obj_t * obj, const lv_obj_t * child)
|
||||
*/
|
||||
uint16_t lv_obj_count_children(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_t * i;
|
||||
uint16_t cnt = 0;
|
||||
|
||||
@ -1592,6 +1696,8 @@ uint16_t lv_obj_count_children(const lv_obj_t * obj)
|
||||
*/
|
||||
uint16_t lv_obj_count_children_recursive(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_t * i;
|
||||
uint16_t cnt = 0;
|
||||
|
||||
@ -1615,6 +1721,8 @@ uint16_t lv_obj_count_children_recursive(const lv_obj_t * obj)
|
||||
*/
|
||||
void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_area_copy(cords_p, &obj->coords);
|
||||
}
|
||||
|
||||
@ -1625,6 +1733,8 @@ void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p)
|
||||
*/
|
||||
void lv_obj_get_inner_coords(const lv_obj_t * obj, lv_area_t * coords_p)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
const lv_style_t * style = lv_obj_get_style(obj);
|
||||
if(style->body.border.part & LV_BORDER_LEFT) coords_p->x1 += style->body.border.width;
|
||||
|
||||
@ -1642,6 +1752,8 @@ void lv_obj_get_inner_coords(const lv_obj_t * obj, lv_area_t * coords_p)
|
||||
*/
|
||||
lv_coord_t lv_obj_get_x(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_coord_t rel_x;
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
rel_x = obj->coords.x1 - parent->coords.x1;
|
||||
@ -1656,6 +1768,8 @@ lv_coord_t lv_obj_get_x(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_coord_t lv_obj_get_y(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_coord_t rel_y;
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
rel_y = obj->coords.y1 - parent->coords.y1;
|
||||
@ -1670,6 +1784,8 @@ lv_coord_t lv_obj_get_y(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return lv_area_get_width(&obj->coords);
|
||||
}
|
||||
|
||||
@ -1680,6 +1796,8 @@ lv_coord_t lv_obj_get_width(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return lv_area_get_height(&obj->coords);
|
||||
}
|
||||
|
||||
@ -1690,6 +1808,8 @@ lv_coord_t lv_obj_get_height(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width_fit(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
const lv_style_t * style = lv_obj_get_style(obj);
|
||||
|
||||
return lv_obj_get_width(obj) - style->body.padding.left - style->body.padding.right;
|
||||
@ -1702,6 +1822,8 @@ lv_coord_t lv_obj_get_width_fit(lv_obj_t * obj)
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height_fit(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
const lv_style_t * style = lv_obj_get_style(obj);
|
||||
|
||||
return lv_obj_get_height(obj) - style->body.padding.top - style->body.padding.bottom;
|
||||
@ -1714,6 +1836,8 @@ lv_coord_t lv_obj_get_height_fit(lv_obj_t * obj)
|
||||
*/
|
||||
bool lv_obj_get_auto_realign(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
#if LV_USE_OBJ_REALIGN
|
||||
return obj->realign.auto_realign ? true : false;
|
||||
#else
|
||||
@ -1729,6 +1853,8 @@ bool lv_obj_get_auto_realign(lv_obj_t * obj)
|
||||
*/
|
||||
lv_coord_t lv_obj_get_ext_click_pad_left(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY
|
||||
return obj->ext_click_pad_hor;
|
||||
#elif LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL
|
||||
@ -1746,6 +1872,8 @@ lv_coord_t lv_obj_get_ext_click_pad_left(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_coord_t lv_obj_get_ext_click_pad_right(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY
|
||||
return obj->ext_click_pad_hor;
|
||||
#elif LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL
|
||||
@ -1763,6 +1891,8 @@ lv_coord_t lv_obj_get_ext_click_pad_right(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_coord_t lv_obj_get_ext_click_pad_top(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY
|
||||
return obj->ext_click_pad_ver;
|
||||
#elif LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL
|
||||
@ -1780,6 +1910,8 @@ lv_coord_t lv_obj_get_ext_click_pad_top(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_coord_t lv_obj_get_ext_click_pad_bottom(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY
|
||||
return obj->ext_click_pad_ver
|
||||
#elif LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL
|
||||
@ -1797,6 +1929,8 @@ lv_coord_t lv_obj_get_ext_click_pad_bottom(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_coord_t lv_obj_get_ext_draw_pad(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->ext_draw_pad;
|
||||
}
|
||||
|
||||
@ -1811,6 +1945,8 @@ lv_coord_t lv_obj_get_ext_draw_pad(const lv_obj_t * obj)
|
||||
*/
|
||||
const lv_style_t * lv_obj_get_style(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
const lv_style_t * style_act = obj->style_p;
|
||||
if(style_act == NULL) {
|
||||
lv_obj_t * par = obj->par;
|
||||
@ -1859,6 +1995,8 @@ const lv_style_t * lv_obj_get_style(const lv_obj_t * obj)
|
||||
*/
|
||||
bool lv_obj_get_hidden(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->hidden == 0 ? false : true;
|
||||
}
|
||||
|
||||
@ -1869,6 +2007,8 @@ bool lv_obj_get_hidden(const lv_obj_t * obj)
|
||||
*/
|
||||
bool lv_obj_get_click(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->click == 0 ? false : true;
|
||||
}
|
||||
|
||||
@ -1879,6 +2019,8 @@ bool lv_obj_get_click(const lv_obj_t * obj)
|
||||
*/
|
||||
bool lv_obj_get_top(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->top == 0 ? false : true;
|
||||
}
|
||||
|
||||
@ -1889,6 +2031,8 @@ bool lv_obj_get_top(const lv_obj_t * obj)
|
||||
*/
|
||||
bool lv_obj_get_drag(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->drag == 0 ? false : true;
|
||||
}
|
||||
|
||||
@ -1899,6 +2043,8 @@ bool lv_obj_get_drag(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_drag_dir_t lv_obj_get_drag_dir(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->drag_dir;
|
||||
}
|
||||
|
||||
@ -1909,6 +2055,8 @@ lv_drag_dir_t lv_obj_get_drag_dir(const lv_obj_t * obj)
|
||||
*/
|
||||
bool lv_obj_get_drag_throw(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->drag_throw == 0 ? false : true;
|
||||
}
|
||||
|
||||
@ -1929,6 +2077,8 @@ bool lv_obj_get_drag_parent(const lv_obj_t * obj)
|
||||
*/
|
||||
bool lv_obj_get_parent_event(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->parent_event == 0 ? false : true;
|
||||
}
|
||||
|
||||
@ -1939,6 +2089,8 @@ bool lv_obj_get_parent_event(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_opa_t lv_obj_get_opa_scale_enable(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->opa_scale_en == 0 ? false : true;
|
||||
}
|
||||
|
||||
@ -1949,6 +2101,8 @@ lv_opa_t lv_obj_get_opa_scale_enable(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_opa_t lv_obj_get_opa_scale(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
const lv_obj_t * parent = obj;
|
||||
|
||||
while(parent) {
|
||||
@ -1966,6 +2120,8 @@ lv_opa_t lv_obj_get_opa_scale(const lv_obj_t * obj)
|
||||
*/
|
||||
uint8_t lv_obj_get_protect(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->protect;
|
||||
}
|
||||
|
||||
@ -1977,6 +2133,8 @@ uint8_t lv_obj_get_protect(const lv_obj_t * obj)
|
||||
*/
|
||||
bool lv_obj_is_protected(const lv_obj_t * obj, uint8_t prot)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return (obj->protect & prot) == 0 ? false : true;
|
||||
}
|
||||
|
||||
@ -1987,6 +2145,8 @@ bool lv_obj_is_protected(const lv_obj_t * obj, uint8_t prot)
|
||||
*/
|
||||
lv_signal_cb_t lv_obj_get_signal_cb(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->signal_cb;
|
||||
}
|
||||
|
||||
@ -1997,6 +2157,8 @@ lv_signal_cb_t lv_obj_get_signal_cb(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_design_cb_t lv_obj_get_design_cb(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->design_cb;
|
||||
}
|
||||
|
||||
@ -2007,6 +2169,8 @@ lv_design_cb_t lv_obj_get_design_cb(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_event_cb_t lv_obj_get_event_cb(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->event_cb;
|
||||
}
|
||||
|
||||
@ -2022,6 +2186,8 @@ lv_event_cb_t lv_obj_get_event_cb(const lv_obj_t * obj)
|
||||
*/
|
||||
void * lv_obj_get_ext_attr(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->ext_attr;
|
||||
}
|
||||
|
||||
@ -2033,6 +2199,9 @@ void * lv_obj_get_ext_attr(const lv_obj_t * obj)
|
||||
*/
|
||||
void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf)
|
||||
{
|
||||
LV_ASSERT_NULL(buf);
|
||||
LV_ASSERT_NULL(obj);
|
||||
|
||||
lv_obj_type_t tmp;
|
||||
|
||||
memset(buf, 0, sizeof(lv_obj_type_t));
|
||||
@ -2061,6 +2230,8 @@ void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf)
|
||||
*/
|
||||
lv_obj_user_data_t lv_obj_get_user_data(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->user_data;
|
||||
}
|
||||
|
||||
@ -2071,6 +2242,8 @@ lv_obj_user_data_t lv_obj_get_user_data(lv_obj_t * obj)
|
||||
*/
|
||||
lv_obj_user_data_t * lv_obj_get_user_data_ptr(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return &obj->user_data;
|
||||
}
|
||||
|
||||
@ -2081,6 +2254,8 @@ lv_obj_user_data_t * lv_obj_get_user_data_ptr(lv_obj_t * obj)
|
||||
*/
|
||||
void lv_obj_set_user_data(lv_obj_t * obj, lv_obj_user_data_t data)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
memcpy(&obj->user_data, &data, sizeof(lv_obj_user_data_t));
|
||||
}
|
||||
#endif
|
||||
@ -2093,6 +2268,8 @@ void lv_obj_set_user_data(lv_obj_t * obj, lv_obj_user_data_t data)
|
||||
*/
|
||||
void * lv_obj_get_group(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->group_p;
|
||||
}
|
||||
|
||||
@ -2103,6 +2280,8 @@ void * lv_obj_get_group(const lv_obj_t * obj)
|
||||
*/
|
||||
bool lv_obj_is_focused(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
if(obj->group_p) {
|
||||
if(lv_group_get_focused(obj->group_p) == obj) return true;
|
||||
}
|
||||
@ -2111,12 +2290,37 @@ bool lv_obj_is_focused(const lv_obj_t * obj)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------
|
||||
* OTHER FUNCTIONS
|
||||
*------------------*/
|
||||
|
||||
/**
|
||||
* Used in the signal callback to handle `LV_SIGNAL_GET_TYPE` signal
|
||||
* @param obj pointer to an object
|
||||
* @param buf pointer to `lv_obj_type_t`. (`param` i nteh signal callback)
|
||||
* @param name name of the object. E.g. "lv_btn". (Only teh pointer is saved)
|
||||
* @return LV_RES_OK
|
||||
*/
|
||||
lv_res_t lv_obj_handle_get_type_signal(lv_obj_t * obj, lv_obj_type_t * buf, const char * name)
|
||||
{
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = name;
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void lv_obj_del_async_cb(void * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_del(obj);
|
||||
}
|
||||
|
||||
@ -2177,24 +2381,19 @@ static bool lv_obj_design(lv_obj_t * obj, const lv_area_t * mask_p, lv_design_mo
|
||||
*/
|
||||
static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
|
||||
{
|
||||
(void)param;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(obj, param, LV_OBJX_NAME);
|
||||
|
||||
lv_res_t res = LV_RES_OK;
|
||||
|
||||
const lv_style_t * style = lv_obj_get_style(obj);
|
||||
|
||||
if(sign == LV_SIGNAL_CHILD_CHG) {
|
||||
/*Return 'invalid' if the child change signal is not enabled*/
|
||||
if(lv_obj_is_protected(obj, LV_PROTECT_CHILD_CHG) != false) res = LV_RES_INV;
|
||||
} else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
|
||||
const lv_style_t * style = lv_obj_get_style(obj);
|
||||
if(style->body.shadow.width > obj->ext_draw_pad) obj->ext_draw_pad = style->body.shadow.width;
|
||||
} else if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
lv_obj_refresh_ext_draw_pad(obj);
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
buf->type[0] = "lv_obj";
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -2315,13 +2514,13 @@ static void delete_children(lv_obj_t * obj)
|
||||
indev = lv_indev_get_next(indev);
|
||||
}
|
||||
|
||||
/* Clean up the object specific data*/
|
||||
obj->signal_cb(obj, LV_SIGNAL_CLEANUP, NULL);
|
||||
|
||||
/*Remove the object from parent's children list*/
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
lv_ll_rem(&(par->child_ll), obj);
|
||||
|
||||
/* Clean up the object specific data*/
|
||||
obj->signal_cb(obj, LV_SIGNAL_CLEANUP, NULL);
|
||||
|
||||
/*Delete the base objects*/
|
||||
if(obj->ext_attr != NULL) lv_mem_free(obj->ext_attr);
|
||||
lv_mem_free(obj); /*Free the object itself*/
|
||||
|
@ -960,6 +960,19 @@ bool lv_obj_is_focused(const lv_obj_t * obj);
|
||||
|
||||
#endif
|
||||
|
||||
/*-------------------
|
||||
* OTHER FUNCTIONS
|
||||
*------------------*/
|
||||
|
||||
/**
|
||||
* Used in the signal callback to handle `LV_SIGNAL_GET_TYPE` signal
|
||||
* @param obj pointer to an object
|
||||
* @param buf pointer to `lv_obj_type_t`. (`param` i nteh signal callback)
|
||||
* @param name name of the object. E.g. "lv_btn". (Only teh pointer is saved)
|
||||
* @return LV_RES_OK
|
||||
*/
|
||||
lv_res_t lv_obj_handle_get_type_signal(lv_obj_t * obj, lv_obj_type_t * buf, const char * name);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
@ -17,6 +17,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_arc"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -282,15 +283,10 @@ static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param)
|
||||
res = ancestor_signal(arc, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(arc, param, LV_OBJX_NAME);
|
||||
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_arc";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -20,6 +20,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_bar"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -496,17 +497,11 @@ static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param)
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(bar, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(bar, param, LV_OBJX_NAME);
|
||||
|
||||
if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
|
||||
const lv_style_t * style_indic = lv_bar_get_style(bar, LV_BAR_STYLE_INDIC);
|
||||
if(style_indic->body.shadow.width > bar->ext_draw_pad) bar->ext_draw_pad = style_indic->body.shadow.width;
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_bar";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -22,6 +22,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_btn"
|
||||
#define LV_BTN_INK_VALUE_MAX 256
|
||||
#define LV_BTN_INK_VALUE_MAX_SHIFT 8
|
||||
|
||||
@ -484,6 +485,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(btn, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(btn, param, LV_OBJX_NAME);
|
||||
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
|
||||
bool tgl = lv_btn_get_toggle(btn);
|
||||
@ -635,13 +637,6 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
||||
ink_obj = NULL;
|
||||
}
|
||||
#endif
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_btn";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -19,6 +19,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_btnm"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -714,6 +715,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(btnm, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(btnm, param, LV_OBJX_NAME);
|
||||
|
||||
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
|
||||
lv_point_t p;
|
||||
@ -898,15 +900,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_btnm";
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_calendar"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -455,6 +456,7 @@ static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void *
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(calendar, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(calendar, param, LV_OBJX_NAME);
|
||||
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||
@ -543,13 +545,6 @@ static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void *
|
||||
}
|
||||
lv_obj_invalidate(calendar);
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set date*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_calendar";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -18,6 +18,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_canvas"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -791,16 +792,10 @@ static lv_res_t lv_canvas_signal(lv_obj_t * canvas, lv_signal_t sign, void * par
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(canvas, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(canvas, param, LV_OBJX_NAME);
|
||||
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_canvas";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -16,6 +16,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_cb"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -301,6 +302,7 @@ static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param)
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(cb, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(cb, param, LV_OBJX_NAME);
|
||||
|
||||
lv_cb_ext_t * ext = lv_obj_get_ext_attr(cb);
|
||||
|
||||
@ -317,13 +319,6 @@ static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param)
|
||||
/*Follow the backgrounds state with the bullet*/
|
||||
lv_btn_set_state(ext->bullet, lv_btn_get_state(cb));
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_cb";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -17,6 +17,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_chart"
|
||||
|
||||
#define LV_CHART_YMIN_DEF 0
|
||||
#define LV_CHART_YMAX_DEF 100
|
||||
#define LV_CHART_HDIV_DEF 3
|
||||
@ -698,12 +700,13 @@ static bool lv_chart_design(lv_obj_t * chart, const lv_area_t * mask, lv_design_
|
||||
*/
|
||||
static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param)
|
||||
{
|
||||
lv_res_t res;
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
|
||||
/* Include the ancient signal function */
|
||||
lv_res_t res;
|
||||
res = ancestor_signal(chart, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(chart, param, LV_OBJX_NAME);
|
||||
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
lv_coord_t ** datal;
|
||||
@ -712,13 +715,6 @@ static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param
|
||||
lv_mem_free(*datal);
|
||||
}
|
||||
lv_ll_clear(&ext->series_ll);
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_chart";
|
||||
} else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
|
||||
/*Provide extra px draw area around the chart*/
|
||||
chart->ext_draw_pad = ext->margin;
|
||||
|
@ -25,6 +25,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_cont"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -239,6 +240,7 @@ static lv_res_t lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param)
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(cont, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(cont, param, LV_OBJX_NAME);
|
||||
|
||||
if(sign == LV_SIGNAL_STYLE_CHG) { /*Recalculate the padding if the style changed*/
|
||||
lv_cont_refr_layout(cont);
|
||||
@ -255,13 +257,6 @@ static lv_res_t lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param)
|
||||
/*FLOOD and FILL fit needs to be refreshed if the parent size has changed*/
|
||||
lv_cont_refr_autofit(cont);
|
||||
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_cont";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -22,6 +22,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_ddlist"
|
||||
|
||||
#if LV_USE_ANIMATION == 0
|
||||
#undef LV_DDLIST_DEF_ANIM_TIME
|
||||
#define LV_DDLIST_DEF_ANIM_TIME 0 /*No animation*/
|
||||
@ -623,6 +625,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(ddlist, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(ddlist, param, LV_OBJX_NAME);
|
||||
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
|
||||
@ -701,13 +704,6 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_ddlist";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -21,6 +21,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_gauge"
|
||||
|
||||
#define LV_GAUGE_DEF_NEEDLE_COLOR LV_COLOR_RED
|
||||
#define LV_GAUGE_DEF_LABEL_COUNT 6
|
||||
#define LV_GAUGE_DEF_LINE_COUNT 21 /*Should be: ((label_cnt - 1) * internal_lines) + 1*/
|
||||
@ -318,18 +320,12 @@ static lv_res_t lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(gauge, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(gauge, param, LV_OBJX_NAME);
|
||||
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
lv_mem_free(ext->values);
|
||||
ext->values = NULL;
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_gauge";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -24,6 +24,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_img"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -386,6 +387,8 @@ static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param)
|
||||
res = ancestor_signal(img, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(img, param, LV_OBJX_NAME);
|
||||
|
||||
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
if(ext->src_type == LV_IMG_SRC_FILE || ext->src_type == LV_IMG_SRC_SYMBOL) {
|
||||
@ -398,13 +401,6 @@ static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param)
|
||||
if(ext->src_type == LV_IMG_SRC_SYMBOL) {
|
||||
lv_img_set_src(img, ext->src);
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_img";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -15,6 +15,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_imgbtn"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -346,6 +347,7 @@ static lv_res_t lv_imgbtn_signal(lv_obj_t * imgbtn, lv_signal_t sign, void * par
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(imgbtn, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(imgbtn, param, LV_OBJX_NAME);
|
||||
|
||||
if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
/* If the style changed then the button was clicked, released etc. so probably the state was
|
||||
@ -353,13 +355,6 @@ static lv_res_t lv_imgbtn_signal(lv_obj_t * imgbtn, lv_signal_t sign, void * par
|
||||
refr_img(imgbtn);
|
||||
} else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_imgbtn";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -17,6 +17,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_kb"
|
||||
|
||||
#define LV_KB_CTRL_BTN_FLAGS (LV_BTNM_CTRL_NO_REPEAT | LV_BTNM_CTRL_CLICK_TRIG)
|
||||
|
||||
/**********************
|
||||
@ -420,6 +422,7 @@ static lv_res_t lv_kb_signal(lv_obj_t * kb, lv_signal_t sign, void * param)
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(kb, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(kb, param, LV_OBJX_NAME);
|
||||
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||
@ -437,13 +440,6 @@ static lv_res_t lv_kb_signal(lv_obj_t * kb, lv_signal_t sign, void * param)
|
||||
lv_cursor_type_t cur_type = lv_ta_get_cursor_type(ext->ta);
|
||||
lv_ta_set_cursor_type(ext->ta, cur_type | LV_CURSOR_HIDDEN);
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_kb";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -1024,6 +1024,7 @@ static lv_res_t lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(label, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(label, param, LV_OBJX_NAME);
|
||||
|
||||
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
@ -1052,13 +1053,6 @@ static lv_res_t lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param
|
||||
label->ext_draw_pad = LV_MATH_MAX(label->ext_draw_pad, style->body.padding.top);
|
||||
label->ext_draw_pad = LV_MATH_MAX(label->ext_draw_pad, style->body.padding.bottom);
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_label";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -16,6 +16,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_led"
|
||||
|
||||
#define LV_LED_WIDTH_DEF (LV_DPI / 3)
|
||||
#define LV_LED_HEIGHT_DEF (LV_DPI / 3)
|
||||
#define LV_LED_BRIGHT_OFF 100
|
||||
|
@ -19,6 +19,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_line"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -283,15 +284,9 @@ static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param)
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(line, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(line, param, LV_OBJX_NAME);
|
||||
|
||||
if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_line";
|
||||
} else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
|
||||
if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
|
||||
const lv_style_t * style = lv_line_get_style(line, LV_LINE_STYLE_MAIN);
|
||||
if(line->ext_draw_pad < style->line.width) line->ext_draw_pad = style->line.width;
|
||||
}
|
||||
|
@ -18,6 +18,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_list"
|
||||
|
||||
#define LV_LIST_LAYOUT_DEF LV_LAYOUT_COL_M
|
||||
|
||||
#if LV_USE_ANIMATION == 0
|
||||
@ -720,6 +722,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_page_signal(list, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(list, param, LV_OBJX_NAME);
|
||||
|
||||
if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESSED || sign == LV_SIGNAL_PRESSING ||
|
||||
sign == LV_SIGNAL_LONG_PRESS || sign == LV_SIGNAL_LONG_PRESS_REP) {
|
||||
@ -849,13 +852,6 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_list";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -874,6 +870,7 @@ static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * para
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_btn_signal(btn, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(btn, param, "");
|
||||
|
||||
if(sign == LV_SIGNAL_RELEASED) {
|
||||
lv_obj_t * list = lv_obj_get_parent(lv_obj_get_parent(btn));
|
||||
|
@ -18,6 +18,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_lmeter"
|
||||
|
||||
#define LV_LMETER_LINE_UPSCALE 5 /*2^x upscale of line to make rounding*/
|
||||
#define LV_LMETER_LINE_UPSCALE_MASK ((1 << LV_LMETER_LINE_UPSCALE) - 1)
|
||||
|
||||
@ -336,6 +338,7 @@ static lv_res_t lv_lmeter_signal(lv_obj_t * lmeter, lv_signal_t sign, void * par
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(lmeter, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(lmeter, param, LV_OBJX_NAME);
|
||||
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||
@ -344,13 +347,6 @@ static lv_res_t lv_lmeter_signal(lv_obj_t * lmeter, lv_signal_t sign, void * par
|
||||
} else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
|
||||
const lv_style_t * style = lv_lmeter_get_style(lmeter, LV_LMETER_STYLE_MAIN);
|
||||
lmeter->ext_draw_pad = LV_MATH_MAX(lmeter->ext_draw_pad, style->line.width);
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_lmeter";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -18,6 +18,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_mbos"
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
#ifndef LV_MBOX_CLOSE_ANIM_TIME
|
||||
@ -442,6 +443,7 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(mbox, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(mbox, param, LV_OBJX_NAME);
|
||||
|
||||
lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
|
||||
if(sign == LV_SIGNAL_CORD_CHG) {
|
||||
@ -477,13 +479,6 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_mbox";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -23,6 +23,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJ_X_NAME "lv_templ"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -208,16 +209,10 @@ static lv_res_t lv_templ_signal(lv_obj_t * templ, lv_signal_t sign, void * param
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(templ, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(templ, param, LV_OBJX_NAME);
|
||||
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_templ";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -20,6 +20,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_page"
|
||||
|
||||
#define LV_PAGE_SB_MIN_SIZE (LV_DPI / 8)
|
||||
|
||||
/*[ms] Scroll anim time on `lv_page_scroll_up/down/left/rigth`*/
|
||||
@ -793,6 +795,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(page, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(page, param, LV_OBJX_NAME);
|
||||
|
||||
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
|
||||
lv_obj_t * child;
|
||||
@ -870,13 +873,6 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_page";
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -896,6 +892,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(scrl, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(scrl, param, "");
|
||||
|
||||
lv_obj_t * page = lv_obj_get_parent(scrl);
|
||||
const lv_style_t * page_style = lv_obj_get_style(page);
|
||||
|
@ -18,6 +18,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_preloader"
|
||||
|
||||
#ifndef LV_PRELOAD_DEF_ARC_LENGTH
|
||||
#define LV_PRELOAD_DEF_ARC_LENGTH 60 /*[deg]*/
|
||||
#endif
|
||||
@ -412,16 +414,10 @@ static lv_res_t lv_preload_signal(lv_obj_t * preload, lv_signal_t sign, void * p
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(preload, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(preload, param, LV_OBJX_NAME);
|
||||
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_preload";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -17,6 +17,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_roller"
|
||||
|
||||
#if LV_USE_ANIMATION == 0
|
||||
#undef LV_ROLLER_DEF_ANIM_TIME
|
||||
#define LV_ROLLER_DEF_ANIM_TIME 0 /*No animation*/
|
||||
@ -400,6 +402,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
res = ancestor_signal(roller, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(roller, param, LV_OBJX_NAME);
|
||||
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
|
||||
@ -466,13 +469,6 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
ext->ddlist.sel_opt_id_ori = ori_id;
|
||||
}
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_roller";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -19,6 +19,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_slider"
|
||||
|
||||
#define LV_SLIDER_SIZE_MIN 4 /*hor. pad and ver. pad cannot make the bar or indicator smaller then this [px]*/
|
||||
#define LV_SLIDER_NOT_PRESSED INT16_MIN
|
||||
|
||||
@ -503,6 +505,7 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(slider, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(slider, param, LV_OBJX_NAME);
|
||||
|
||||
lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);
|
||||
lv_point_t p;
|
||||
@ -597,13 +600,6 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_slider";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -17,6 +17,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_spinbox"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -318,6 +319,7 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p
|
||||
res = ancestor_signal(spinbox, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(spinbox, param, LV_OBJX_NAME);
|
||||
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||
|
@ -22,6 +22,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_sw"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -279,6 +280,7 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
|
||||
|
||||
res = ancestor_signal(sw, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(sw, param, LV_OBJX_NAME);
|
||||
|
||||
sw->event_cb = event_cb;
|
||||
|
||||
@ -375,13 +377,6 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = false; /*The ancestor slider is editable the switch is not*/
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_sw";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -21,8 +21,9 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
/*Test configuration*/
|
||||
#define LV_OBJX_NAME "lv_ta"
|
||||
|
||||
/*Test configuration*/
|
||||
#ifndef LV_TA_DEF_CURSOR_BLINK_TIME
|
||||
#define LV_TA_DEF_CURSOR_BLINK_TIME 400 /*ms*/
|
||||
#endif
|
||||
@ -1332,6 +1333,7 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(ta, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(ta, param, LV_OBJX_NAME);
|
||||
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
@ -1412,13 +1414,6 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_ta";
|
||||
} else if(sign == LV_SIGNAL_DEFOCUS) {
|
||||
lv_cursor_type_t cur_type;
|
||||
cur_type = lv_ta_get_cursor_type(ta);
|
||||
@ -1462,6 +1457,7 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
||||
/* Include the ancient signal function */
|
||||
res = scrl_signal(scrl, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(scrl, param, "");
|
||||
|
||||
lv_obj_t * ta = lv_obj_get_parent(scrl);
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
|
@ -18,6 +18,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_table"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -742,6 +743,7 @@ static lv_res_t lv_table_signal(lv_obj_t * table, lv_signal_t sign, void * param
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(table, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(table, param, LV_OBJX_NAME);
|
||||
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
/*Free the cell texts*/
|
||||
@ -755,13 +757,6 @@ static lv_res_t lv_table_signal(lv_obj_t * table, lv_signal_t sign, void * param
|
||||
}
|
||||
if(ext->cell_data != NULL)
|
||||
lv_mem_free(ext->cell_data);
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_table";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -18,6 +18,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_tabview"
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
#ifndef LV_TABVIEW_DEF_ANIM_TIME
|
||||
#define LV_TABVIEW_DEF_ANIM_TIME 300 /*Animation time of focusing to the a list element [ms] (0: no animation) */
|
||||
@ -676,6 +678,7 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(tabview, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(tabview, param, LV_OBJX_NAME);
|
||||
|
||||
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
@ -730,13 +733,6 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_tabview";
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -756,6 +752,7 @@ static lv_res_t tabpage_signal(lv_obj_t * tab_page, lv_signal_t sign, void * par
|
||||
/* Include the ancient signal function */
|
||||
res = page_signal(tab_page, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(tab_page, param, "");
|
||||
|
||||
lv_obj_t * cont = lv_obj_get_parent(tab_page);
|
||||
lv_obj_t * tabview = lv_obj_get_parent(cont);
|
||||
@ -786,6 +783,7 @@ static lv_res_t tabpage_scrl_signal(lv_obj_t * tab_scrl, lv_signal_t sign, void
|
||||
/* Include the ancient signal function */
|
||||
res = page_scrl_signal(tab_scrl, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(tab_scrl, param, "");
|
||||
|
||||
lv_obj_t * tab_page = lv_obj_get_parent(tab_scrl);
|
||||
lv_obj_t * cont = lv_obj_get_parent(tab_page);
|
||||
|
@ -17,6 +17,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_tileview"
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
#ifndef LV_TILEVIEW_DEF_ANIM_TIME
|
||||
#define LV_TILEVIEW_DEF_ANIM_TIME 300 /*Animation time loading a tile [ms] (0: no animation) */
|
||||
@ -321,16 +323,10 @@ static lv_res_t lv_tileview_signal(lv_obj_t * tileview, lv_signal_t sign, void *
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(tileview, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(tileview, param, LV_OBJX_NAME);
|
||||
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_tileview";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -16,6 +16,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_win"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -480,6 +481,7 @@ static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param)
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(win, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(win, param, LV_OBJX_NAME);
|
||||
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
if(sign == LV_SIGNAL_CHILD_CHG) { /*Move children to the page*/
|
||||
@ -511,13 +513,6 @@ static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param)
|
||||
} else if(sign == LV_SIGNAL_CONTROL) {
|
||||
/*Forward all the control signals to the page*/
|
||||
ext->page->signal_cb(ext->page, sign, param);
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_win";
|
||||
}
|
||||
|
||||
return res;
|
||||
|
Loading…
x
Reference in New Issue
Block a user