diff --git a/docs/widgets/table.rst b/docs/widgets/table.rst index c0201ffec..13d85b438 100644 --- a/docs/widgets/table.rst +++ b/docs/widgets/table.rst @@ -44,7 +44,7 @@ Rows and Columns To explicitly set number of rows and columns use :cpp:expr:`lv_table_set_row_count(table, row_cnt)` and -:cpp:expr:`lv_table_set_col_count(table, col_cnt)` +:cpp:expr:`lv_table_set_column_count(table, col_cnt)` Width and Height ---------------- diff --git a/examples/widgets/table/lv_example_table_2.c b/examples/widgets/table/lv_example_table_2.c index a62d4aa5b..d586e4b31 100644 --- a/examples/widgets/table/lv_example_table_2.c +++ b/examples/widgets/table/lv_example_table_2.c @@ -72,7 +72,7 @@ void lv_example_table_2(void) lv_table_set_col_width(table, 0, 150); 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_count(table, 1); + lv_table_set_column_count(table, 1); /*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); diff --git a/src/lv_api_map.h b/src/lv_api_map.h index d354b2aa7..330514043 100644 --- a/src/lv_api_map.h +++ b/src/lv_api_map.h @@ -222,9 +222,9 @@ static inline void lv_obj_move_background(lv_obj_t * obj) #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_col_cnt lv_table_set_column_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_col_cnt lv_table_get_column_count #define lv_table_get_row_cnt lv_table_get_row_count #define lv_dropdown_get_option_cnt lv_dropdown_get_option_count diff --git a/src/others/file_explorer/lv_file_explorer.c b/src/others/file_explorer/lv_file_explorer.c index 7fdfb30c1..e31b30c69 100644 --- a/src/others/file_explorer/lv_file_explorer.c +++ b/src/others/file_explorer/lv_file_explorer.c @@ -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); 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_count(explorer->file_table, 1); + lv_table_set_column_count(explorer->file_table, 1); lv_obj_add_event(explorer->file_table, browser_file_event_handler, LV_EVENT_ALL, obj); /*only scroll up and down*/ diff --git a/src/widgets/table/lv_table.c b/src/widgets/table/lv_table.c index 381db9f18..5d53c6962 100644 --- a/src/widgets/table/lv_table.c +++ b/src/widgets/table/lv_table.c @@ -93,7 +93,7 @@ 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; /*Auto expand*/ - if(col >= table->col_cnt) lv_table_set_col_count(obj, col + 1); + if(col >= table->col_cnt) lv_table_set_column_count(obj, col + 1); if(row >= table->row_cnt) lv_table_set_row_count(obj, row + 1); uint32_t cell = row * table->col_cnt + col; @@ -127,7 +127,7 @@ 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; if(col >= table->col_cnt) { - lv_table_set_col_count(obj, col + 1); + lv_table_set_column_count(obj, col + 1); } /*Auto expand*/ @@ -240,7 +240,7 @@ void lv_table_set_row_count(lv_obj_t * obj, uint32_t row_cnt) refr_size_form_row(obj, 0); } -void lv_table_set_col_count(lv_obj_t * obj, uint32_t col_cnt) +void lv_table_set_column_count(lv_obj_t * obj, uint32_t col_cnt) { 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; /*Auto expand*/ - if(col_id >= table->col_cnt) lv_table_set_col_count(obj, col_id + 1); + if(col_id >= table->col_cnt) lv_table_set_column_count(obj, col_id + 1); table->col_w[col_id] = w; refr_size_form_row(obj, 0); @@ -319,7 +319,7 @@ 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; /*Auto expand*/ - if(col >= table->col_cnt) lv_table_set_col_count(obj, col + 1); + if(col >= table->col_cnt) lv_table_set_column_count(obj, col + 1); if(row >= table->row_cnt) lv_table_set_row_count(obj, row + 1); uint32_t cell = row * table->col_cnt + col; @@ -344,7 +344,7 @@ 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; /*Auto expand*/ - if(col >= table->col_cnt) lv_table_set_col_count(obj, col + 1); + if(col >= table->col_cnt) lv_table_set_column_count(obj, col + 1); if(row >= table->row_cnt) lv_table_set_row_count(obj, row + 1); uint32_t cell = row * table->col_cnt + col; @@ -369,7 +369,7 @@ 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; /*Auto expand*/ - if(col >= table->col_cnt) lv_table_set_col_count(obj, col + 1); + if(col >= table->col_cnt) lv_table_set_column_count(obj, col + 1); if(row >= table->row_cnt) lv_table_set_row_count(obj, row + 1); uint32_t cell = row * table->col_cnt + col; @@ -419,7 +419,7 @@ uint32_t lv_table_get_row_count(lv_obj_t * obj) return table->row_cnt; } -uint32_t lv_table_get_col_count(lv_obj_t * obj) +uint32_t lv_table_get_column_count(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); diff --git a/src/widgets/table/lv_table.h b/src/widgets/table/lv_table.h index d25449c9e..39857343d 100644 --- a/src/widgets/table/lv_table.h +++ b/src/widgets/table/lv_table.h @@ -117,7 +117,7 @@ void lv_table_set_row_count(lv_obj_t * obj, uint32_t row_cnt); * @param obj table pointer to a Table object * @param col_cnt number of columns. */ -void lv_table_set_col_count(lv_obj_t * obj, uint32_t col_cnt); +void lv_table_set_column_count(lv_obj_t * obj, uint32_t col_cnt); /** * Set the width of a column @@ -182,7 +182,7 @@ uint32_t lv_table_get_row_count(lv_obj_t * obj); * @param obj table pointer to a Table object * @return number of columns. */ -uint32_t lv_table_get_col_count(lv_obj_t * obj); +uint32_t lv_table_get_column_count(lv_obj_t * obj); /** * Get the width of a column diff --git a/tests/src/test_cases/widgets/test_table.c b/tests/src/test_cases/widgets/test_table.c index 45eea55d8..cd01796bd 100644 --- a/tests/src/test_cases/widgets/test_table.c +++ b/tests/src/test_cases/widgets/test_table.c @@ -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) { /* Newly created tables have 1 column and 1 row */ - uint16_t original_column_count = lv_table_get_col_count(table); + uint16_t original_column_count = lv_table_get_column_count(table); TEST_ASSERT_EQUAL_UINT16(1, original_column_count); /* 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 */ uint16_t expected_column_count = original_column_count + 1; - TEST_ASSERT_EQUAL_UINT16(expected_column_count, lv_table_get_col_count(table)); + TEST_ASSERT_EQUAL_UINT16(expected_column_count, lv_table_get_column_count(table)); } void test_table_should_identify_cell_with_ctrl(void) @@ -169,7 +169,7 @@ void test_table_rendering(void) 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_border_width(table, 5, LV_PART_ITEMS); - lv_table_set_col_count(table, 5); + lv_table_set_column_count(table, 5); lv_table_set_row_count(table, 5); lv_table_set_col_width(table, 1, 60); lv_table_set_col_width(table, 2, 100); @@ -207,7 +207,7 @@ void test_table_should_reduce_cells(void) lv_obj_center(table); - lv_table_set_col_count(table, initial_col_num); + lv_table_set_column_count(table, initial_col_num); lv_table_set_row_count(table, initial_row_num); uint32_t row_idx, col_idx; @@ -217,7 +217,7 @@ void test_table_should_reduce_cells(void) } } - lv_table_set_col_count(table, final_col_num); + lv_table_set_column_count(table, final_col_num); lv_table_set_row_count(table, final_row_num); for(row_idx = 0; row_idx < final_row_num; row_idx++) { @@ -237,7 +237,7 @@ void test_table_should_reduce_cells_with_more_than_one_row(void) lv_obj_center(table); - lv_table_set_col_count(table, initial_col_num); + lv_table_set_column_count(table, initial_col_num); lv_table_set_row_count(table, initial_row_num); uint32_t row_idx, col_idx; @@ -247,7 +247,7 @@ void test_table_should_reduce_cells_with_more_than_one_row(void) } } - lv_table_set_col_count(table, final_col_num); + lv_table_set_column_count(table, final_col_num); lv_table_set_row_count(table, final_row_num); for(row_idx = 0; row_idx < final_row_num; row_idx++) {