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:
Karijn Wessing
2021-09-05 20:47:55 +02:00
committed by GitHub
parent 54338f6e57
commit 780e0efe2c
11 changed files with 150 additions and 152 deletions

View File

@@ -1,7 +1,9 @@
# Changelog
## v8.1.0 (In progress)
- lv_obj_move_up(obj) and lv_obj_move_down(obj) added. (#2461)
- renamed lv_obj_get_child_id(obj) to lv_obj_get_index(obj).
- added lv_obj_move_to_index(obj, index). (#2461)
- 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)
- feat(anim) add interface for handling lv_anim user data. (#2415)
- feat(obj) add lv_is_initialized (#2402)

View File

@@ -42,7 +42,7 @@ lv_obj_del(label2);
There are 4 explicit way to bring an object to the foreground:
- Use `lv_obj_move_foreground(obj)` to explicitly tell the library to bring an object to the foreground. Similarly, use `lv_obj_move_background(obj)` to move to the background.
- Use `lv_obj_move_up(obj)` moves the object one position up in the hierarchy, Similarly, use `lv_obj_move_down(obj)` moves the object one position down in the hierarchy.
- Use `lv_obj_move_to_index(obj, index)` to set the index of the object in its parent.
- Use `lv_obj_swap(obj1, obj2)` to swap the relative position of two objects.
- When `lv_obj_set_parent(obj, new_parent)` is used, `obj` will be on the foreground on the `new_parent`.

View File

@@ -65,11 +65,11 @@ for(i = 0; i < lv_obj_get_child_cnt(parent); i++) {
}
```
`lv_obj_get_child_id(obj)` returns the index of the object. That is how many younger children its parent has.
`lv_obj_get_index(obj)` returns the index of the object. That is how many younger children its parent has.
You can bring an object to the foreground or send it to the background with `lv_obj_move_foreground(obj)` and `lv_obj_move_background(obj)`.
You can move an object one position up or down in the hierargy with `lv_obj_move_up(obj)` and `lv_obj_move_down(obj)`.
You can change the index of an object in its parent using `lv_obj_move_to_index(obj, index)`.
You can swap the position of two objects with `lv_obj_swap(obj1, obj2)`.