feat(obj) add lv_obj_move_to_index(obj, index), renamed lv_obj_get_child_id(obj) to lv_obj_get_index(obj) (#2514)
* - renamed lv_obj_get_id(obj) to lv_obj_get_index(obj). - added lv_obj_move_to_index(obj, index). * automatic review comment fixed * removed unused variable * review issue * restored deprecated function in header, otherwise Build Micropython with LVGL submodule / build (pull_request) failes * moved deprecated lv_obj_get_child_id() back to lv_obj_tree.h, otherwise Micropython will not build * inline function did not work * made deprecated function 'static inline' * and now also inline * move static inline function to lv_api_map.h again * removed lv_obj_move_up/down * changed log to warning for deprecated function * redefined lv_obj_move_foreground(obj) and lv_obj_move_background(obj) as inline functions now calling lv_obj_move_to_index(obj, index). - lv_obj_swap(obj1, obj2) added. (#2461)
This commit is contained in:
@@ -41,6 +41,46 @@ static inline LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_task_handler(void)
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
|
||||
/**********************
|
||||
* INLINE FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Move the object to the foreground.
|
||||
* It will look like if it was created as the last child of its parent.
|
||||
* It also means it can cover any of the siblings.
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
static inline void lv_obj_move_foreground(lv_obj_t* obj)
|
||||
{
|
||||
lv_obj_t* parent = lv_obj_get_parent(obj);
|
||||
lv_obj_move_to_index(obj, lv_obj_get_child_cnt(parent) - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the object to the background.
|
||||
* It will look like if it was created as the first child of its parent.
|
||||
* It also means any of the siblings can cover the object.
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
static inline void lv_obj_move_background(lv_obj_t* obj)
|
||||
{
|
||||
lv_obj_move_to_index(obj, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************
|
||||
* DEPRECATED FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static inline uint32_t lv_obj_get_child_id(const struct _lv_obj_t* obj)
|
||||
{
|
||||
LV_LOG_WARN("lv_obj_get_child_id(obj) is deprecated, please use lv_obj_get_index(obj).");
|
||||
return lv_obj_get_index(obj);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user