Add .to_front and .to_back

This commit is contained in:
fvanroie 2021-01-25 23:49:10 +01:00
parent cf0aab0f92
commit fe5e80529a
2 changed files with 25 additions and 7 deletions

View File

@ -1779,13 +1779,6 @@ void hasp_process_obj_attribute(lv_obj_t * obj, const char * attr_p, const char
}
break; // attribute_found
case ATTR_DELETE:
if(obj->user_data.id == 0) {
return Log.error(TAG_ATTR, F("Unable to delete a page"));
}
lv_obj_del_async(obj);
break; // attribute_found
case ATTR_RED: // TODO: remove temp RED
if(check_obj_type(obj, LV_HASP_BTNMATRIX)) {
my_btnmatrix_map_clear(obj); // TODO : remove this test property
@ -1802,6 +1795,27 @@ void hasp_process_obj_attribute(lv_obj_t * obj, const char * attr_p, const char
}
break; // attribute_found
case ATTR_DELETE:
if(!lv_obj_get_parent(obj)) {
return Log.error(TAG_ATTR, F("Unable to call %s on a page"), attr_p);
}
lv_obj_del_async(obj);
break; // attribute_found
case ATTR_TO_FRONT:
if(!lv_obj_get_parent(obj)) {
return Log.error(TAG_ATTR, F("Unable to call %s on a page"), attr_p);
}
lv_obj_move_foreground(obj);
break; // attribute_found
case ATTR_TO_BACK:
if(!lv_obj_get_parent(obj)) {
return Log.error(TAG_ATTR, F("Unable to call %s on a page"), attr_p);
}
lv_obj_move_background(obj);
break; // attribute_found
default:
hasp_local_style_attr(obj, attr, attr_hash, payload, update);
}

View File

@ -275,7 +275,11 @@ _HASP_ATTRIBUTE(SCALE_END_LINE_WIDTH, scale_end_line_width, lv_style_int_t)
#define ATTR_TXT 9328
#define ATTR_SRC 4964
#define ATTR_ID 6715
// methods
#define ATTR_DELETE 50027
#define ATTR_TO_FRONT 44741
#define ATTR_TO_BACK 24555
// Gauge
#define ATTR_CRITICAL_VALUE 39281