Lines Matching refs:table
91 lv_table_t * table = (lv_table_t *)obj; in lv_table_set_cell_value() local
94 if(col >= table->col_cnt) lv_table_set_col_cnt(obj, col + 1); in lv_table_set_cell_value()
95 if(row >= table->row_cnt) lv_table_set_row_cnt(obj, row + 1); in lv_table_set_cell_value()
97 uint32_t cell = row * table->col_cnt + col; in lv_table_set_cell_value()
101 if(table->cell_data[cell]) ctrl = table->cell_data[cell]->ctrl; in lv_table_set_cell_value()
107 if(table->cell_data[cell]) user_data = table->cell_data[cell]->user_data; in lv_table_set_cell_value()
112 table->cell_data[cell] = lv_mem_realloc(table->cell_data[cell], to_allocate); in lv_table_set_cell_value()
113 LV_ASSERT_MALLOC(table->cell_data[cell]); in lv_table_set_cell_value()
114 if(table->cell_data[cell] == NULL) return; in lv_table_set_cell_value()
116 copy_cell_txt(table->cell_data[cell], txt); in lv_table_set_cell_value()
118 table->cell_data[cell]->ctrl = ctrl; in lv_table_set_cell_value()
120 table->cell_data[cell]->user_data = user_data; in lv_table_set_cell_value()
130 lv_table_t * table = (lv_table_t *)obj; in lv_table_set_cell_value_fmt() local
131 if(col >= table->col_cnt) { in lv_table_set_cell_value_fmt()
136 if(row >= table->row_cnt) { in lv_table_set_cell_value_fmt()
140 uint32_t cell = row * table->col_cnt + col; in lv_table_set_cell_value_fmt()
144 if(table->cell_data[cell]) ctrl = table->cell_data[cell]->ctrl; in lv_table_set_cell_value_fmt()
150 if(table->cell_data[cell]) user_data = table->cell_data[cell]->user_data; in lv_table_set_cell_value_fmt()
174 …table->cell_data[cell] = lv_mem_realloc(table->cell_data[cell], sizeof(lv_table_cell_t) + len_ap +… in lv_table_set_cell_value_fmt()
175 LV_ASSERT_MALLOC(table->cell_data[cell]); in lv_table_set_cell_value_fmt()
176 if(table->cell_data[cell] == NULL) { in lv_table_set_cell_value_fmt()
180 _lv_txt_ap_proc(raw_txt, table->cell_data[cell]->txt); in lv_table_set_cell_value_fmt()
184 table->cell_data[cell] = lv_mem_realloc(table->cell_data[cell], in lv_table_set_cell_value_fmt()
186 LV_ASSERT_MALLOC(table->cell_data[cell]); in lv_table_set_cell_value_fmt()
187 if(table->cell_data[cell] == NULL) { in lv_table_set_cell_value_fmt()
192 table->cell_data[cell]->txt[len] = 0; /*Ensure NULL termination*/ in lv_table_set_cell_value_fmt()
194 lv_vsnprintf(table->cell_data[cell]->txt, len + 1, fmt, ap2); in lv_table_set_cell_value_fmt()
199 table->cell_data[cell]->ctrl = ctrl; in lv_table_set_cell_value_fmt()
201 table->cell_data[cell]->user_data = user_data; in lv_table_set_cell_value_fmt()
210 lv_table_t * table = (lv_table_t *)obj; in lv_table_set_row_cnt() local
212 if(table->row_cnt == row_cnt) return; in lv_table_set_row_cnt()
214 uint16_t old_row_cnt = table->row_cnt; in lv_table_set_row_cnt()
215 table->row_cnt = row_cnt; in lv_table_set_row_cnt()
217 table->row_h = lv_mem_realloc(table->row_h, table->row_cnt * sizeof(table->row_h[0])); in lv_table_set_row_cnt()
218 LV_ASSERT_MALLOC(table->row_h); in lv_table_set_row_cnt()
219 if(table->row_h == NULL) return; in lv_table_set_row_cnt()
223 uint16_t old_cell_cnt = old_row_cnt * table->col_cnt; in lv_table_set_row_cnt()
224 uint32_t new_cell_cnt = table->col_cnt * table->row_cnt; in lv_table_set_row_cnt()
228 if(table->cell_data[i]->user_data) { in lv_table_set_row_cnt()
229 lv_mem_free(table->cell_data[i]->user_data); in lv_table_set_row_cnt()
230 table->cell_data[i]->user_data = NULL; in lv_table_set_row_cnt()
233 lv_mem_free(table->cell_data[i]); in lv_table_set_row_cnt()
237 …table->cell_data = lv_mem_realloc(table->cell_data, table->row_cnt * table->col_cnt * sizeof(lv_ta… in lv_table_set_row_cnt()
238 LV_ASSERT_MALLOC(table->cell_data); in lv_table_set_row_cnt()
239 if(table->cell_data == NULL) return; in lv_table_set_row_cnt()
243 uint32_t old_cell_cnt = old_row_cnt * table->col_cnt; in lv_table_set_row_cnt()
244 uint32_t new_cell_cnt = table->col_cnt * table->row_cnt; in lv_table_set_row_cnt()
245 …lv_memset_00(&table->cell_data[old_cell_cnt], (new_cell_cnt - old_cell_cnt) * sizeof(table->cell_d… in lv_table_set_row_cnt()
255 lv_table_t * table = (lv_table_t *)obj; in lv_table_set_col_cnt() local
257 if(table->col_cnt == col_cnt) return; in lv_table_set_col_cnt()
259 uint16_t old_col_cnt = table->col_cnt; in lv_table_set_col_cnt()
260 table->col_cnt = col_cnt; in lv_table_set_col_cnt()
262 …lv_table_cell_t ** new_cell_data = lv_mem_alloc(table->row_cnt * table->col_cnt * sizeof(lv_table_… in lv_table_set_col_cnt()
265 uint32_t new_cell_cnt = table->col_cnt * table->row_cnt; in lv_table_set_col_cnt()
267 lv_memset_00(new_cell_data, new_cell_cnt * sizeof(table->cell_data[0])); in lv_table_set_col_cnt()
274 for(row = 0; row < table->row_cnt; row++) { in lv_table_set_col_cnt()
278 lv_memcpy_small(&new_cell_data[new_col_start], &table->cell_data[old_col_start], in lv_table_set_col_cnt()
286 if(table->cell_data[idx]->user_data) { in lv_table_set_col_cnt()
287 lv_mem_free(table->cell_data[idx]->user_data); in lv_table_set_col_cnt()
288 table->cell_data[idx]->user_data = NULL; in lv_table_set_col_cnt()
291 lv_mem_free(table->cell_data[idx]); in lv_table_set_col_cnt()
292 table->cell_data[idx] = NULL; in lv_table_set_col_cnt()
296 lv_mem_free(table->cell_data); in lv_table_set_col_cnt()
297 table->cell_data = new_cell_data; in lv_table_set_col_cnt()
300 table->col_w = lv_mem_realloc(table->col_w, col_cnt * sizeof(table->col_w[0])); in lv_table_set_col_cnt()
301 LV_ASSERT_MALLOC(table->col_w); in lv_table_set_col_cnt()
302 if(table->col_w == NULL) return; in lv_table_set_col_cnt()
306 table->col_w[col] = LV_DPI_DEF; in lv_table_set_col_cnt()
316 lv_table_t * table = (lv_table_t *)obj; in lv_table_set_col_width() local
319 if(col_id >= table->col_cnt) lv_table_set_col_cnt(obj, col_id + 1); in lv_table_set_col_width()
321 table->col_w[col_id] = w; in lv_table_set_col_width()
329 lv_table_t * table = (lv_table_t *)obj; in lv_table_add_cell_ctrl() local
332 if(col >= table->col_cnt) lv_table_set_col_cnt(obj, col + 1); in lv_table_add_cell_ctrl()
333 if(row >= table->row_cnt) lv_table_set_row_cnt(obj, row + 1); in lv_table_add_cell_ctrl()
335 uint32_t cell = row * table->col_cnt + col; in lv_table_add_cell_ctrl()
337 if(is_cell_empty(table->cell_data[cell])) { in lv_table_add_cell_ctrl()
338 table->cell_data[cell] = lv_mem_alloc(sizeof(lv_table_cell_t) + 1); /*+1: trailing '\0 */ in lv_table_add_cell_ctrl()
339 LV_ASSERT_MALLOC(table->cell_data[cell]); in lv_table_add_cell_ctrl()
340 if(table->cell_data[cell] == NULL) return; in lv_table_add_cell_ctrl()
342 table->cell_data[cell]->ctrl = 0; in lv_table_add_cell_ctrl()
344 table->cell_data[cell]->user_data = NULL; in lv_table_add_cell_ctrl()
346 table->cell_data[cell]->txt[0] = '\0'; in lv_table_add_cell_ctrl()
349 table->cell_data[cell]->ctrl |= ctrl; in lv_table_add_cell_ctrl()
356 lv_table_t * table = (lv_table_t *)obj; in lv_table_clear_cell_ctrl() local
359 if(col >= table->col_cnt) lv_table_set_col_cnt(obj, col + 1); in lv_table_clear_cell_ctrl()
360 if(row >= table->row_cnt) lv_table_set_row_cnt(obj, row + 1); in lv_table_clear_cell_ctrl()
362 uint32_t cell = row * table->col_cnt + col; in lv_table_clear_cell_ctrl()
364 if(is_cell_empty(table->cell_data[cell])) { in lv_table_clear_cell_ctrl()
365 table->cell_data[cell] = lv_mem_alloc(sizeof(lv_table_cell_t) + 1); /*+1: trailing '\0 */ in lv_table_clear_cell_ctrl()
366 LV_ASSERT_MALLOC(table->cell_data[cell]); in lv_table_clear_cell_ctrl()
367 if(table->cell_data[cell] == NULL) return; in lv_table_clear_cell_ctrl()
369 table->cell_data[cell]->ctrl = 0; in lv_table_clear_cell_ctrl()
371 table->cell_data[cell]->user_data = NULL; in lv_table_clear_cell_ctrl()
373 table->cell_data[cell]->txt[0] = '\0'; in lv_table_clear_cell_ctrl()
376 table->cell_data[cell]->ctrl &= (~ctrl); in lv_table_clear_cell_ctrl()
384 lv_table_t * table = (lv_table_t *)obj; in lv_table_set_cell_user_data() local
387 if(col >= table->col_cnt) lv_table_set_col_cnt(obj, col + 1); in lv_table_set_cell_user_data()
388 if(row >= table->row_cnt) lv_table_set_row_cnt(obj, row + 1); in lv_table_set_cell_user_data()
390 uint32_t cell = row * table->col_cnt + col; in lv_table_set_cell_user_data()
392 if(is_cell_empty(table->cell_data[cell])) { in lv_table_set_cell_user_data()
393 table->cell_data[cell] = lv_mem_alloc(sizeof(lv_table_cell_t) + 1); /*+1: trailing '\0 */ in lv_table_set_cell_user_data()
394 LV_ASSERT_MALLOC(table->cell_data[cell]); in lv_table_set_cell_user_data()
395 if(table->cell_data[cell] == NULL) return; in lv_table_set_cell_user_data()
397 table->cell_data[cell]->ctrl = 0; in lv_table_set_cell_user_data()
398 table->cell_data[cell]->user_data = NULL; in lv_table_set_cell_user_data()
399 table->cell_data[cell]->txt[0] = '\0'; in lv_table_set_cell_user_data()
402 if(table->cell_data[cell]->user_data) { in lv_table_set_cell_user_data()
403 lv_mem_free(table->cell_data[cell]->user_data); in lv_table_set_cell_user_data()
406 table->cell_data[cell]->user_data = user_data; in lv_table_set_cell_user_data()
418 lv_table_t * table = (lv_table_t *)obj; in lv_table_get_cell_value() local
419 if(row >= table->row_cnt || col >= table->col_cnt) { in lv_table_get_cell_value()
423 uint32_t cell = row * table->col_cnt + col; in lv_table_get_cell_value()
425 if(is_cell_empty(table->cell_data[cell])) return ""; in lv_table_get_cell_value()
427 return table->cell_data[cell]->txt; in lv_table_get_cell_value()
434 lv_table_t * table = (lv_table_t *)obj; in lv_table_get_row_cnt() local
435 return table->row_cnt; in lv_table_get_row_cnt()
442 lv_table_t * table = (lv_table_t *)obj; in lv_table_get_col_cnt() local
443 return table->col_cnt; in lv_table_get_col_cnt()
450 lv_table_t * table = (lv_table_t *)obj; in lv_table_get_col_width() local
452 if(col >= table->col_cnt) { in lv_table_get_col_width()
457 return table->col_w[col]; in lv_table_get_col_width()
464 lv_table_t * table = (lv_table_t *)obj; in lv_table_has_cell_ctrl() local
465 if(row >= table->row_cnt || col >= table->col_cnt) { in lv_table_has_cell_ctrl()
469 uint32_t cell = row * table->col_cnt + col; in lv_table_has_cell_ctrl()
471 if(is_cell_empty(table->cell_data[cell])) return false; in lv_table_has_cell_ctrl()
472 else return (table->cell_data[cell]->ctrl & ctrl) == ctrl; in lv_table_has_cell_ctrl()
477 lv_table_t * table = (lv_table_t *)obj; in lv_table_get_selected_cell() local
478 *row = table->row_act; in lv_table_get_selected_cell()
479 *col = table->col_act; in lv_table_get_selected_cell()
487 lv_table_t * table = (lv_table_t *)obj; in lv_table_get_cell_user_data() local
488 if(row >= table->row_cnt || col >= table->col_cnt) { in lv_table_get_cell_user_data()
492 uint32_t cell = row * table->col_cnt + col; in lv_table_get_cell_user_data()
494 if(is_cell_empty(table->cell_data[cell])) return NULL; in lv_table_get_cell_user_data()
496 return table->cell_data[cell]->user_data; in lv_table_get_cell_user_data()
509 lv_table_t * table = (lv_table_t *)obj; in lv_table_constructor() local
511 table->col_cnt = 1; in lv_table_constructor()
512 table->row_cnt = 1; in lv_table_constructor()
513 table->col_w = lv_mem_alloc(table->col_cnt * sizeof(table->col_w[0])); in lv_table_constructor()
514 table->row_h = lv_mem_alloc(table->row_cnt * sizeof(table->row_h[0])); in lv_table_constructor()
515 table->col_w[0] = LV_DPI_DEF; in lv_table_constructor()
516 table->row_h[0] = LV_DPI_DEF; in lv_table_constructor()
517 …table->cell_data = lv_mem_realloc(table->cell_data, table->row_cnt * table->col_cnt * sizeof(lv_ta… in lv_table_constructor()
518 table->cell_data[0] = NULL; in lv_table_constructor()
526 lv_table_t * table = (lv_table_t *)obj; in lv_table_destructor() local
529 for(i = 0; i < table->col_cnt * table->row_cnt; i++) { in lv_table_destructor()
530 if(table->cell_data[i]) { in lv_table_destructor()
532 if(table->cell_data[i]->user_data) { in lv_table_destructor()
533 lv_mem_free(table->cell_data[i]->user_data); in lv_table_destructor()
534 table->cell_data[i]->user_data = NULL; in lv_table_destructor()
537 lv_mem_free(table->cell_data[i]); in lv_table_destructor()
538 table->cell_data[i] = NULL; in lv_table_destructor()
542 if(table->cell_data) lv_mem_free(table->cell_data); in lv_table_destructor()
543 if(table->row_h) lv_mem_free(table->row_h); in lv_table_destructor()
544 if(table->col_w) lv_mem_free(table->col_w); in lv_table_destructor()
559 lv_table_t * table = (lv_table_t *)obj; in lv_table_event() local
568 for(i = 0; i < table->col_cnt; i++) w += table->col_w[i]; in lv_table_event()
571 for(i = 0; i < table->row_cnt; i++) h += table->row_h[i]; in lv_table_event()
581 if(pr_res == LV_RES_OK && (table->col_act != col || table->row_act != row)) { in lv_table_event()
582 table->col_act = col; in lv_table_event()
583 table->row_act = row; in lv_table_event()
591 …if(table->col_act != LV_TABLE_CELL_NONE && table->row_act != LV_TABLE_CELL_NONE && scroll_obj == N… in lv_table_event()
598 table->col_act = LV_TABLE_CELL_NONE; in lv_table_event()
599 table->row_act = LV_TABLE_CELL_NONE; in lv_table_event()
607 int32_t col = table->col_act; in lv_table_event()
608 int32_t row = table->row_act; in lv_table_event()
610 table->col_act = 0; in lv_table_event()
611 table->row_act = 0; in lv_table_event()
617 if(col >= table->col_cnt) col = 0; in lv_table_event()
618 if(row >= table->row_cnt) row = 0; in lv_table_event()
626 if(col >= table->col_cnt) { in lv_table_event()
627 if(row < table->row_cnt - 1) { in lv_table_event()
632 col = table->col_cnt - 1; in lv_table_event()
637 col = table->col_cnt - 1; in lv_table_event()
645 if(row >= table->row_cnt) { in lv_table_event()
646 row = table->row_cnt - 1; in lv_table_event()
652 if(table->col_act != col || table->row_act != row) { in lv_table_event()
653 table->col_act = col; in lv_table_event()
654 table->row_act = row; in lv_table_event()
671 lv_table_t * table = (lv_table_t *)obj; in draw_main() local
720 for(row = 0; row < table->row_cnt; row++) { in draw_main()
721 lv_coord_t h_row = table->row_h[row]; in draw_main()
731 for(col = 0; col < table->col_cnt; col++) { in draw_main()
733 if(table->cell_data[cell]) ctrl = table->cell_data[cell]->ctrl; in draw_main()
737 cell_area.x1 = cell_area.x2 - table->col_w[col] + 1; in draw_main()
741 cell_area.x2 = cell_area.x1 + table->col_w[col] - 1; in draw_main()
745 for(col_merge = 0; col_merge + col < table->col_cnt - 1; col_merge++) { in draw_main()
746 lv_table_cell_t * next_cell_data = table->cell_data[cell + col_merge]; in draw_main()
752 lv_coord_t offset = table->col_w[col + col_merge + 1]; in draw_main()
786 if(row == table->row_act && col == table->col_act) { in draw_main()
811 part_draw_dsc.id = row * table->col_cnt + col; in draw_main()
816 if(table->cell_data[cell]) { in draw_main()
833 lv_txt_get_size(&txt_size, table->cell_data[cell]->txt, label_dsc_def.font, in draw_main()
848 … lv_draw_label(draw_ctx, &label_dsc_act, &txt_area, table->cell_data[cell]->txt, NULL); in draw_main()
878 lv_table_t * table = (lv_table_t *)obj; in refr_size_form_row() local
880 for(i = start_row; i < table->row_cnt; i++) { in refr_size_form_row()
883 table->row_h[i] = LV_CLAMP(minh, calculated_height, maxh); in refr_size_form_row()
904 lv_table_t * table = (lv_table_t *)obj; in refr_cell_size() local
908 lv_coord_t prev_row_size = table->row_h[row]; in refr_cell_size()
909 table->row_h[row] = LV_CLAMP(minh, calculated_height, maxh); in refr_cell_size()
912 if(prev_row_size == table->row_h[row]) { in refr_cell_size()
928 lv_table_t * table = (lv_table_t *)obj; in get_row_height() local
932 uint16_t row_start = row_id * table->col_cnt; in get_row_height()
937 for(cell = row_start, col = 0; cell < row_start + table->col_cnt; cell++, col++) { in get_row_height()
938 lv_table_cell_t * cell_data = table->cell_data[cell]; in get_row_height()
944 lv_coord_t txt_w = table->col_w[col]; in get_row_height()
950 for(col_merge = 0; col_merge + col < table->col_cnt - 1; col_merge++) { in get_row_height()
951 lv_table_cell_t * next_cell_data = table->cell_data[cell + col_merge]; in get_row_height()
957 txt_w += table->col_w[col + col_merge + 1]; in get_row_height()
976 lv_txt_get_size(&txt_size, table->cell_data[cell]->txt, font, in get_row_height()
991 lv_table_t * table = (lv_table_t *)obj; in get_pressed_cell() local
1017 for(*col = 0; *col < table->col_cnt; (*col)++) { in get_pressed_cell()
1018 tmp += table->col_w[*col]; in get_pressed_cell()
1031 for(*row = 0; *row < table->row_cnt; (*row)++) { in get_pressed_cell()
1032 tmp += table->row_h[*row]; in get_pressed_cell()
1066 lv_table_t * table = (lv_table_t *)obj; in get_cell_area() local
1071 area->x1 += table->col_w[c]; in get_cell_area()
1079 area->x1 = area->x2 - table->col_w[col]; in get_cell_area()
1084 area->x2 = area->x1 + table->col_w[col] - 1; in get_cell_area()
1090 area->y1 += table->row_h[r]; in get_cell_area()
1095 area->y2 = area->y1 + table->row_h[row] - 1; in get_cell_area()
1101 lv_table_t * table = (lv_table_t *)obj; in scroll_to_selected_cell() local
1104 get_cell_area(obj, table->row_act, table->col_act, &a); in scroll_to_selected_cell()