refactor: rename cnt to count
This commit is contained in:
@@ -43,7 +43,7 @@ lv_obj_t * obj_child_node_create(lv_obj_t * par, view_t * ui)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t cnt = lv_obj_get_child_cnt(par);
|
uint32_t cnt = lv_obj_get_child_count(par);
|
||||||
|
|
||||||
lv_obj_t * obj = lv_obj_create(par);
|
lv_obj_t * obj = lv_obj_create(par);
|
||||||
lv_obj_add_style(obj, &ui->obj_def_style, 0);
|
lv_obj_add_style(obj, &ui->obj_def_style, 0);
|
||||||
|
|||||||
@@ -1110,7 +1110,7 @@ static void color_changer_anim_cb(void * var, int32_t v)
|
|||||||
if(v > LV_OPA_COVER) v = LV_OPA_COVER;
|
if(v > LV_OPA_COVER) v = LV_OPA_COVER;
|
||||||
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for(i = 0; i < lv_obj_get_child_cnt(obj); i++) {
|
for(i = 0; i < lv_obj_get_child_count(obj); i++) {
|
||||||
lv_obj_set_style_opa(lv_obj_get_child(obj, i), v, 0);
|
lv_obj_set_style_opa(lv_obj_get_child(obj, i), v, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ The children can be iterated like this:
|
|||||||
.. code:: c
|
.. code:: c
|
||||||
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for(i = 0; i < lv_obj_get_child_cnt(parent); i++) {
|
for(i = 0; i < lv_obj_get_child_count(parent); i++) {
|
||||||
lv_obj_t * child = lv_obj_get_child(parent, i);
|
lv_obj_t * child = lv_obj_get_child(parent, i);
|
||||||
/*Do something with child*/
|
/*Do something with child*/
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,10 +48,10 @@ the last (or most recent) child.
|
|||||||
Child Count
|
Child Count
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Use the function :cpp:expr:`lv_spangroup_get_child_cnt(spangroup)` to get back
|
Use the function :cpp:expr:`lv_spangroup_get_child_conut(spangroup)` to get back
|
||||||
the number of spans the group is maintaining.
|
the number of spans the group is maintaining.
|
||||||
|
|
||||||
e.g. ``uint32_t size = lv_spangroup_get_child_cnt(spangroup)``
|
e.g. ``uint32_t size = lv_spangroup_get_child_conut(spangroup)``
|
||||||
|
|
||||||
Text align
|
Text align
|
||||||
----------
|
----------
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ Rows and Columns
|
|||||||
----------------
|
----------------
|
||||||
|
|
||||||
To explicitly set number of rows and columns use
|
To explicitly set number of rows and columns use
|
||||||
:cpp:expr:`lv_table_set_row_cnt(table, row_cnt)` and
|
:cpp:expr:`lv_table_set_row_count(table, row_cnt)` and
|
||||||
:cpp:expr:`lv_table_set_col_cnt(table, col_cnt)`
|
:cpp:expr:`lv_table_set_col_count(table, col_cnt)`
|
||||||
|
|
||||||
Width and Height
|
Width and Height
|
||||||
----------------
|
----------------
|
||||||
|
|||||||
@@ -216,9 +216,9 @@ int pika_lvgl_dropdown_get_dir(PikaObj *self){
|
|||||||
// lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
// lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||||
// return obj_getObj(lv_dropdown_get_list(lv_obj));
|
// return obj_getObj(lv_dropdown_get_list(lv_obj));
|
||||||
// }
|
// }
|
||||||
int pika_lvgl_dropdown_get_option_cnt(PikaObj *self){
|
int pika_lvgl_dropdown_get_option_count(PikaObj *self){
|
||||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||||
return lv_dropdown_get_option_cnt(lv_obj);
|
return lv_dropdown_get_option_count(lv_obj);
|
||||||
}
|
}
|
||||||
int pika_lvgl_dropdown_get_option_index(PikaObj *self, char* txt){
|
int pika_lvgl_dropdown_get_option_index(PikaObj *self, char* txt){
|
||||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ static void file_explorer_event_handler(lv_event_t * e)
|
|||||||
}
|
}
|
||||||
else if(code == LV_EVENT_READY) {
|
else if(code == LV_EVENT_READY) {
|
||||||
lv_obj_t * tb = lv_file_explorer_get_file_table(obj);
|
lv_obj_t * tb = lv_file_explorer_get_file_table(obj);
|
||||||
uint16_t sum = lv_table_get_row_cnt(tb);
|
uint16_t sum = lv_table_get_row_count(tb);
|
||||||
|
|
||||||
sort_by_file_kind(tb, 0, (sum - 1));
|
sort_by_file_kind(tb, 0, (sum - 1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ def file_explorer_event_handler(e) :
|
|||||||
|
|
||||||
elif code == lv.EVENT.READY :
|
elif code == lv.EVENT.READY :
|
||||||
tb = obj.explorer_get_file_table()
|
tb = obj.explorer_get_file_table()
|
||||||
sum = tb.get_row_cnt()
|
sum = tb.get_row_count()
|
||||||
# print("sum: ",sum)
|
# print("sum: ",sum)
|
||||||
sort_by_file_kind(tb, 0, (sum - 1));
|
sort_by_file_kind(tb, 0, (sum - 1));
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ static void cont_observer_cb(lv_subject_t * subject, lv_observer_t * observer)
|
|||||||
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t delay = 0;
|
uint32_t delay = 0;
|
||||||
uint32_t child_cnt_prev = lv_obj_get_child_cnt(cont);
|
uint32_t child_cnt_prev = lv_obj_get_child_count(cont);
|
||||||
for(i = 0; i < child_cnt_prev; i++) {
|
for(i = 0; i < child_cnt_prev; i++) {
|
||||||
lv_obj_t * child = lv_obj_get_child(cont, i);
|
lv_obj_t * child = lv_obj_get_child(cont, i);
|
||||||
lv_anim_set_var(&a, child);
|
lv_anim_set_var(&a, child);
|
||||||
@@ -132,7 +132,7 @@ static void cont_observer_cb(lv_subject_t * subject, lv_observer_t * observer)
|
|||||||
|
|
||||||
/*Animate in the new widgets*/
|
/*Animate in the new widgets*/
|
||||||
lv_anim_set_ready_cb(&a, NULL);
|
lv_anim_set_ready_cb(&a, NULL);
|
||||||
for(i = child_cnt_prev; i < lv_obj_get_child_cnt(cont); i++) {
|
for(i = child_cnt_prev; i < lv_obj_get_child_count(cont); i++) {
|
||||||
lv_obj_t * child = lv_obj_get_child(cont, i);
|
lv_obj_t * child = lv_obj_get_child(cont, i);
|
||||||
lv_anim_set_var(&a, child);
|
lv_anim_set_var(&a, child);
|
||||||
if(prev_v < cur_v) {
|
if(prev_v < cur_v) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ static void scroll_event_cb(lv_event_t * e)
|
|||||||
|
|
||||||
int32_t r = lv_obj_get_height(cont) * 7 / 10;
|
int32_t r = lv_obj_get_height(cont) * 7 / 10;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(cont);
|
uint32_t child_cnt = lv_obj_get_child_count(cont);
|
||||||
for(i = 0; i < child_cnt; i++) {
|
for(i = 0; i < child_cnt; i++) {
|
||||||
lv_obj_t * child = lv_obj_get_child(cont, i);
|
lv_obj_t * child = lv_obj_get_child(cont, i);
|
||||||
lv_area_t child_a;
|
lv_area_t child_a;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ def scroll_event_cb(e):
|
|||||||
|
|
||||||
r = cont.get_height() * 7 // 10
|
r = cont.get_height() * 7 // 10
|
||||||
|
|
||||||
child_cnt = cont.get_child_cnt()
|
child_cnt = cont.get_child_conut()
|
||||||
for i in range(child_cnt):
|
for i in range(child_cnt):
|
||||||
child = cont.get_child(i)
|
child = cont.get_child(i)
|
||||||
child_a = lv.area_t()
|
child_a = lv.area_t()
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ static void event_handler(lv_event_t * e)
|
|||||||
}
|
}
|
||||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for(i = 0; i < lv_obj_get_child_cnt(parent); i++) {
|
for(i = 0; i < lv_obj_get_child_count(parent); i++) {
|
||||||
lv_obj_t * child = lv_obj_get_child(parent, i);
|
lv_obj_t * child = lv_obj_get_child(parent, i);
|
||||||
if(child == currentButton) {
|
if(child == currentButton) {
|
||||||
lv_obj_add_state(child, LV_STATE_CHECKED);
|
lv_obj_add_state(child, LV_STATE_CHECKED);
|
||||||
@@ -64,7 +64,7 @@ static void event_handler_center(lv_event_t * e)
|
|||||||
if(currentButton == NULL) return;
|
if(currentButton == NULL) return;
|
||||||
|
|
||||||
lv_obj_t * parent = lv_obj_get_parent(currentButton);
|
lv_obj_t * parent = lv_obj_get_parent(currentButton);
|
||||||
const uint32_t pos = lv_obj_get_child_cnt(parent) / 2;
|
const uint32_t pos = lv_obj_get_child_count(parent) / 2;
|
||||||
|
|
||||||
lv_obj_move_to_index(currentButton, pos);
|
lv_obj_move_to_index(currentButton, pos);
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ static void event_handler_swap(lv_event_t * e)
|
|||||||
const lv_event_code_t code = lv_event_get_code(e);
|
const lv_event_code_t code = lv_event_get_code(e);
|
||||||
// lv_obj_t* obj = lv_event_get_target(e);
|
// lv_obj_t* obj = lv_event_get_target(e);
|
||||||
if((code == LV_EVENT_CLICKED) || (code == LV_EVENT_LONG_PRESSED_REPEAT)) {
|
if((code == LV_EVENT_CLICKED) || (code == LV_EVENT_LONG_PRESSED_REPEAT)) {
|
||||||
uint32_t cnt = lv_obj_get_child_cnt(list1);
|
uint32_t cnt = lv_obj_get_child_count(list1);
|
||||||
for(int i = 0; i < 100; i++)
|
for(int i = 0; i < 100; i++)
|
||||||
if(cnt > 1) {
|
if(cnt > 1) {
|
||||||
lv_obj_t * obj = lv_obj_get_child(list1, rand() % cnt);
|
lv_obj_t * obj = lv_obj_get_child(list1, rand() % cnt);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ def event_handler(e):
|
|||||||
else:
|
else:
|
||||||
currentButton = obj
|
currentButton = obj
|
||||||
parent = obj.get_parent()
|
parent = obj.get_parent()
|
||||||
for i in range( parent.get_child_cnt()):
|
for i in range( parent.get_child_conut()):
|
||||||
child = parent.get_child(i)
|
child = parent.get_child(i)
|
||||||
if child == currentButton:
|
if child == currentButton:
|
||||||
child.add_state(lv.STATE.CHECKED)
|
child.add_state(lv.STATE.CHECKED)
|
||||||
@@ -51,7 +51,7 @@ def event_handler_center(e):
|
|||||||
if currentButton == None:
|
if currentButton == None:
|
||||||
return
|
return
|
||||||
parent = currentButton.get_parent()
|
parent = currentButton.get_parent()
|
||||||
pos = parent.get_child_cnt() // 2
|
pos = parent.get_child_conut() // 2
|
||||||
currentButton.move_to_index(pos)
|
currentButton.move_to_index(pos)
|
||||||
currentButton.scroll_to_view(lv.ANIM.ON)
|
currentButton.scroll_to_view(lv.ANIM.ON)
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ def event_handler_swap(e):
|
|||||||
code = e.get_code()
|
code = e.get_code()
|
||||||
obj = e.get_target_obj()
|
obj = e.get_target_obj()
|
||||||
if code == lv.EVENT.CLICKED:
|
if code == lv.EVENT.CLICKED:
|
||||||
cnt = list1.get_child_cnt()
|
cnt = list1.get_child_conut()
|
||||||
for i in range(100):
|
for i in range(100):
|
||||||
if cnt > 1:
|
if cnt > 1:
|
||||||
obj = list1.get_child(urandom.getrandbits(32) % cnt )
|
obj = list1.get_child(urandom.getrandbits(32) % cnt )
|
||||||
|
|||||||
@@ -71,8 +71,8 @@ void lv_example_table_2(void)
|
|||||||
lv_obj_set_size(table, LV_SIZE_CONTENT, 200);
|
lv_obj_set_size(table, LV_SIZE_CONTENT, 200);
|
||||||
|
|
||||||
lv_table_set_col_width(table, 0, 150);
|
lv_table_set_col_width(table, 0, 150);
|
||||||
lv_table_set_row_cnt(table, ITEM_CNT); /*Not required but avoids a lot of memory reallocation lv_table_set_set_value*/
|
lv_table_set_row_count(table, ITEM_CNT); /*Not required but avoids a lot of memory reallocation lv_table_set_set_value*/
|
||||||
lv_table_set_col_cnt(table, 1);
|
lv_table_set_col_count(table, 1);
|
||||||
|
|
||||||
/*Don't make the cell pressed, we will draw something different in the event*/
|
/*Don't make the cell pressed, we will draw something different in the event*/
|
||||||
lv_obj_remove_style(table, NULL, LV_PART_ITEMS | LV_STATE_PRESSED);
|
lv_obj_remove_style(table, NULL, LV_PART_ITEMS | LV_STATE_PRESSED);
|
||||||
|
|||||||
@@ -587,7 +587,7 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
|||||||
lv_obj_remove_state(obj, LV_STATE_PRESSED);
|
lv_obj_remove_state(obj, LV_STATE_PRESSED);
|
||||||
}
|
}
|
||||||
else if(code == LV_EVENT_STYLE_CHANGED) {
|
else if(code == LV_EVENT_STYLE_CHANGED) {
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
for(uint32_t i = 0; i < child_cnt; i++) {
|
for(uint32_t i = 0; i < child_cnt; i++) {
|
||||||
lv_obj_t * child = obj->spec_attr->children[i];
|
lv_obj_t * child = obj->spec_attr->children[i];
|
||||||
lv_obj_mark_layout_as_dirty(child);
|
lv_obj_mark_layout_as_dirty(child);
|
||||||
@@ -687,7 +687,7 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
for(i = 0; i < child_cnt; i++) {
|
for(i = 0; i < child_cnt; i++) {
|
||||||
lv_obj_t * child = obj->spec_attr->children[i];
|
lv_obj_t * child = obj->spec_attr->children[i];
|
||||||
lv_obj_mark_layout_as_dirty(child);
|
lv_obj_mark_layout_as_dirty(child);
|
||||||
|
|||||||
@@ -745,7 +745,7 @@ void lv_obj_move_to(lv_obj_t * obj, int32_t x, int32_t y)
|
|||||||
void lv_obj_move_children_by(lv_obj_t * obj, int32_t x_diff, int32_t y_diff, bool ignore_floating)
|
void lv_obj_move_children_by(lv_obj_t * obj, int32_t x_diff, int32_t y_diff, bool ignore_floating)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
for(i = 0; i < child_cnt; i++) {
|
for(i = 0; i < child_cnt; i++) {
|
||||||
lv_obj_t * child = obj->spec_attr->children[i];
|
lv_obj_t * child = obj->spec_attr->children[i];
|
||||||
if(ignore_floating && lv_obj_has_flag(child, LV_OBJ_FLAG_FLOATING)) continue;
|
if(ignore_floating && lv_obj_has_flag(child, LV_OBJ_FLAG_FLOATING)) continue;
|
||||||
@@ -955,7 +955,7 @@ static int32_t calc_content_width(lv_obj_t * obj)
|
|||||||
|
|
||||||
int32_t child_res = LV_COORD_MIN;
|
int32_t child_res = LV_COORD_MIN;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
/*With RTL find the left most coordinate*/
|
/*With RTL find the left most coordinate*/
|
||||||
if(lv_obj_get_style_base_dir(obj, LV_PART_MAIN) == LV_BASE_DIR_RTL) {
|
if(lv_obj_get_style_base_dir(obj, LV_PART_MAIN) == LV_BASE_DIR_RTL) {
|
||||||
for(i = 0; i < child_cnt; i++) {
|
for(i = 0; i < child_cnt; i++) {
|
||||||
@@ -1050,7 +1050,7 @@ static int32_t calc_content_height(lv_obj_t * obj)
|
|||||||
|
|
||||||
int32_t child_res = LV_COORD_MIN;
|
int32_t child_res = LV_COORD_MIN;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
for(i = 0; i < child_cnt; i++) {
|
for(i = 0; i < child_cnt; i++) {
|
||||||
int32_t child_res_tmp = LV_COORD_MIN;
|
int32_t child_res_tmp = LV_COORD_MIN;
|
||||||
lv_obj_t * child = obj->spec_attr->children[i];
|
lv_obj_t * child = obj->spec_attr->children[i];
|
||||||
@@ -1092,7 +1092,7 @@ static int32_t calc_content_height(lv_obj_t * obj)
|
|||||||
static void layout_update_core(lv_obj_t * obj)
|
static void layout_update_core(lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
for(i = 0; i < child_cnt; i++) {
|
for(i = 0; i < child_cnt; i++) {
|
||||||
lv_obj_t * child = obj->spec_attr->children[i];
|
lv_obj_t * child = obj->spec_attr->children[i];
|
||||||
layout_update_core(child);
|
layout_update_core(child);
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ int32_t lv_obj_get_scroll_bottom(lv_obj_t * obj)
|
|||||||
|
|
||||||
int32_t child_res = LV_COORD_MIN;
|
int32_t child_res = LV_COORD_MIN;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
for(i = 0; i < child_cnt; i++) {
|
for(i = 0; i < child_cnt; i++) {
|
||||||
lv_obj_t * child = obj->spec_attr->children[i];
|
lv_obj_t * child = obj->spec_attr->children[i];
|
||||||
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
|
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
|
||||||
@@ -178,7 +178,7 @@ int32_t lv_obj_get_scroll_left(lv_obj_t * obj)
|
|||||||
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
int32_t x1 = LV_COORD_MAX;
|
int32_t x1 = LV_COORD_MAX;
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
for(i = 0; i < child_cnt; i++) {
|
for(i = 0; i < child_cnt; i++) {
|
||||||
lv_obj_t * child = obj->spec_attr->children[i];
|
lv_obj_t * child = obj->spec_attr->children[i];
|
||||||
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
|
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
|
||||||
@@ -216,7 +216,7 @@ int32_t lv_obj_get_scroll_right(lv_obj_t * obj)
|
|||||||
/*With other base direction (LTR) scrolling to the right is normal so find the right most coordinate*/
|
/*With other base direction (LTR) scrolling to the right is normal so find the right most coordinate*/
|
||||||
int32_t child_res = LV_COORD_MIN;
|
int32_t child_res = LV_COORD_MIN;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
for(i = 0; i < child_cnt; i++) {
|
for(i = 0; i < child_cnt; i++) {
|
||||||
lv_obj_t * child = obj->spec_attr->children[i];
|
lv_obj_t * child = obj->spec_attr->children[i];
|
||||||
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
|
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
|
||||||
|
|||||||
@@ -852,7 +852,7 @@ static void report_style_change_core(void * style, lv_obj_t * obj)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
for(i = 0; i < child_cnt; i++) {
|
for(i = 0; i < child_cnt; i++) {
|
||||||
report_style_change_core(style, obj->spec_attr->children[i]);
|
report_style_change_core(style, obj->spec_attr->children[i]);
|
||||||
}
|
}
|
||||||
@@ -866,7 +866,7 @@ static void report_style_change_core(void * style, lv_obj_t * obj)
|
|||||||
static void refresh_children_style(lv_obj_t * obj)
|
static void refresh_children_style(lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
for(i = 0; i < child_cnt; i++) {
|
for(i = 0; i < child_cnt; i++) {
|
||||||
lv_obj_t * child = obj->spec_attr->children[i];
|
lv_obj_t * child = obj->spec_attr->children[i];
|
||||||
lv_obj_invalidate(child);
|
lv_obj_invalidate(child);
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent)
|
|||||||
lv_obj_t * old_parent = obj->parent;
|
lv_obj_t * old_parent = obj->parent;
|
||||||
/*Remove the object from the old parent's child list*/
|
/*Remove the object from the old parent's child list*/
|
||||||
int32_t i;
|
int32_t i;
|
||||||
for(i = lv_obj_get_index(obj); i <= (int32_t)lv_obj_get_child_cnt(old_parent) - 2; i++) {
|
for(i = lv_obj_get_index(obj); i <= (int32_t)lv_obj_get_child_count(old_parent) - 2; i++) {
|
||||||
old_parent->spec_attr->children[i] = old_parent->spec_attr->children[i + 1];
|
old_parent->spec_attr->children[i] = old_parent->spec_attr->children[i + 1];
|
||||||
}
|
}
|
||||||
old_parent->spec_attr->child_cnt--;
|
old_parent->spec_attr->child_cnt--;
|
||||||
@@ -178,7 +178,7 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent)
|
|||||||
parent->spec_attr->child_cnt++;
|
parent->spec_attr->child_cnt++;
|
||||||
parent->spec_attr->children = lv_realloc(parent->spec_attr->children,
|
parent->spec_attr->children = lv_realloc(parent->spec_attr->children,
|
||||||
parent->spec_attr->child_cnt * (sizeof(lv_obj_t *)));
|
parent->spec_attr->child_cnt * (sizeof(lv_obj_t *)));
|
||||||
parent->spec_attr->children[lv_obj_get_child_cnt(parent) - 1] = obj;
|
parent->spec_attr->children[lv_obj_get_child_count(parent) - 1] = obj;
|
||||||
|
|
||||||
obj->parent = parent;
|
obj->parent = parent;
|
||||||
|
|
||||||
@@ -209,13 +209,13 @@ void lv_obj_move_to_index(lv_obj_t * obj, int32_t index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(index < 0) {
|
if(index < 0) {
|
||||||
index = lv_obj_get_child_cnt(parent) + index;
|
index = lv_obj_get_child_count(parent) + index;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int32_t old_index = lv_obj_get_index(obj);
|
const int32_t old_index = lv_obj_get_index(obj);
|
||||||
|
|
||||||
if(index < 0) return;
|
if(index < 0) return;
|
||||||
if(index >= (int32_t) lv_obj_get_child_cnt(parent)) return;
|
if(index >= (int32_t) lv_obj_get_child_count(parent)) return;
|
||||||
if(index == old_index) return;
|
if(index == old_index) return;
|
||||||
|
|
||||||
int32_t i = old_index;
|
int32_t i = old_index;
|
||||||
@@ -383,7 +383,7 @@ lv_obj_t * lv_obj_get_sibling_by_type(const lv_obj_t * obj, int32_t idx, const l
|
|||||||
return lv_obj_get_child(parent, sibling_idx);
|
return lv_obj_get_child(parent, sibling_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t lv_obj_get_child_cnt(const lv_obj_t * obj)
|
uint32_t lv_obj_get_child_count(const lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||||
if(obj->spec_attr == NULL) return 0;
|
if(obj->spec_attr == NULL) return 0;
|
||||||
@@ -580,7 +580,7 @@ static lv_obj_tree_walk_res_t walk_core(lv_obj_t * obj, lv_obj_tree_walk_cb_t cb
|
|||||||
|
|
||||||
if(res != LV_OBJ_TREE_WALK_SKIP_CHILDREN) {
|
if(res != LV_OBJ_TREE_WALK_SKIP_CHILDREN) {
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for(i = 0; i < lv_obj_get_child_cnt(obj); i++) {
|
for(i = 0; i < lv_obj_get_child_count(obj); i++) {
|
||||||
res = walk_core(lv_obj_get_child(obj, i), cb, user_data);
|
res = walk_core(lv_obj_get_child(obj, i), cb, user_data);
|
||||||
if(res == LV_OBJ_TREE_WALK_END) return LV_OBJ_TREE_WALK_END;
|
if(res == LV_OBJ_TREE_WALK_END) return LV_OBJ_TREE_WALK_END;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,6 @@ struct _lv_obj_t * lv_obj_get_parent(const struct _lv_obj_t * obj);
|
|||||||
*/
|
*/
|
||||||
struct _lv_obj_t * lv_obj_get_child(const struct _lv_obj_t * obj, int32_t idx);
|
struct _lv_obj_t * lv_obj_get_child(const struct _lv_obj_t * obj, int32_t idx);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the child of an object by the child's index. Consider the children only with a given type.
|
* Get the child of an object by the child's index. Consider the children only with a given type.
|
||||||
* @param obj pointer to an object whose child should be get
|
* @param obj pointer to an object whose child should be get
|
||||||
@@ -188,7 +187,7 @@ struct _lv_obj_t * lv_obj_get_sibling_by_type(const struct _lv_obj_t * obj, int3
|
|||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @return the number of children
|
* @return the number of children
|
||||||
*/
|
*/
|
||||||
uint32_t lv_obj_get_child_cnt(const struct _lv_obj_t * obj);
|
uint32_t lv_obj_get_child_count(const struct _lv_obj_t * obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of children having a given type.
|
* Get the number of children having a given type.
|
||||||
@@ -208,7 +207,6 @@ uint32_t lv_obj_get_child_count_by_type(const struct _lv_obj_t * obj, const stru
|
|||||||
*/
|
*/
|
||||||
int32_t lv_obj_get_index(const struct _lv_obj_t * obj);
|
int32_t lv_obj_get_index(const struct _lv_obj_t * obj);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the index of a child. Consider the children only with a given type.
|
* Get the index of a child. Consider the children only with a given type.
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj)
|
|||||||
|
|
||||||
if(refr_children) {
|
if(refr_children) {
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
if(child_cnt == 0) {
|
if(child_cnt == 0) {
|
||||||
/*If the object was visible on the clip area call the post draw events too*/
|
/*If the object was visible on the clip area call the post draw events too*/
|
||||||
layer->clip_area = clip_coords_for_obj;
|
layer->clip_area = clip_coords_for_obj;
|
||||||
@@ -731,7 +731,7 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
|
|||||||
if(info.res == LV_COVER_RES_MASKED) return NULL;
|
if(info.res == LV_COVER_RES_MASKED) return NULL;
|
||||||
|
|
||||||
int32_t i;
|
int32_t i;
|
||||||
int32_t child_cnt = lv_obj_get_child_cnt(obj);
|
int32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
for(i = child_cnt - 1; i >= 0; i--) {
|
for(i = child_cnt - 1; i >= 0; i--) {
|
||||||
lv_obj_t * child = obj->spec_attr->children[i];
|
lv_obj_t * child = obj->spec_attr->children[i];
|
||||||
found_p = lv_refr_get_top_obj(area_p, child);
|
found_p = lv_refr_get_top_obj(area_p, child);
|
||||||
@@ -776,7 +776,7 @@ static void refr_obj_and_children(lv_layer_t * layer, lv_obj_t * top_obj)
|
|||||||
while(parent != NULL) {
|
while(parent != NULL) {
|
||||||
bool go = false;
|
bool go = false;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(parent);
|
uint32_t child_cnt = lv_obj_get_child_count(parent);
|
||||||
for(i = 0; i < child_cnt; i++) {
|
for(i = 0; i < child_cnt; i++) {
|
||||||
lv_obj_t * child = parent->spec_attr->children[i];
|
lv_obj_t * child = parent->spec_attr->children[i];
|
||||||
if(!go) {
|
if(!go) {
|
||||||
|
|||||||
@@ -748,9 +748,9 @@ void lv_display_set_theme(lv_display_t * disp, lv_theme_t * th)
|
|||||||
disp->theme = th;
|
disp->theme = th;
|
||||||
|
|
||||||
if(disp->screen_cnt == 4 &&
|
if(disp->screen_cnt == 4 &&
|
||||||
lv_obj_get_child_cnt(disp->screens[0]) == 0 &&
|
lv_obj_get_child_count(disp->screens[0]) == 0 &&
|
||||||
lv_obj_get_child_cnt(disp->screens[1]) == 0 &&
|
lv_obj_get_child_count(disp->screens[1]) == 0 &&
|
||||||
lv_obj_get_child_cnt(disp->screens[2]) == 0) {
|
lv_obj_get_child_count(disp->screens[2]) == 0) {
|
||||||
lv_theme_apply(disp->screens[0]);
|
lv_theme_apply(disp->screens[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point)
|
|||||||
}
|
}
|
||||||
if(_lv_area_is_point_on(&obj_coords, &p_trans, 0)) {
|
if(_lv_area_is_point_on(&obj_coords, &p_trans, 0)) {
|
||||||
int32_t i;
|
int32_t i;
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
|
|
||||||
/*If a child matches use it*/
|
/*If a child matches use it*/
|
||||||
for(i = child_cnt - 1; i >= 0; i--) {
|
for(i = child_cnt - 1; i >= 0; i--) {
|
||||||
|
|||||||
@@ -477,7 +477,7 @@ static int32_t find_snap_point_x(const lv_obj_t * obj, int32_t min, int32_t max,
|
|||||||
int32_t pad_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN);
|
int32_t pad_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN);
|
||||||
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
for(i = 0; i < child_cnt; i++) {
|
for(i = 0; i < child_cnt; i++) {
|
||||||
lv_obj_t * child = obj->spec_attr->children[i];
|
lv_obj_t * child = obj->spec_attr->children[i];
|
||||||
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
|
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
|
||||||
@@ -532,7 +532,7 @@ static int32_t find_snap_point_y(const lv_obj_t * obj, int32_t min, int32_t max,
|
|||||||
int32_t pad_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN);
|
int32_t pad_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN);
|
||||||
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
for(i = 0; i < child_cnt; i++) {
|
for(i = 0; i < child_cnt; i++) {
|
||||||
lv_obj_t * child = obj->spec_attr->children[i];
|
lv_obj_t * child = obj->spec_attr->children[i];
|
||||||
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
|
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c)
|
|||||||
if(IS_CONTENT(col_templ[i])) {
|
if(IS_CONTENT(col_templ[i])) {
|
||||||
/*Check the size of children of this cell*/
|
/*Check the size of children of this cell*/
|
||||||
uint32_t ci;
|
uint32_t ci;
|
||||||
for(ci = 0; ci < lv_obj_get_child_cnt(cont); ci++) {
|
for(ci = 0; ci < lv_obj_get_child_count(cont); ci++) {
|
||||||
lv_obj_t * item = lv_obj_get_child(cont, ci);
|
lv_obj_t * item = lv_obj_get_child(cont, ci);
|
||||||
if(lv_obj_has_flag_any(item, LV_OBJ_FLAG_IGNORE_LAYOUT | LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
|
if(lv_obj_has_flag_any(item, LV_OBJ_FLAG_IGNORE_LAYOUT | LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
|
||||||
uint32_t col_span = get_col_span(item);
|
uint32_t col_span = get_col_span(item);
|
||||||
@@ -392,7 +392,7 @@ static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c)
|
|||||||
if(IS_CONTENT(row_templ[i])) {
|
if(IS_CONTENT(row_templ[i])) {
|
||||||
/*Check the size of children of this cell*/
|
/*Check the size of children of this cell*/
|
||||||
uint32_t ci;
|
uint32_t ci;
|
||||||
for(ci = 0; ci < lv_obj_get_child_cnt(cont); ci++) {
|
for(ci = 0; ci < lv_obj_get_child_count(cont); ci++) {
|
||||||
lv_obj_t * item = lv_obj_get_child(cont, ci);
|
lv_obj_t * item = lv_obj_get_child(cont, ci);
|
||||||
if(lv_obj_has_flag_any(item, LV_OBJ_FLAG_IGNORE_LAYOUT | LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
|
if(lv_obj_has_flag_any(item, LV_OBJ_FLAG_IGNORE_LAYOUT | LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
|
||||||
uint32_t row_span = get_row_span(item);
|
uint32_t row_span = get_row_span(item);
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ static inline void lv_obj_move_foreground(lv_obj_t * obj)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_obj_move_to_index(obj, lv_obj_get_child_cnt(parent) - 1);
|
lv_obj_move_to_index(obj, lv_obj_get_child_count(parent) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -219,6 +219,18 @@ static inline void lv_obj_move_background(lv_obj_t * obj)
|
|||||||
#define lv_image_set_zoom lv_image_set_scale
|
#define lv_image_set_zoom lv_image_set_scale
|
||||||
#define lv_image_get_zoom lv_image_get_scale
|
#define lv_image_get_zoom lv_image_get_scale
|
||||||
|
|
||||||
|
#define lv_roller_set_visible_row_cnt lv_roller_set_visible_row_count
|
||||||
|
#define lv_roller_get_option_cnt lv_roller_get_option_count
|
||||||
|
|
||||||
|
#define lv_table_set_col_cnt lv_table_set_col_count
|
||||||
|
#define lv_table_set_row_cnt lv_table_set_row_count
|
||||||
|
#define lv_table_get_row_cnt lv_table_get_row_count
|
||||||
|
#define lv_table_get_row_cnt lv_table_get_row_count
|
||||||
|
|
||||||
|
#define lv_dropdown_get_option_cnt lv_dropdown_get_option_count
|
||||||
|
|
||||||
|
#define lv_obj_get_child_cnt lv_obj_get_child_count
|
||||||
|
|
||||||
#define lv_obj_get_style_shadow_ofs_x lv_obj_get_style_shadow_offset_x
|
#define lv_obj_get_style_shadow_ofs_x lv_obj_get_style_shadow_offset_x
|
||||||
#define lv_obj_get_style_shadow_ofs_y lv_obj_get_style_shadow_offset_y
|
#define lv_obj_get_style_shadow_ofs_y lv_obj_get_style_shadow_offset_y
|
||||||
#define lv_obj_get_style_transform_zoom lv_obj_get_style_transform_scale
|
#define lv_obj_get_style_transform_zoom lv_obj_get_style_transform_scale
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ char * _lv_text_set_text_vfmt(const char * fmt, va_list ap)
|
|||||||
lv_vsnprintf(raw_txt, len + 1, fmt, ap);
|
lv_vsnprintf(raw_txt, len + 1, fmt, ap);
|
||||||
|
|
||||||
/*Get the size of the Arabic text and process it*/
|
/*Get the size of the Arabic text and process it*/
|
||||||
size_t len_ap = _lv_text_ap_calc_bytes_cnt(raw_txt);
|
size_t len_ap = _lv_text_ap_calc_bytes_count(raw_txt);
|
||||||
text = lv_malloc(len_ap + 1);
|
text = lv_malloc(len_ap + 1);
|
||||||
LV_ASSERT_MALLOC(text);
|
LV_ASSERT_MALLOC(text);
|
||||||
if(text == NULL) {
|
if(text == NULL) {
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ const ap_chars_map_t ap_chars_map[] = {
|
|||||||
/**********************
|
/**********************
|
||||||
* GLOBAL FUNCTIONS
|
* GLOBAL FUNCTIONS
|
||||||
**********************/
|
**********************/
|
||||||
uint32_t _lv_text_ap_calc_bytes_cnt(const char * txt)
|
uint32_t _lv_text_ap_calc_bytes_count(const char * txt)
|
||||||
{
|
{
|
||||||
uint32_t txt_length = 0;
|
uint32_t txt_length = 0;
|
||||||
uint32_t chars_cnt = 0;
|
uint32_t chars_cnt = 0;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ extern "C" {
|
|||||||
/**********************
|
/**********************
|
||||||
* GLOBAL PROTOTYPES
|
* GLOBAL PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
uint32_t _lv_text_ap_calc_bytes_cnt(const char * txt);
|
uint32_t _lv_text_ap_calc_bytes_count(const char * txt);
|
||||||
void _lv_text_ap_proc(const char * txt, char * txt_out);
|
void _lv_text_ap_proc(const char * txt, char * txt_out);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ static void lv_file_explorer_constructor(const lv_obj_class_t * class_p, lv_obj_
|
|||||||
explorer->file_table = lv_table_create(explorer->browser_area);
|
explorer->file_table = lv_table_create(explorer->browser_area);
|
||||||
lv_obj_set_size(explorer->file_table, LV_PCT(100), LV_PCT(86));
|
lv_obj_set_size(explorer->file_table, LV_PCT(100), LV_PCT(86));
|
||||||
lv_table_set_col_width(explorer->file_table, 0, LV_PCT(100));
|
lv_table_set_col_width(explorer->file_table, 0, LV_PCT(100));
|
||||||
lv_table_set_col_cnt(explorer->file_table, 1);
|
lv_table_set_col_count(explorer->file_table, 1);
|
||||||
lv_obj_add_event(explorer->file_table, browser_file_event_handler, LV_EVENT_ALL, obj);
|
lv_obj_add_event(explorer->file_table, browser_file_event_handler, LV_EVENT_ALL, obj);
|
||||||
|
|
||||||
/*only scroll up and down*/
|
/*only scroll up and down*/
|
||||||
@@ -401,10 +401,10 @@ static void init_style(lv_obj_t * obj)
|
|||||||
lv_style_set_bg_color(&quick_access_list_button_style, lv_color_hex(0xf2f1f6));
|
lv_style_set_bg_color(&quick_access_list_button_style, lv_color_hex(0xf2f1f6));
|
||||||
|
|
||||||
uint32_t i, j;
|
uint32_t i, j;
|
||||||
for(i = 0; i < lv_obj_get_child_cnt(explorer->quick_access_area); i++) {
|
for(i = 0; i < lv_obj_get_child_count(explorer->quick_access_area); i++) {
|
||||||
lv_obj_t * child = lv_obj_get_child(explorer->quick_access_area, i);
|
lv_obj_t * child = lv_obj_get_child(explorer->quick_access_area, i);
|
||||||
if(lv_obj_check_type(child, &lv_list_class)) {
|
if(lv_obj_check_type(child, &lv_list_class)) {
|
||||||
for(j = 0; j < lv_obj_get_child_cnt(child); j++) {
|
for(j = 0; j < lv_obj_get_child_count(child); j++) {
|
||||||
lv_obj_t * list_child = lv_obj_get_child(child, j);
|
lv_obj_t * list_child = lv_obj_get_child(child, j);
|
||||||
if(lv_obj_check_type(list_child, &lv_list_button_class)) {
|
if(lv_obj_check_type(list_child, &lv_list_button_class)) {
|
||||||
lv_obj_add_style(list_child, &quick_access_list_button_style, 0);
|
lv_obj_add_style(list_child, &quick_access_list_button_style, 0);
|
||||||
@@ -589,7 +589,7 @@ static void show_dir(lv_obj_t * obj, const char * path)
|
|||||||
|
|
||||||
lv_fs_dir_close(&dir);
|
lv_fs_dir_close(&dir);
|
||||||
|
|
||||||
lv_table_set_row_cnt(explorer->file_table, index);
|
lv_table_set_row_count(explorer->file_table, index);
|
||||||
file_explorer_sort(obj);
|
file_explorer_sort(obj);
|
||||||
lv_obj_send_event(obj, LV_EVENT_READY, NULL);
|
lv_obj_send_event(obj, LV_EVENT_READY, NULL);
|
||||||
|
|
||||||
@@ -643,7 +643,7 @@ static void file_explorer_sort(lv_obj_t * obj)
|
|||||||
|
|
||||||
lv_file_explorer_t * explorer = (lv_file_explorer_t *)obj;
|
lv_file_explorer_t * explorer = (lv_file_explorer_t *)obj;
|
||||||
|
|
||||||
uint16_t sum = lv_table_get_row_cnt(explorer->file_table);
|
uint16_t sum = lv_table_get_row_count(explorer->file_table);
|
||||||
|
|
||||||
if(sum > 1) {
|
if(sum > 1) {
|
||||||
switch(explorer->sort) {
|
switch(explorer->sort) {
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ static void gridnav_event_cb(lv_event_t * e)
|
|||||||
lv_event_code_t code = lv_event_get_code(e);
|
lv_event_code_t code = lv_event_get_code(e);
|
||||||
|
|
||||||
if(code == LV_EVENT_KEY) {
|
if(code == LV_EVENT_KEY) {
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
if(child_cnt == 0) return;
|
if(child_cnt == 0) return;
|
||||||
|
|
||||||
if(dsc->focused_obj == NULL) dsc->focused_obj = find_first_focusable(obj);
|
if(dsc->focused_obj == NULL) dsc->focused_obj = find_first_focusable(obj);
|
||||||
@@ -291,7 +291,7 @@ static lv_obj_t * find_chid(lv_obj_t * obj, lv_obj_t * start_child, find_mode_t
|
|||||||
{
|
{
|
||||||
int32_t x_start = get_x_center(start_child);
|
int32_t x_start = get_x_center(start_child);
|
||||||
int32_t y_start = get_y_center(start_child);
|
int32_t y_start = get_y_center(start_child);
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
lv_obj_t * guess = NULL;
|
lv_obj_t * guess = NULL;
|
||||||
int32_t x_err_guess = LV_COORD_MAX;
|
int32_t x_err_guess = LV_COORD_MAX;
|
||||||
int32_t y_err_guess = LV_COORD_MAX;
|
int32_t y_err_guess = LV_COORD_MAX;
|
||||||
@@ -359,7 +359,7 @@ static lv_obj_t * find_chid(lv_obj_t * obj, lv_obj_t * start_child, find_mode_t
|
|||||||
|
|
||||||
static lv_obj_t * find_first_focusable(lv_obj_t * obj)
|
static lv_obj_t * find_first_focusable(lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for(i = 0; i < child_cnt; i++) {
|
for(i = 0; i < child_cnt; i++) {
|
||||||
lv_obj_t * child = lv_obj_get_child(obj, i);
|
lv_obj_t * child = lv_obj_get_child(obj, i);
|
||||||
@@ -371,7 +371,7 @@ static lv_obj_t * find_first_focusable(lv_obj_t * obj)
|
|||||||
|
|
||||||
static lv_obj_t * find_last_focusable(lv_obj_t * obj)
|
static lv_obj_t * find_last_focusable(lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
int32_t i;
|
int32_t i;
|
||||||
for(i = child_cnt - 1; i >= 0; i--) {
|
for(i = child_cnt - 1; i >= 0; i--) {
|
||||||
lv_obj_t * child = lv_obj_get_child(obj, i);
|
lv_obj_t * child = lv_obj_get_child(obj, i);
|
||||||
|
|||||||
@@ -775,7 +775,7 @@ static void draw_main(lv_event_t * e)
|
|||||||
|
|
||||||
#if LV_USE_ARABIC_PERSIAN_CHARS
|
#if LV_USE_ARABIC_PERSIAN_CHARS
|
||||||
/*Get the size of the Arabic text and process it*/
|
/*Get the size of the Arabic text and process it*/
|
||||||
size_t len_ap = _lv_text_ap_calc_bytes_cnt(txt);
|
size_t len_ap = _lv_text_ap_calc_bytes_count(txt);
|
||||||
if(len_ap < sizeof(txt_ap)) {
|
if(len_ap < sizeof(txt_ap)) {
|
||||||
_lv_text_ap_proc(txt, txt_ap);
|
_lv_text_ap_proc(txt, txt_ap);
|
||||||
txt = txt_ap;
|
txt = txt_ap;
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ void lv_calendar_set_showed_date(lv_obj_t * obj, uint32_t year, uint32_t month)
|
|||||||
|
|
||||||
/* The children of the calendar are probably headers.
|
/* The children of the calendar are probably headers.
|
||||||
* Notify them to let the headers updated to the new date*/
|
* Notify them to let the headers updated to the new date*/
|
||||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
uint32_t child_cnt = lv_obj_get_child_count(obj);
|
||||||
for(i = 0; i < child_cnt; i++) {
|
for(i = 0; i < child_cnt; i++) {
|
||||||
lv_obj_t * child = lv_obj_get_child(obj, i);
|
lv_obj_t * child = lv_obj_get_child(obj, i);
|
||||||
if(child == calendar->btnm) continue;
|
if(child == calendar->btnm) continue;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ void lv_checkbox_set_text(lv_obj_t * obj, const char * txt)
|
|||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
#if LV_USE_ARABIC_PERSIAN_CHARS
|
#if LV_USE_ARABIC_PERSIAN_CHARS
|
||||||
len = _lv_text_ap_calc_bytes_cnt(txt) + 1;
|
len = _lv_text_ap_calc_bytes_count(txt) + 1;
|
||||||
#else
|
#else
|
||||||
len = lv_strlen(txt) + 1;
|
len = lv_strlen(txt) + 1;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ void lv_dropdown_set_options(lv_obj_t * obj, const char * options)
|
|||||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 0
|
#if LV_USE_ARABIC_PERSIAN_CHARS == 0
|
||||||
size_t len = lv_strlen(options) + 1;
|
size_t len = lv_strlen(options) + 1;
|
||||||
#else
|
#else
|
||||||
size_t len = _lv_text_ap_calc_bytes_cnt(options) + 1;
|
size_t len = _lv_text_ap_calc_bytes_count(options) + 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(dropdown->options != NULL && dropdown->static_txt == 0) {
|
if(dropdown->options != NULL && dropdown->static_txt == 0) {
|
||||||
@@ -211,7 +211,7 @@ void lv_dropdown_add_option(lv_obj_t * obj, const char * option, uint32_t pos)
|
|||||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 0
|
#if LV_USE_ARABIC_PERSIAN_CHARS == 0
|
||||||
size_t ins_len = lv_strlen(option) + 1;
|
size_t ins_len = lv_strlen(option) + 1;
|
||||||
#else
|
#else
|
||||||
size_t ins_len = _lv_text_ap_calc_bytes_cnt(option) + 1;
|
size_t ins_len = _lv_text_ap_calc_bytes_count(option) + 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
size_t new_len = ins_len + old_len + 2; /*+2 for terminating NULL and possible \n*/
|
size_t new_len = ins_len + old_len + 2; /*+2 for terminating NULL and possible \n*/
|
||||||
@@ -358,7 +358,7 @@ uint32_t lv_dropdown_get_selected(const lv_obj_t * obj)
|
|||||||
return dropdown->sel_opt_id;
|
return dropdown->sel_opt_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t lv_dropdown_get_option_cnt(const lv_obj_t * obj)
|
uint32_t lv_dropdown_get_option_count(const lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||||
|
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ uint32_t lv_dropdown_get_selected(const lv_obj_t * obj);
|
|||||||
* @param obj pointer to drop-down list object
|
* @param obj pointer to drop-down list object
|
||||||
* @return the total number of options in the list
|
* @return the total number of options in the list
|
||||||
*/
|
*/
|
||||||
uint32_t lv_dropdown_get_option_cnt(const lv_obj_t * obj);
|
uint32_t lv_dropdown_get_option_count(const lv_obj_t * obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current selected option as a string
|
* Get the current selected option as a string
|
||||||
|
|||||||
@@ -1221,7 +1221,7 @@ static size_t get_text_length(const char * text)
|
|||||||
{
|
{
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
#if LV_USE_ARABIC_PERSIAN_CHARS
|
#if LV_USE_ARABIC_PERSIAN_CHARS
|
||||||
len = _lv_text_ap_calc_bytes_cnt(text);
|
len = _lv_text_ap_calc_bytes_count(text);
|
||||||
#else
|
#else
|
||||||
len = lv_strlen(text) + 1;
|
len = lv_strlen(text) + 1;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ const char * lv_list_get_button_text(lv_obj_t * list, lv_obj_t * btn)
|
|||||||
{
|
{
|
||||||
LV_UNUSED(list);
|
LV_UNUSED(list);
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for(i = 0; i < lv_obj_get_child_cnt(btn); i++) {
|
for(i = 0; i < lv_obj_get_child_count(btn); i++) {
|
||||||
lv_obj_t * child = lv_obj_get_child(btn, i);
|
lv_obj_t * child = lv_obj_get_child(btn, i);
|
||||||
if(lv_obj_check_type(child, &lv_label_class)) {
|
if(lv_obj_check_type(child, &lv_label_class)) {
|
||||||
return lv_label_get_text(child);
|
return lv_label_get_text(child);
|
||||||
@@ -117,7 +117,7 @@ void lv_list_set_button_text(lv_obj_t * list, lv_obj_t * btn, const char * txt)
|
|||||||
{
|
{
|
||||||
LV_UNUSED(list);
|
LV_UNUSED(list);
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for(i = 0; i < lv_obj_get_child_cnt(btn); i++) {
|
for(i = 0; i < lv_obj_get_child_count(btn); i++) {
|
||||||
lv_obj_t * child = lv_obj_get_child(btn, i);
|
lv_obj_t * child = lv_obj_get_child(btn, i);
|
||||||
if(lv_obj_check_type(child, &lv_label_class)) {
|
if(lv_obj_check_type(child, &lv_label_class)) {
|
||||||
lv_label_set_text(child, txt);
|
lv_label_set_text(child, txt);
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ const char * lv_roller_get_options(const lv_obj_t * obj)
|
|||||||
* @param roller pointer to a roller object
|
* @param roller pointer to a roller object
|
||||||
* @return the total number of options
|
* @return the total number of options
|
||||||
*/
|
*/
|
||||||
uint32_t lv_roller_get_option_cnt(const lv_obj_t * obj)
|
uint32_t lv_roller_get_option_count(const lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ const char * lv_roller_get_options(const lv_obj_t * obj);
|
|||||||
* @param obj pointer to a roller object
|
* @param obj pointer to a roller object
|
||||||
* @return the total number of options
|
* @return the total number of options
|
||||||
*/
|
*/
|
||||||
uint32_t lv_roller_get_option_cnt(const lv_obj_t * obj);
|
uint32_t lv_roller_get_option_count(const lv_obj_t * obj);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ static bool lv_text_get_snippet(const char * txt, const lv_font_t * font, int32_
|
|||||||
uint32_t * end_ofs);
|
uint32_t * end_ofs);
|
||||||
|
|
||||||
static void lv_snippet_clear(void);
|
static void lv_snippet_clear(void);
|
||||||
static uint32_t lv_get_snippet_cnt(void);
|
static uint32_t lv_get_snippet_count(void);
|
||||||
static void lv_snippet_push(lv_snippet_t * item);
|
static void lv_snippet_push(lv_snippet_t * item);
|
||||||
static lv_snippet_t * lv_get_snippet(uint32_t index);
|
static lv_snippet_t * lv_get_snippet(uint32_t index);
|
||||||
static int32_t convert_indent_pct(lv_obj_t * spans, int32_t width);
|
static int32_t convert_indent_pct(lv_obj_t * spans, int32_t width);
|
||||||
@@ -286,7 +286,7 @@ lv_span_t * lv_spangroup_get_child(const lv_obj_t * obj, int32_t id)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t lv_spangroup_get_child_cnt(const lv_obj_t * obj)
|
uint32_t lv_spangroup_get_child_conut(const lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||||
|
|
||||||
@@ -665,7 +665,7 @@ static void lv_snippet_push(lv_snippet_t * item)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t lv_get_snippet_cnt(void)
|
static uint32_t lv_get_snippet_count(void)
|
||||||
{
|
{
|
||||||
return snippet_stack->index;
|
return snippet_stack->index;
|
||||||
}
|
}
|
||||||
@@ -870,9 +870,9 @@ static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer)
|
|||||||
max_w, txt_flag, &use_width, &next_ofs);
|
max_w, txt_flag, &use_width, &next_ofs);
|
||||||
|
|
||||||
if(isfill) {
|
if(isfill) {
|
||||||
if(next_ofs > 0 && lv_get_snippet_cnt() > 0) {
|
if(next_ofs > 0 && lv_get_snippet_count() > 0) {
|
||||||
/* To prevent infinite loops, the _lv_text_get_next_line() may return incomplete words, */
|
/* To prevent infinite loops, the _lv_text_get_next_line() may return incomplete words, */
|
||||||
/* This phenomenon should be avoided when lv_get_snippet_cnt() > 0 */
|
/* This phenomenon should be avoided when lv_get_snippet_count() > 0 */
|
||||||
if(max_w < use_width) {
|
if(max_w < use_width) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -906,7 +906,7 @@ static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer)
|
|||||||
|
|
||||||
/* start current line deal with */
|
/* start current line deal with */
|
||||||
|
|
||||||
uint32_t item_cnt = lv_get_snippet_cnt();
|
uint32_t item_cnt = lv_get_snippet_count();
|
||||||
if(item_cnt == 0) { /* break if stack is empty */
|
if(item_cnt == 0) { /* break if stack is empty */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ lv_span_t * lv_spangroup_get_child(const lv_obj_t * obj, int32_t id);
|
|||||||
* @param obj The spangroup object to get the child count of.
|
* @param obj The spangroup object to get the child count of.
|
||||||
* @return The span count of the spangroup.
|
* @return The span count of the spangroup.
|
||||||
*/
|
*/
|
||||||
uint32_t lv_spangroup_get_child_cnt(const lv_obj_t * obj);
|
uint32_t lv_spangroup_get_child_conut(const lv_obj_t * obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the align of the spangroup.
|
* get the align of the spangroup.
|
||||||
|
|||||||
@@ -93,8 +93,8 @@ void lv_table_set_cell_value(lv_obj_t * obj, uint32_t row, uint32_t col, const c
|
|||||||
lv_table_t * table = (lv_table_t *)obj;
|
lv_table_t * table = (lv_table_t *)obj;
|
||||||
|
|
||||||
/*Auto expand*/
|
/*Auto expand*/
|
||||||
if(col >= table->col_cnt) lv_table_set_col_cnt(obj, col + 1);
|
if(col >= table->col_cnt) lv_table_set_col_count(obj, col + 1);
|
||||||
if(row >= table->row_cnt) lv_table_set_row_cnt(obj, row + 1);
|
if(row >= table->row_cnt) lv_table_set_row_count(obj, row + 1);
|
||||||
|
|
||||||
uint32_t cell = row * table->col_cnt + col;
|
uint32_t cell = row * table->col_cnt + col;
|
||||||
lv_table_cell_ctrl_t ctrl = 0;
|
lv_table_cell_ctrl_t ctrl = 0;
|
||||||
@@ -127,12 +127,12 @@ void lv_table_set_cell_value_fmt(lv_obj_t * obj, uint32_t row, uint32_t col, con
|
|||||||
|
|
||||||
lv_table_t * table = (lv_table_t *)obj;
|
lv_table_t * table = (lv_table_t *)obj;
|
||||||
if(col >= table->col_cnt) {
|
if(col >= table->col_cnt) {
|
||||||
lv_table_set_col_cnt(obj, col + 1);
|
lv_table_set_col_count(obj, col + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Auto expand*/
|
/*Auto expand*/
|
||||||
if(row >= table->row_cnt) {
|
if(row >= table->row_cnt) {
|
||||||
lv_table_set_row_cnt(obj, row + 1);
|
lv_table_set_row_count(obj, row + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t cell = row * table->col_cnt + col;
|
uint32_t cell = row * table->col_cnt + col;
|
||||||
@@ -166,7 +166,7 @@ void lv_table_set_cell_value_fmt(lv_obj_t * obj, uint32_t row, uint32_t col, con
|
|||||||
lv_vsnprintf(raw_txt, len + 1, fmt, ap2);
|
lv_vsnprintf(raw_txt, len + 1, fmt, ap2);
|
||||||
|
|
||||||
/*Get the size of the Arabic text and process it*/
|
/*Get the size of the Arabic text and process it*/
|
||||||
size_t len_ap = _lv_text_ap_calc_bytes_cnt(raw_txt);
|
size_t len_ap = _lv_text_ap_calc_bytes_count(raw_txt);
|
||||||
table->cell_data[cell] = lv_realloc(table->cell_data[cell], sizeof(lv_table_cell_t) + len_ap + 1);
|
table->cell_data[cell] = lv_realloc(table->cell_data[cell], sizeof(lv_table_cell_t) + len_ap + 1);
|
||||||
LV_ASSERT_MALLOC(table->cell_data[cell]);
|
LV_ASSERT_MALLOC(table->cell_data[cell]);
|
||||||
if(table->cell_data[cell] == NULL) {
|
if(table->cell_data[cell] == NULL) {
|
||||||
@@ -197,7 +197,7 @@ void lv_table_set_cell_value_fmt(lv_obj_t * obj, uint32_t row, uint32_t col, con
|
|||||||
refr_cell_size(obj, row, col);
|
refr_cell_size(obj, row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_table_set_row_cnt(lv_obj_t * obj, uint32_t row_cnt)
|
void lv_table_set_row_count(lv_obj_t * obj, uint32_t row_cnt)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ void lv_table_set_row_cnt(lv_obj_t * obj, uint32_t row_cnt)
|
|||||||
refr_size_form_row(obj, 0);
|
refr_size_form_row(obj, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_table_set_col_cnt(lv_obj_t * obj, uint32_t col_cnt)
|
void lv_table_set_col_count(lv_obj_t * obj, uint32_t col_cnt)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ void lv_table_set_col_width(lv_obj_t * obj, uint32_t col_id, int32_t w)
|
|||||||
lv_table_t * table = (lv_table_t *)obj;
|
lv_table_t * table = (lv_table_t *)obj;
|
||||||
|
|
||||||
/*Auto expand*/
|
/*Auto expand*/
|
||||||
if(col_id >= table->col_cnt) lv_table_set_col_cnt(obj, col_id + 1);
|
if(col_id >= table->col_cnt) lv_table_set_col_count(obj, col_id + 1);
|
||||||
|
|
||||||
table->col_w[col_id] = w;
|
table->col_w[col_id] = w;
|
||||||
refr_size_form_row(obj, 0);
|
refr_size_form_row(obj, 0);
|
||||||
@@ -319,8 +319,8 @@ void lv_table_add_cell_ctrl(lv_obj_t * obj, uint32_t row, uint32_t col, lv_table
|
|||||||
lv_table_t * table = (lv_table_t *)obj;
|
lv_table_t * table = (lv_table_t *)obj;
|
||||||
|
|
||||||
/*Auto expand*/
|
/*Auto expand*/
|
||||||
if(col >= table->col_cnt) lv_table_set_col_cnt(obj, col + 1);
|
if(col >= table->col_cnt) lv_table_set_col_count(obj, col + 1);
|
||||||
if(row >= table->row_cnt) lv_table_set_row_cnt(obj, row + 1);
|
if(row >= table->row_cnt) lv_table_set_row_count(obj, row + 1);
|
||||||
|
|
||||||
uint32_t cell = row * table->col_cnt + col;
|
uint32_t cell = row * table->col_cnt + col;
|
||||||
|
|
||||||
@@ -344,8 +344,8 @@ void lv_table_clear_cell_ctrl(lv_obj_t * obj, uint32_t row, uint32_t col, lv_tab
|
|||||||
lv_table_t * table = (lv_table_t *)obj;
|
lv_table_t * table = (lv_table_t *)obj;
|
||||||
|
|
||||||
/*Auto expand*/
|
/*Auto expand*/
|
||||||
if(col >= table->col_cnt) lv_table_set_col_cnt(obj, col + 1);
|
if(col >= table->col_cnt) lv_table_set_col_count(obj, col + 1);
|
||||||
if(row >= table->row_cnt) lv_table_set_row_cnt(obj, row + 1);
|
if(row >= table->row_cnt) lv_table_set_row_count(obj, row + 1);
|
||||||
|
|
||||||
uint32_t cell = row * table->col_cnt + col;
|
uint32_t cell = row * table->col_cnt + col;
|
||||||
|
|
||||||
@@ -369,8 +369,8 @@ void lv_table_set_cell_user_data(lv_obj_t * obj, uint16_t row, uint16_t col, voi
|
|||||||
lv_table_t * table = (lv_table_t *)obj;
|
lv_table_t * table = (lv_table_t *)obj;
|
||||||
|
|
||||||
/*Auto expand*/
|
/*Auto expand*/
|
||||||
if(col >= table->col_cnt) lv_table_set_col_cnt(obj, col + 1);
|
if(col >= table->col_cnt) lv_table_set_col_count(obj, col + 1);
|
||||||
if(row >= table->row_cnt) lv_table_set_row_cnt(obj, row + 1);
|
if(row >= table->row_cnt) lv_table_set_row_count(obj, row + 1);
|
||||||
|
|
||||||
uint32_t cell = row * table->col_cnt + col;
|
uint32_t cell = row * table->col_cnt + col;
|
||||||
|
|
||||||
@@ -411,7 +411,7 @@ const char * lv_table_get_cell_value(lv_obj_t * obj, uint32_t row, uint32_t col)
|
|||||||
return table->cell_data[cell]->txt;
|
return table->cell_data[cell]->txt;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t lv_table_get_row_cnt(lv_obj_t * obj)
|
uint32_t lv_table_get_row_count(lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ uint32_t lv_table_get_row_cnt(lv_obj_t * obj)
|
|||||||
return table->row_cnt;
|
return table->row_cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t lv_table_get_col_cnt(lv_obj_t * obj)
|
uint32_t lv_table_get_col_count(lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||||
|
|
||||||
@@ -1017,7 +1017,7 @@ static size_t get_cell_txt_len(const char * txt)
|
|||||||
size_t retval = 0;
|
size_t retval = 0;
|
||||||
|
|
||||||
#if LV_USE_ARABIC_PERSIAN_CHARS
|
#if LV_USE_ARABIC_PERSIAN_CHARS
|
||||||
retval = sizeof(lv_table_cell_t) + _lv_text_ap_calc_bytes_cnt(txt) + 1;
|
retval = sizeof(lv_table_cell_t) + _lv_text_ap_calc_bytes_count(txt) + 1;
|
||||||
#else
|
#else
|
||||||
retval = sizeof(lv_table_cell_t) + strlen(txt) + 1;
|
retval = sizeof(lv_table_cell_t) + strlen(txt) + 1;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -110,14 +110,14 @@ void lv_table_set_cell_value_fmt(lv_obj_t * obj, uint32_t row, uint32_t col, con
|
|||||||
* @param obj table pointer to a Table object
|
* @param obj table pointer to a Table object
|
||||||
* @param row_cnt number of rows
|
* @param row_cnt number of rows
|
||||||
*/
|
*/
|
||||||
void lv_table_set_row_cnt(lv_obj_t * obj, uint32_t row_cnt);
|
void lv_table_set_row_count(lv_obj_t * obj, uint32_t row_cnt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the number of columns
|
* Set the number of columns
|
||||||
* @param obj table pointer to a Table object
|
* @param obj table pointer to a Table object
|
||||||
* @param col_cnt number of columns.
|
* @param col_cnt number of columns.
|
||||||
*/
|
*/
|
||||||
void lv_table_set_col_cnt(lv_obj_t * obj, uint32_t col_cnt);
|
void lv_table_set_col_count(lv_obj_t * obj, uint32_t col_cnt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the width of a column
|
* Set the width of a column
|
||||||
@@ -175,14 +175,14 @@ const char * lv_table_get_cell_value(lv_obj_t * obj, uint32_t row, uint32_t col)
|
|||||||
* @param obj table pointer to a Table object
|
* @param obj table pointer to a Table object
|
||||||
* @return number of rows.
|
* @return number of rows.
|
||||||
*/
|
*/
|
||||||
uint32_t lv_table_get_row_cnt(lv_obj_t * obj);
|
uint32_t lv_table_get_row_count(lv_obj_t * obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of columns.
|
* Get the number of columns.
|
||||||
* @param obj table pointer to a Table object
|
* @param obj table pointer to a Table object
|
||||||
* @return number of columns.
|
* @return number of columns.
|
||||||
*/
|
*/
|
||||||
uint32_t lv_table_get_col_cnt(lv_obj_t * obj);
|
uint32_t lv_table_get_col_count(lv_obj_t * obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the width of a column
|
* Get the width of a column
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * obj, const char * name)
|
|||||||
|
|
||||||
lv_obj_t * page = lv_obj_create(cont);
|
lv_obj_t * page = lv_obj_create(cont);
|
||||||
lv_obj_set_size(page, lv_pct(100), lv_pct(100));
|
lv_obj_set_size(page, lv_pct(100), lv_pct(100));
|
||||||
uint32_t tab_idx = lv_obj_get_child_cnt(cont);
|
uint32_t tab_idx = lv_obj_get_child_count(cont);
|
||||||
|
|
||||||
lv_obj_t * tab_bar = lv_tabview_get_tab_bar(obj);
|
lv_obj_t * tab_bar = lv_tabview_get_tab_bar(obj);
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ void lv_obj_set_tile_id(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim
|
|||||||
int32_t ty = row_id * h;
|
int32_t ty = row_id * h;
|
||||||
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for(i = 0; i < lv_obj_get_child_cnt(tv); i++) {
|
for(i = 0; i < lv_obj_get_child_count(tv); i++) {
|
||||||
lv_obj_t * tile_obj = lv_obj_get_child(tv, i);
|
lv_obj_t * tile_obj = lv_obj_get_child(tv, i);
|
||||||
int32_t x = lv_obj_get_x(tile_obj);
|
int32_t x = lv_obj_get_x(tile_obj);
|
||||||
int32_t y = lv_obj_get_y(tile_obj);
|
int32_t y = lv_obj_get_y(tile_obj);
|
||||||
@@ -173,7 +173,7 @@ static void tileview_event_cb(lv_event_t * e)
|
|||||||
|
|
||||||
lv_dir_t dir = LV_DIR_ALL;
|
lv_dir_t dir = LV_DIR_ALL;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for(i = 0; i < lv_obj_get_child_cnt(obj); i++) {
|
for(i = 0; i < lv_obj_get_child_count(obj); i++) {
|
||||||
lv_obj_t * tile_obj = lv_obj_get_child(obj, i);
|
lv_obj_t * tile_obj = lv_obj_get_child(obj, i);
|
||||||
int32_t x = lv_obj_get_x(tile_obj);
|
int32_t x = lv_obj_get_x(tile_obj);
|
||||||
int32_t y = lv_obj_get_y(tile_obj);
|
int32_t y = lv_obj_get_y(tile_obj);
|
||||||
|
|||||||
@@ -17,33 +17,33 @@ void tearDown(void)
|
|||||||
void test_dropdown_create_delete(void)
|
void test_dropdown_create_delete(void)
|
||||||
{
|
{
|
||||||
lv_dropdown_create(lv_screen_active());
|
lv_dropdown_create(lv_screen_active());
|
||||||
TEST_ASSERT_EQUAL(2, lv_obj_get_child_cnt(lv_screen_active()));
|
TEST_ASSERT_EQUAL(2, lv_obj_get_child_count(lv_screen_active()));
|
||||||
|
|
||||||
lv_obj_t * dd2 = lv_dropdown_create(lv_screen_active());
|
lv_obj_t * dd2 = lv_dropdown_create(lv_screen_active());
|
||||||
lv_obj_set_pos(dd2, 200, 0);
|
lv_obj_set_pos(dd2, 200, 0);
|
||||||
TEST_ASSERT_EQUAL(4, lv_obj_get_child_cnt(lv_screen_active()));
|
TEST_ASSERT_EQUAL(4, lv_obj_get_child_count(lv_screen_active()));
|
||||||
TEST_ASSERT_FALSE(lv_dropdown_is_open(dd2));
|
TEST_ASSERT_FALSE(lv_dropdown_is_open(dd2));
|
||||||
lv_dropdown_open(dd2);
|
lv_dropdown_open(dd2);
|
||||||
TEST_ASSERT_EQUAL(4, lv_obj_get_child_cnt(lv_screen_active()));
|
TEST_ASSERT_EQUAL(4, lv_obj_get_child_count(lv_screen_active()));
|
||||||
TEST_ASSERT_TRUE(lv_dropdown_is_open(dd2));
|
TEST_ASSERT_TRUE(lv_dropdown_is_open(dd2));
|
||||||
lv_dropdown_open(dd2); /*Try to open again*/
|
lv_dropdown_open(dd2); /*Try to open again*/
|
||||||
TEST_ASSERT_EQUAL(4, lv_obj_get_child_cnt(lv_screen_active()));
|
TEST_ASSERT_EQUAL(4, lv_obj_get_child_count(lv_screen_active()));
|
||||||
|
|
||||||
lv_obj_t * dd3 = lv_dropdown_create(lv_screen_active());
|
lv_obj_t * dd3 = lv_dropdown_create(lv_screen_active());
|
||||||
lv_obj_set_pos(dd3, 400, 0);
|
lv_obj_set_pos(dd3, 400, 0);
|
||||||
TEST_ASSERT_EQUAL(6, lv_obj_get_child_cnt(lv_screen_active()));
|
TEST_ASSERT_EQUAL(6, lv_obj_get_child_count(lv_screen_active()));
|
||||||
lv_dropdown_open(dd3);
|
lv_dropdown_open(dd3);
|
||||||
TEST_ASSERT_EQUAL(6, lv_obj_get_child_cnt(lv_screen_active()));
|
TEST_ASSERT_EQUAL(6, lv_obj_get_child_count(lv_screen_active()));
|
||||||
lv_dropdown_close(dd3);
|
lv_dropdown_close(dd3);
|
||||||
TEST_ASSERT_EQUAL(6, lv_obj_get_child_cnt(lv_screen_active()));
|
TEST_ASSERT_EQUAL(6, lv_obj_get_child_count(lv_screen_active()));
|
||||||
lv_dropdown_close(dd3); /*Try to close again*/
|
lv_dropdown_close(dd3); /*Try to close again*/
|
||||||
TEST_ASSERT_EQUAL(6, lv_obj_get_child_cnt(lv_screen_active()));
|
TEST_ASSERT_EQUAL(6, lv_obj_get_child_count(lv_screen_active()));
|
||||||
|
|
||||||
lv_obj_delete(dd2);
|
lv_obj_delete(dd2);
|
||||||
TEST_ASSERT_EQUAL(4, lv_obj_get_child_cnt(lv_screen_active()));
|
TEST_ASSERT_EQUAL(4, lv_obj_get_child_count(lv_screen_active()));
|
||||||
|
|
||||||
lv_obj_clean(lv_screen_active());
|
lv_obj_clean(lv_screen_active());
|
||||||
TEST_ASSERT_EQUAL(0, lv_obj_get_child_cnt(lv_screen_active()));
|
TEST_ASSERT_EQUAL(0, lv_obj_get_child_count(lv_screen_active()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,11 +55,11 @@ void test_dropdown_set_options(void)
|
|||||||
|
|
||||||
lv_obj_t * dd1 = lv_dropdown_create(lv_screen_active());
|
lv_obj_t * dd1 = lv_dropdown_create(lv_screen_active());
|
||||||
TEST_ASSERT_EQUAL_STRING("Option 1\nOption 2\nOption 3", lv_dropdown_get_options(dd1));
|
TEST_ASSERT_EQUAL_STRING("Option 1\nOption 2\nOption 3", lv_dropdown_get_options(dd1));
|
||||||
TEST_ASSERT_EQUAL(3, lv_dropdown_get_option_cnt(dd1));
|
TEST_ASSERT_EQUAL(3, lv_dropdown_get_option_count(dd1));
|
||||||
|
|
||||||
lv_dropdown_set_options(dd1, "a1\nb2\nc3\nd4\ne5\nf6");
|
lv_dropdown_set_options(dd1, "a1\nb2\nc3\nd4\ne5\nf6");
|
||||||
TEST_ASSERT_EQUAL_STRING("a1\nb2\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
|
TEST_ASSERT_EQUAL_STRING("a1\nb2\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
|
||||||
TEST_ASSERT_EQUAL(6, lv_dropdown_get_option_cnt(dd1));
|
TEST_ASSERT_EQUAL(6, lv_dropdown_get_option_count(dd1));
|
||||||
|
|
||||||
lv_obj_set_width(dd1, 200);
|
lv_obj_set_width(dd1, 200);
|
||||||
lv_dropdown_open(dd1);
|
lv_dropdown_open(dd1);
|
||||||
@@ -70,41 +70,41 @@ void test_dropdown_set_options(void)
|
|||||||
|
|
||||||
lv_dropdown_add_option(dd1, "x0", 0);
|
lv_dropdown_add_option(dd1, "x0", 0);
|
||||||
TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
|
TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
|
||||||
TEST_ASSERT_EQUAL(7, lv_dropdown_get_option_cnt(dd1));
|
TEST_ASSERT_EQUAL(7, lv_dropdown_get_option_count(dd1));
|
||||||
|
|
||||||
lv_dropdown_add_option(dd1, "y0", 3);
|
lv_dropdown_add_option(dd1, "y0", 3);
|
||||||
TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\ny0\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
|
TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\ny0\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
|
||||||
TEST_ASSERT_EQUAL(8, lv_dropdown_get_option_cnt(dd1));
|
TEST_ASSERT_EQUAL(8, lv_dropdown_get_option_count(dd1));
|
||||||
|
|
||||||
lv_dropdown_add_option(dd1, "z0", LV_DROPDOWN_POS_LAST);
|
lv_dropdown_add_option(dd1, "z0", LV_DROPDOWN_POS_LAST);
|
||||||
TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\ny0\nc3\nd4\ne5\nf6\nz0", lv_dropdown_get_options(dd1));
|
TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\ny0\nc3\nd4\ne5\nf6\nz0", lv_dropdown_get_options(dd1));
|
||||||
TEST_ASSERT_EQUAL(9, lv_dropdown_get_option_cnt(dd1));
|
TEST_ASSERT_EQUAL(9, lv_dropdown_get_option_count(dd1));
|
||||||
|
|
||||||
lv_dropdown_clear_options(dd1);
|
lv_dropdown_clear_options(dd1);
|
||||||
TEST_ASSERT_EQUAL_STRING("", lv_dropdown_get_options(dd1));
|
TEST_ASSERT_EQUAL_STRING("", lv_dropdown_get_options(dd1));
|
||||||
TEST_ASSERT_EQUAL(0, lv_dropdown_get_option_cnt(dd1));
|
TEST_ASSERT_EQUAL(0, lv_dropdown_get_option_count(dd1));
|
||||||
|
|
||||||
lv_dropdown_set_options(dd1, "o1\no2"); /*Just to add some content before lv_dropdown_set_options_static*/
|
lv_dropdown_set_options(dd1, "o1\no2"); /*Just to add some content before lv_dropdown_set_options_static*/
|
||||||
|
|
||||||
lv_dropdown_set_options_static(dd1, "a1\nb2\nc3\nd4\ne5\nf6");
|
lv_dropdown_set_options_static(dd1, "a1\nb2\nc3\nd4\ne5\nf6");
|
||||||
TEST_ASSERT_EQUAL_STRING("a1\nb2\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
|
TEST_ASSERT_EQUAL_STRING("a1\nb2\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
|
||||||
TEST_ASSERT_EQUAL(6, lv_dropdown_get_option_cnt(dd1));
|
TEST_ASSERT_EQUAL(6, lv_dropdown_get_option_count(dd1));
|
||||||
|
|
||||||
lv_dropdown_add_option(dd1, "x0", 0);
|
lv_dropdown_add_option(dd1, "x0", 0);
|
||||||
TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
|
TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
|
||||||
TEST_ASSERT_EQUAL(7, lv_dropdown_get_option_cnt(dd1));
|
TEST_ASSERT_EQUAL(7, lv_dropdown_get_option_count(dd1));
|
||||||
|
|
||||||
lv_dropdown_add_option(dd1, "y0", 3);
|
lv_dropdown_add_option(dd1, "y0", 3);
|
||||||
TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\ny0\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
|
TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\ny0\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
|
||||||
TEST_ASSERT_EQUAL(8, lv_dropdown_get_option_cnt(dd1));
|
TEST_ASSERT_EQUAL(8, lv_dropdown_get_option_count(dd1));
|
||||||
|
|
||||||
lv_dropdown_add_option(dd1, "z0", LV_DROPDOWN_POS_LAST);
|
lv_dropdown_add_option(dd1, "z0", LV_DROPDOWN_POS_LAST);
|
||||||
TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\ny0\nc3\nd4\ne5\nf6\nz0", lv_dropdown_get_options(dd1));
|
TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\ny0\nc3\nd4\ne5\nf6\nz0", lv_dropdown_get_options(dd1));
|
||||||
TEST_ASSERT_EQUAL(9, lv_dropdown_get_option_cnt(dd1));
|
TEST_ASSERT_EQUAL(9, lv_dropdown_get_option_count(dd1));
|
||||||
|
|
||||||
lv_dropdown_clear_options(dd1);
|
lv_dropdown_clear_options(dd1);
|
||||||
TEST_ASSERT_EQUAL_STRING("", lv_dropdown_get_options(dd1));
|
TEST_ASSERT_EQUAL_STRING("", lv_dropdown_get_options(dd1));
|
||||||
TEST_ASSERT_EQUAL(0, lv_dropdown_get_option_cnt(dd1));
|
TEST_ASSERT_EQUAL(0, lv_dropdown_get_option_count(dd1));
|
||||||
|
|
||||||
lv_obj_delete(dd1);
|
lv_obj_delete(dd1);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ void test_obj_tree_2(void);
|
|||||||
|
|
||||||
void test_obj_tree_1(void)
|
void test_obj_tree_1(void)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(lv_screen_active()), 0);
|
TEST_ASSERT_EQUAL(lv_obj_get_child_count(lv_screen_active()), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_obj_tree_2(void)
|
void test_obj_tree_2(void)
|
||||||
@@ -17,13 +17,13 @@ void test_obj_tree_2(void)
|
|||||||
lv_obj_create(lv_screen_active());
|
lv_obj_create(lv_screen_active());
|
||||||
lv_obj_t * o2 = lv_obj_create(lv_screen_active());
|
lv_obj_t * o2 = lv_obj_create(lv_screen_active());
|
||||||
lv_obj_create(lv_screen_active());
|
lv_obj_create(lv_screen_active());
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(lv_screen_active()), 3);
|
TEST_ASSERT_EQUAL(lv_obj_get_child_count(lv_screen_active()), 3);
|
||||||
|
|
||||||
lv_obj_delete(o2);
|
lv_obj_delete(o2);
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(lv_screen_active()), 2);
|
TEST_ASSERT_EQUAL(lv_obj_get_child_count(lv_screen_active()), 2);
|
||||||
|
|
||||||
lv_obj_clean(lv_screen_active());
|
lv_obj_clean(lv_screen_active());
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(lv_screen_active()), 0);
|
TEST_ASSERT_EQUAL(lv_obj_get_child_count(lv_screen_active()), 0);
|
||||||
|
|
||||||
lv_color_t c1 = lv_color_hex(0x444444);
|
lv_color_t c1 = lv_color_hex(0x444444);
|
||||||
lv_color_t c2 = lv_color_hex3(0x444);
|
lv_color_t c2 = lv_color_hex3(0x444);
|
||||||
@@ -52,11 +52,11 @@ void test_obj_tree_3(void)
|
|||||||
TEST_ASSERT_EQUAL(child2_parent_before, parent2);
|
TEST_ASSERT_EQUAL(child2_parent_before, parent2);
|
||||||
|
|
||||||
/* were the children set correctly for the parents? */
|
/* were the children set correctly for the parents? */
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(parent1), 1);
|
TEST_ASSERT_EQUAL(lv_obj_get_child_count(parent1), 1);
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_index(child1), 0);
|
TEST_ASSERT_EQUAL(lv_obj_get_index(child1), 0);
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_child(parent1, 0), child1);
|
TEST_ASSERT_EQUAL(lv_obj_get_child(parent1, 0), child1);
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(parent2), 1);
|
TEST_ASSERT_EQUAL(lv_obj_get_child_count(parent2), 1);
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_index(child2), 0);
|
TEST_ASSERT_EQUAL(lv_obj_get_index(child2), 0);
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_child(parent2, 0), child2);
|
TEST_ASSERT_EQUAL(lv_obj_get_child(parent2, 0), child2);
|
||||||
|
|
||||||
@@ -71,11 +71,11 @@ void test_obj_tree_3(void)
|
|||||||
TEST_ASSERT_EQUAL(child2_parent_after, parent1);
|
TEST_ASSERT_EQUAL(child2_parent_after, parent1);
|
||||||
|
|
||||||
/* test for correctly set children */
|
/* test for correctly set children */
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(parent1), 1);
|
TEST_ASSERT_EQUAL(lv_obj_get_child_count(parent1), 1);
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_index(child2), 0);
|
TEST_ASSERT_EQUAL(lv_obj_get_index(child2), 0);
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_child(parent1, 0), child2);
|
TEST_ASSERT_EQUAL(lv_obj_get_child(parent1, 0), child2);
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(parent2), 1);
|
TEST_ASSERT_EQUAL(lv_obj_get_child_count(parent2), 1);
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_index(child1), 0);
|
TEST_ASSERT_EQUAL(lv_obj_get_index(child1), 0);
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_child(parent2, 0), child1);
|
TEST_ASSERT_EQUAL(lv_obj_get_child(parent2, 0), child1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ void test_roller_get_selected_option(void)
|
|||||||
char * expected_index_str = "Three";
|
char * expected_index_str = "Three";
|
||||||
|
|
||||||
/* Select the last option, index starts at 0 */
|
/* Select the last option, index starts at 0 */
|
||||||
uint16_t option_count = lv_roller_get_option_cnt(roller);
|
uint16_t option_count = lv_roller_get_option_count(roller);
|
||||||
lv_roller_set_selected(roller, option_count - 1, LV_ANIM_OFF);
|
lv_roller_set_selected(roller, option_count - 1, LV_ANIM_OFF);
|
||||||
|
|
||||||
actual_index = lv_roller_get_selected(roller);
|
actual_index = lv_roller_get_selected(roller);
|
||||||
@@ -82,7 +82,7 @@ void test_roller_get_selected_option_truncated_buffer(void)
|
|||||||
char * expected_index_str = "Th";
|
char * expected_index_str = "Th";
|
||||||
|
|
||||||
/* Select the last option, index starts at 0 */
|
/* Select the last option, index starts at 0 */
|
||||||
uint16_t option_count = lv_roller_get_option_cnt(roller);
|
uint16_t option_count = lv_roller_get_option_count(roller);
|
||||||
lv_roller_set_selected(roller, option_count - 1, LV_ANIM_OFF);
|
lv_roller_set_selected(roller, option_count - 1, LV_ANIM_OFF);
|
||||||
|
|
||||||
/* Get the index string */
|
/* Get the index string */
|
||||||
@@ -98,7 +98,7 @@ void test_roller_infinite_mode_get_selected_option(void)
|
|||||||
int16_t actual_index = 0;
|
int16_t actual_index = 0;
|
||||||
|
|
||||||
/* Select the last option of page 2 */
|
/* Select the last option of page 2 */
|
||||||
uint16_t option_count = lv_roller_get_option_cnt(roller_infinite);
|
uint16_t option_count = lv_roller_get_option_count(roller_infinite);
|
||||||
option_count = (option_count * 2) - 1;
|
option_count = (option_count * 2) - 1;
|
||||||
lv_roller_set_selected(roller_infinite, option_count, LV_ANIM_OFF);
|
lv_roller_set_selected(roller_infinite, option_count, LV_ANIM_OFF);
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ void test_roller_with_overlay_and_bubble_events_enabled(void)
|
|||||||
// lv_group_add_obj(g, roller_infinite);
|
// lv_group_add_obj(g, roller_infinite);
|
||||||
//
|
//
|
||||||
// /* Select the last option of page 2 */
|
// /* Select the last option of page 2 */
|
||||||
// uint16_t option_count = lv_roller_get_option_cnt(roller_infinite);
|
// uint16_t option_count = lv_roller_get_option_count(roller_infinite);
|
||||||
// option_count = (option_count * 2) - 1;
|
// option_count = (option_count * 2) - 1;
|
||||||
// lv_roller_set_selected(roller_infinite, option_count, LV_ANIM_OFF);
|
// lv_roller_set_selected(roller_infinite, option_count, LV_ANIM_OFF);
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ void test_spangroup_new_span_with_null_parameter_returns_null_object(void)
|
|||||||
lv_span_t * span = lv_spangroup_new_span(NULL);
|
lv_span_t * span = lv_spangroup_new_span(NULL);
|
||||||
|
|
||||||
TEST_ASSERT(NULL == span);
|
TEST_ASSERT(NULL == span);
|
||||||
TEST_ASSERT_EQUAL_INT(0, lv_spangroup_get_child_cnt(spangroup));
|
TEST_ASSERT_EQUAL_INT(0, lv_spangroup_get_child_conut(spangroup));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spangroup_new_span_with_valid_parameter_returns_not_null_object(void)
|
void test_spangroup_new_span_with_valid_parameter_returns_not_null_object(void)
|
||||||
@@ -43,7 +43,7 @@ void test_spangroup_new_span_with_valid_parameter_returns_not_null_object(void)
|
|||||||
lv_span_t * span = lv_spangroup_new_span(spangroup);
|
lv_span_t * span = lv_spangroup_new_span(spangroup);
|
||||||
|
|
||||||
TEST_ASSERT(NULL != span);
|
TEST_ASSERT(NULL != span);
|
||||||
TEST_ASSERT_EQUAL_INT(1, lv_spangroup_get_child_cnt(spangroup));
|
TEST_ASSERT_EQUAL_INT(1, lv_spangroup_get_child_conut(spangroup));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spangroup_delete_span_span_is_null(void)
|
void test_spangroup_delete_span_span_is_null(void)
|
||||||
@@ -52,7 +52,7 @@ void test_spangroup_delete_span_span_is_null(void)
|
|||||||
|
|
||||||
lv_spangroup_delete_span(spangroup, span);
|
lv_spangroup_delete_span(spangroup, span);
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_INT(0, lv_spangroup_get_child_cnt(spangroup));
|
TEST_ASSERT_EQUAL_INT(0, lv_spangroup_get_child_conut(spangroup));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_span_set_text(void)
|
void test_span_set_text(void)
|
||||||
@@ -249,12 +249,12 @@ void test_spangroup_get_child(void)
|
|||||||
TEST_ASSERT_EQUAL_PTR(span_1, lv_spangroup_get_child(spangroup, span_1_idx));
|
TEST_ASSERT_EQUAL_PTR(span_1, lv_spangroup_get_child(spangroup, span_1_idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spangroup_get_child_cnt(void)
|
void test_spangroup_get_child_conut(void)
|
||||||
{
|
{
|
||||||
(void)lv_spangroup_new_span(spangroup);
|
(void)lv_spangroup_new_span(spangroup);
|
||||||
(void)lv_spangroup_new_span(spangroup);
|
(void)lv_spangroup_new_span(spangroup);
|
||||||
|
|
||||||
const uint32_t cnt = lv_spangroup_get_child_cnt(spangroup);
|
const uint32_t cnt = lv_spangroup_get_child_conut(spangroup);
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(2, cnt);
|
TEST_ASSERT_EQUAL(2, cnt);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ void test_table_should_return_assigned_cell_value(void)
|
|||||||
void test_table_should_grow_columns_automatically_when_setting_formatted_cell_value(void)
|
void test_table_should_grow_columns_automatically_when_setting_formatted_cell_value(void)
|
||||||
{
|
{
|
||||||
/* Newly created tables have 1 column and 1 row */
|
/* Newly created tables have 1 column and 1 row */
|
||||||
uint16_t original_column_count = lv_table_get_col_cnt(table);
|
uint16_t original_column_count = lv_table_get_col_count(table);
|
||||||
TEST_ASSERT_EQUAL_UINT16(1, original_column_count);
|
TEST_ASSERT_EQUAL_UINT16(1, original_column_count);
|
||||||
|
|
||||||
/* Table currently only has a cell at 0,0 (row, column) */
|
/* Table currently only has a cell at 0,0 (row, column) */
|
||||||
@@ -39,7 +39,7 @@ void test_table_should_grow_columns_automatically_when_setting_formatted_cell_va
|
|||||||
|
|
||||||
/* Table now should have cells at 0,0 and 0,1, so 2 columns */
|
/* Table now should have cells at 0,0 and 0,1, so 2 columns */
|
||||||
uint16_t expected_column_count = original_column_count + 1;
|
uint16_t expected_column_count = original_column_count + 1;
|
||||||
TEST_ASSERT_EQUAL_UINT16(expected_column_count, lv_table_get_col_cnt(table));
|
TEST_ASSERT_EQUAL_UINT16(expected_column_count, lv_table_get_col_count(table));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_table_should_identify_cell_with_ctrl(void)
|
void test_table_should_identify_cell_with_ctrl(void)
|
||||||
@@ -169,8 +169,8 @@ void test_table_rendering(void)
|
|||||||
lv_obj_set_style_border_side(table, LV_BORDER_SIDE_FULL, LV_PART_ITEMS);
|
lv_obj_set_style_border_side(table, LV_BORDER_SIDE_FULL, LV_PART_ITEMS);
|
||||||
lv_obj_set_style_pad_all(table, 10, LV_PART_ITEMS);
|
lv_obj_set_style_pad_all(table, 10, LV_PART_ITEMS);
|
||||||
lv_obj_set_style_border_width(table, 5, LV_PART_ITEMS);
|
lv_obj_set_style_border_width(table, 5, LV_PART_ITEMS);
|
||||||
lv_table_set_col_cnt(table, 5);
|
lv_table_set_col_count(table, 5);
|
||||||
lv_table_set_row_cnt(table, 5);
|
lv_table_set_row_count(table, 5);
|
||||||
lv_table_set_col_width(table, 1, 60);
|
lv_table_set_col_width(table, 1, 60);
|
||||||
lv_table_set_col_width(table, 2, 100);
|
lv_table_set_col_width(table, 2, 100);
|
||||||
|
|
||||||
@@ -207,8 +207,8 @@ void test_table_should_reduce_cells(void)
|
|||||||
|
|
||||||
lv_obj_center(table);
|
lv_obj_center(table);
|
||||||
|
|
||||||
lv_table_set_col_cnt(table, initial_col_num);
|
lv_table_set_col_count(table, initial_col_num);
|
||||||
lv_table_set_row_cnt(table, initial_row_num);
|
lv_table_set_row_count(table, initial_row_num);
|
||||||
|
|
||||||
uint32_t row_idx, col_idx;
|
uint32_t row_idx, col_idx;
|
||||||
for(row_idx = 0; row_idx < initial_row_num; row_idx++) {
|
for(row_idx = 0; row_idx < initial_row_num; row_idx++) {
|
||||||
@@ -217,8 +217,8 @@ void test_table_should_reduce_cells(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_table_set_col_cnt(table, final_col_num);
|
lv_table_set_col_count(table, final_col_num);
|
||||||
lv_table_set_row_cnt(table, final_row_num);
|
lv_table_set_row_count(table, final_row_num);
|
||||||
|
|
||||||
for(row_idx = 0; row_idx < final_row_num; row_idx++) {
|
for(row_idx = 0; row_idx < final_row_num; row_idx++) {
|
||||||
for(col_idx = 0; col_idx < final_col_num; col_idx++) {
|
for(col_idx = 0; col_idx < final_col_num; col_idx++) {
|
||||||
@@ -237,8 +237,8 @@ void test_table_should_reduce_cells_with_more_than_one_row(void)
|
|||||||
|
|
||||||
lv_obj_center(table);
|
lv_obj_center(table);
|
||||||
|
|
||||||
lv_table_set_col_cnt(table, initial_col_num);
|
lv_table_set_col_count(table, initial_col_num);
|
||||||
lv_table_set_row_cnt(table, initial_row_num);
|
lv_table_set_row_count(table, initial_row_num);
|
||||||
|
|
||||||
uint32_t row_idx, col_idx;
|
uint32_t row_idx, col_idx;
|
||||||
for(row_idx = 0; row_idx < initial_row_num; row_idx++) {
|
for(row_idx = 0; row_idx < initial_row_num; row_idx++) {
|
||||||
@@ -247,8 +247,8 @@ void test_table_should_reduce_cells_with_more_than_one_row(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_table_set_col_cnt(table, final_col_num);
|
lv_table_set_col_count(table, final_col_num);
|
||||||
lv_table_set_row_cnt(table, final_row_num);
|
lv_table_set_row_count(table, final_row_num);
|
||||||
|
|
||||||
for(row_idx = 0; row_idx < final_row_num; row_idx++) {
|
for(row_idx = 0; row_idx < final_row_num; row_idx++) {
|
||||||
for(col_idx = 0; col_idx < final_col_num; col_idx++) {
|
for(col_idx = 0; col_idx < final_col_num; col_idx++) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ void test_win_should_have_valid_documented_default_values(void)
|
|||||||
TEST_ASSERT_NOT_NULL(win);
|
TEST_ASSERT_NOT_NULL(win);
|
||||||
|
|
||||||
// Check that the correct children have been created
|
// Check that the correct children have been created
|
||||||
TEST_ASSERT_EQUAL(2, lv_obj_get_child_cnt(win));
|
TEST_ASSERT_EQUAL(2, lv_obj_get_child_count(win));
|
||||||
|
|
||||||
header = lv_win_get_header(win);
|
header = lv_win_get_header(win);
|
||||||
content = lv_win_get_content(win);
|
content = lv_win_get_content(win);
|
||||||
@@ -39,10 +39,10 @@ void test_win_should_have_valid_documented_default_values(void)
|
|||||||
|
|
||||||
// Check that the header is correctly sized and empty
|
// Check that the header is correctly sized and empty
|
||||||
TEST_ASSERT_EQUAL(lv_display_get_dpi(lv_obj_get_disp(win)) / 2, lv_obj_get_height(header));
|
TEST_ASSERT_EQUAL(lv_display_get_dpi(lv_obj_get_disp(win)) / 2, lv_obj_get_height(header));
|
||||||
TEST_ASSERT_EQUAL(0, lv_obj_get_child_cnt(header));
|
TEST_ASSERT_EQUAL(0, lv_obj_get_child_count(header));
|
||||||
|
|
||||||
// Check that the content is empty
|
// Check that the content is empty
|
||||||
TEST_ASSERT_EQUAL(0, lv_obj_get_child_cnt(content));
|
TEST_ASSERT_EQUAL(0, lv_obj_get_child_count(content));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_win_add_title_single(void)
|
void test_win_add_title_single(void)
|
||||||
@@ -57,8 +57,8 @@ void test_win_add_title_single(void)
|
|||||||
|
|
||||||
// Check that no additional children have been created under win
|
// Check that no additional children have been created under win
|
||||||
// Instead the child should be created under header
|
// Instead the child should be created under header
|
||||||
TEST_ASSERT_EQUAL(2, lv_obj_get_child_cnt(win));
|
TEST_ASSERT_EQUAL(2, lv_obj_get_child_count(win));
|
||||||
TEST_ASSERT_EQUAL(1, lv_obj_get_child_cnt(header));
|
TEST_ASSERT_EQUAL(1, lv_obj_get_child_count(header));
|
||||||
|
|
||||||
// Check that the title is a label and has been created properly
|
// Check that the title is a label and has been created properly
|
||||||
lv_obj_t * title = lv_obj_get_child(header, 0);
|
lv_obj_t * title = lv_obj_get_child(header, 0);
|
||||||
@@ -79,8 +79,8 @@ void test_win_add_title_multiple(void)
|
|||||||
|
|
||||||
// Check that no additional children have been created under win
|
// Check that no additional children have been created under win
|
||||||
// Instead the child should be created under header
|
// Instead the child should be created under header
|
||||||
TEST_ASSERT_EQUAL(2, lv_obj_get_child_cnt(win));
|
TEST_ASSERT_EQUAL(2, lv_obj_get_child_count(win));
|
||||||
TEST_ASSERT_EQUAL(2, lv_obj_get_child_cnt(header));
|
TEST_ASSERT_EQUAL(2, lv_obj_get_child_count(header));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_win_add_button(void)
|
void test_win_add_button(void)
|
||||||
@@ -98,12 +98,12 @@ void test_win_add_button(void)
|
|||||||
|
|
||||||
// Check that no additional children have been created under win
|
// Check that no additional children have been created under win
|
||||||
// Instead the child should be created under header
|
// Instead the child should be created under header
|
||||||
TEST_ASSERT_EQUAL(2, lv_obj_get_child_cnt(win));
|
TEST_ASSERT_EQUAL(2, lv_obj_get_child_count(win));
|
||||||
TEST_ASSERT_EQUAL(1, lv_obj_get_child_cnt(header));
|
TEST_ASSERT_EQUAL(1, lv_obj_get_child_count(header));
|
||||||
|
|
||||||
// Check that the button has been created properly
|
// Check that the button has been created properly
|
||||||
lv_obj_t * btn = lv_obj_get_child(header, 0);
|
lv_obj_t * btn = lv_obj_get_child(header, 0);
|
||||||
TEST_ASSERT_EQUAL(1, lv_obj_get_child_cnt(btn));
|
TEST_ASSERT_EQUAL(1, lv_obj_get_child_count(btn));
|
||||||
TEST_ASSERT_EQUAL(win_button_width, lv_obj_get_width(btn));
|
TEST_ASSERT_EQUAL(win_button_width, lv_obj_get_width(btn));
|
||||||
|
|
||||||
// Check the output remains visually consistent
|
// Check the output remains visually consistent
|
||||||
@@ -130,12 +130,12 @@ void test_win_add_multiple_elements(void)
|
|||||||
|
|
||||||
// Check that no additional children have been created under win
|
// Check that no additional children have been created under win
|
||||||
// Instead the child should be created under header
|
// Instead the child should be created under header
|
||||||
TEST_ASSERT_EQUAL(2, lv_obj_get_child_cnt(win));
|
TEST_ASSERT_EQUAL(2, lv_obj_get_child_count(win));
|
||||||
TEST_ASSERT_EQUAL(4, lv_obj_get_child_cnt(header));
|
TEST_ASSERT_EQUAL(4, lv_obj_get_child_count(header));
|
||||||
|
|
||||||
// Check that the left button has been created properly
|
// Check that the left button has been created properly
|
||||||
btn = lv_obj_get_child(header, 0);
|
btn = lv_obj_get_child(header, 0);
|
||||||
TEST_ASSERT_EQUAL(1, lv_obj_get_child_cnt(btn));
|
TEST_ASSERT_EQUAL(1, lv_obj_get_child_count(btn));
|
||||||
TEST_ASSERT_EQUAL(win_button_width, lv_obj_get_width(btn));
|
TEST_ASSERT_EQUAL(win_button_width, lv_obj_get_width(btn));
|
||||||
|
|
||||||
// Check that the title is a label and has been created properly
|
// Check that the title is a label and has been created properly
|
||||||
@@ -145,12 +145,12 @@ void test_win_add_multiple_elements(void)
|
|||||||
|
|
||||||
// Check that the right button has been created properly
|
// Check that the right button has been created properly
|
||||||
btn = lv_obj_get_child(header, 2);
|
btn = lv_obj_get_child(header, 2);
|
||||||
TEST_ASSERT_EQUAL(1, lv_obj_get_child_cnt(btn));
|
TEST_ASSERT_EQUAL(1, lv_obj_get_child_count(btn));
|
||||||
TEST_ASSERT_EQUAL(win_button_width, lv_obj_get_width(btn));
|
TEST_ASSERT_EQUAL(win_button_width, lv_obj_get_width(btn));
|
||||||
|
|
||||||
// Check that the close button has been created properly
|
// Check that the close button has been created properly
|
||||||
btn = lv_obj_get_child(header, 3);
|
btn = lv_obj_get_child(header, 3);
|
||||||
TEST_ASSERT_EQUAL(1, lv_obj_get_child_cnt(btn));
|
TEST_ASSERT_EQUAL(1, lv_obj_get_child_count(btn));
|
||||||
TEST_ASSERT_EQUAL(win_button_close_width, lv_obj_get_width(btn));
|
TEST_ASSERT_EQUAL(win_button_close_width, lv_obj_get_width(btn));
|
||||||
|
|
||||||
// Check the output remains visually consistent
|
// Check the output remains visually consistent
|
||||||
|
|||||||
Reference in New Issue
Block a user