From 91020ea20ea36b20a98b3e2d32f6aeb9cdc7c4b3 Mon Sep 17 00:00:00 2001 From: PGNetHun Date: Mon, 4 Dec 2023 22:57:47 +0100 Subject: [PATCH] fix(table): rename shortened function names to full names (#4918) --- docs/widgets/table.rst | 2 +- examples/widgets/table/lv_example_table_2.c | 2 +- src/lv_api_map.h | 2 ++ src/others/file_explorer/lv_file_explorer.c | 4 ++-- src/widgets/table/lv_table.c | 4 ++-- src/widgets/table/lv_table.h | 4 ++-- tests/src/test_cases/widgets/test_table.c | 6 +++--- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/docs/widgets/table.rst b/docs/widgets/table.rst index 13d85b438..0990d2859 100644 --- a/docs/widgets/table.rst +++ b/docs/widgets/table.rst @@ -50,7 +50,7 @@ Width and Height ---------------- The width of the columns can be set with -:cpp:expr:`lv_table_set_col_width(table, col_id, width)`. The overall width of +:cpp:expr:`lv_table_set_column_width(table, col_id, width)`. The overall width of the Table object will be set to the sum of columns widths. The height is calculated automatically from the cell styles (font, diff --git a/examples/widgets/table/lv_example_table_2.c b/examples/widgets/table/lv_example_table_2.c index c3f498bd1..c11dd25e3 100644 --- a/examples/widgets/table/lv_example_table_2.c +++ b/examples/widgets/table/lv_example_table_2.c @@ -70,7 +70,7 @@ void lv_example_table_2(void) /*Set a smaller height to the table. It'll make it scrollable*/ lv_obj_set_size(table, LV_SIZE_CONTENT, 200); - lv_table_set_col_width(table, 0, 150); + lv_table_set_column_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_column_count(table, 1); diff --git a/src/lv_api_map.h b/src/lv_api_map.h index 4c035ab90..2f99842fb 100644 --- a/src/lv_api_map.h +++ b/src/lv_api_map.h @@ -226,6 +226,8 @@ static inline void lv_obj_move_background(lv_obj_t * obj) #define lv_table_set_row_cnt lv_table_set_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_table_set_col_width lv_table_set_column_width +#define lv_table_get_col_width lv_table_get_column_width #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 3b4489d51..cfcb00aa9 100644 --- a/src/others/file_explorer/lv_file_explorer.c +++ b/src/others/file_explorer/lv_file_explorer.c @@ -321,7 +321,7 @@ static void lv_file_explorer_constructor(const lv_obj_class_t * class_p, lv_obj_ /*Table showing the contents of the table of contents*/ 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_column_width(explorer->file_table, 0, LV_PCT(100)); lv_table_set_column_count(explorer->file_table, 1); lv_obj_add_event_cb(explorer->file_table, browser_file_event_handler, LV_EVENT_ALL, obj); @@ -516,7 +516,7 @@ static void browser_file_event_handler(lv_event_t * e) } } else if(code == LV_EVENT_SIZE_CHANGED) { - lv_table_set_col_width(explorer->file_table, 0, lv_obj_get_width(explorer->file_table)); + lv_table_set_column_width(explorer->file_table, 0, lv_obj_get_width(explorer->file_table)); } else if((code == LV_EVENT_CLICKED) || (code == LV_EVENT_RELEASED)) { lv_obj_send_event(obj, LV_EVENT_CLICKED, NULL); diff --git a/src/widgets/table/lv_table.c b/src/widgets/table/lv_table.c index 6f54d39d4..a3a42581f 100644 --- a/src/widgets/table/lv_table.c +++ b/src/widgets/table/lv_table.c @@ -299,7 +299,7 @@ void lv_table_set_column_count(lv_obj_t * obj, uint32_t col_cnt) refr_size_form_row(obj, 0) ; } -void lv_table_set_col_width(lv_obj_t * obj, uint32_t col_id, int32_t w) +void lv_table_set_column_width(lv_obj_t * obj, uint32_t col_id, int32_t w) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -427,7 +427,7 @@ uint32_t lv_table_get_column_count(lv_obj_t * obj) return table->col_cnt; } -int32_t lv_table_get_col_width(lv_obj_t * obj, uint32_t col) +int32_t lv_table_get_column_width(lv_obj_t * obj, uint32_t col) { LV_ASSERT_OBJ(obj, MY_CLASS); diff --git a/src/widgets/table/lv_table.h b/src/widgets/table/lv_table.h index 39857343d..80db47b05 100644 --- a/src/widgets/table/lv_table.h +++ b/src/widgets/table/lv_table.h @@ -125,7 +125,7 @@ void lv_table_set_column_count(lv_obj_t * obj, uint32_t col_cnt); * @param col_id id of the column [0 .. LV_TABLE_COL_MAX -1] * @param w width of the column */ -void lv_table_set_col_width(lv_obj_t * obj, uint32_t col_id, int32_t w); +void lv_table_set_column_width(lv_obj_t * obj, uint32_t col_id, int32_t w); /** * Add control bits to the cell. @@ -190,7 +190,7 @@ uint32_t lv_table_get_column_count(lv_obj_t * obj); * @param col id of the column [0 .. LV_TABLE_COL_MAX -1] * @return width of the column */ -int32_t lv_table_get_col_width(lv_obj_t * obj, uint32_t col); +int32_t lv_table_get_column_width(lv_obj_t * obj, uint32_t col); /** * Get whether a cell has the control bits diff --git a/tests/src/test_cases/widgets/test_table.c b/tests/src/test_cases/widgets/test_table.c index eb8d381b9..777a2d488 100644 --- a/tests/src/test_cases/widgets/test_table.c +++ b/tests/src/test_cases/widgets/test_table.c @@ -109,7 +109,7 @@ void test_table_should_wrap_long_texts(void) const char * long_text = "Testing automatic text wrap with a very long text"; const char * small_text = "Hi"; - lv_table_set_col_width(table, 0, 50); + lv_table_set_column_width(table, 0, 50); lv_table_set_cell_value(table, 0, 0, small_text); int32_t row_height = table_ptr->row_h[0]; @@ -171,8 +171,8 @@ void test_table_rendering(void) lv_obj_set_style_border_width(table, 5, LV_PART_ITEMS); 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); + lv_table_set_column_width(table, 1, 60); + lv_table_set_column_width(table, 2, 100); lv_table_add_cell_ctrl(table, 0, 1, LV_TABLE_CELL_CTRL_MERGE_RIGHT); lv_table_set_cell_value(table, 0, 1, "2 cells are merged");