Lines Matching refs:btnm

98     lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj;  in lv_btnmatrix_set_map()  local
102 btnm->map_p = map; in lv_btnmatrix_set_map()
116 lv_coord_t max_h_no_gap = max_h - (prow * (btnm->row_cnt - 1)); in lv_btnmatrix_set_map()
126 for(row = 0; row < btnm->row_cnt; row++) { in lv_btnmatrix_set_map()
131 unit_cnt += get_button_width(btnm->ctrl_bits[btn_tot_i + btn_cnt]); in lv_btnmatrix_set_map()
141 lv_coord_t row_y1 = ptop + (max_h_no_gap * row) / btnm->row_cnt + row * prow; in lv_btnmatrix_set_map()
142 lv_coord_t row_y2 = ptop + (max_h_no_gap * (row + 1)) / btnm->row_cnt + row * prow - 1; in lv_btnmatrix_set_map()
151 uint32_t btn_u = get_button_width(btnm->ctrl_bits[btn_tot_i]); in lv_btnmatrix_set_map()
169 lv_area_set(&btnm->button_areas[btn_tot_i], btn_x1, row_y1, btn_x2, row_y2); in lv_btnmatrix_set_map()
188 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; in lv_btnmatrix_set_ctrl_map() local
189 lv_memcpy(btnm->ctrl_bits, ctrl_map, sizeof(lv_btnmatrix_ctrl_t) * btnm->btn_cnt); in lv_btnmatrix_set_ctrl_map()
191 lv_btnmatrix_set_map(obj, btnm->map_p); in lv_btnmatrix_set_ctrl_map()
198 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; in lv_btnmatrix_set_selected_btn() local
200 if(btn_id >= btnm->btn_cnt && btn_id != LV_BTNMATRIX_BTN_NONE) return; in lv_btnmatrix_set_selected_btn()
202 invalidate_button_area(obj, btnm->btn_id_sel); in lv_btnmatrix_set_selected_btn()
203 btnm->btn_id_sel = btn_id; in lv_btnmatrix_set_selected_btn()
211 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; in lv_btnmatrix_set_btn_ctrl() local
213 if(btn_id >= btnm->btn_cnt) return; in lv_btnmatrix_set_btn_ctrl()
215 if(btnm->one_check && (ctrl & LV_BTNMATRIX_CTRL_CHECKED)) { in lv_btnmatrix_set_btn_ctrl()
222 if(btnm->btn_cnt > 1) { in lv_btnmatrix_set_btn_ctrl()
223 for(uint16_t btn_idx = 0; btn_idx < btnm->btn_cnt; btn_idx++) { in lv_btnmatrix_set_btn_ctrl()
225 … if(!(btnm->ctrl_bits[btn_idx] & LV_BTNMATRIX_CTRL_HIDDEN)) all_buttons_hidden = false; in lv_btnmatrix_set_btn_ctrl()
232 btnm->ctrl_bits[btn_id] |= ctrl; in lv_btnmatrix_set_btn_ctrl()
244 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; in lv_btnmatrix_clear_btn_ctrl() local
246 if(btn_id >= btnm->btn_cnt) return; in lv_btnmatrix_clear_btn_ctrl()
253 btnm->ctrl_bits[btn_id] &= (~ctrl); in lv_btnmatrix_clear_btn_ctrl()
265 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj;; in lv_btnmatrix_set_btn_ctrl_all() local
267 for(i = 0; i < btnm->btn_cnt; i++) { in lv_btnmatrix_set_btn_ctrl_all()
276 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj;; in lv_btnmatrix_clear_btn_ctrl_all() local
278 for(i = 0; i < btnm->btn_cnt; i++) { in lv_btnmatrix_clear_btn_ctrl_all()
287 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj;; in lv_btnmatrix_set_btn_width() local
288 if(btn_id >= btnm->btn_cnt) return; in lv_btnmatrix_set_btn_width()
289 btnm->ctrl_bits[btn_id] &= (~LV_BTNMATRIX_WIDTH_MASK); in lv_btnmatrix_set_btn_width()
290 btnm->ctrl_bits[btn_id] |= (LV_BTNMATRIX_WIDTH_MASK & width); in lv_btnmatrix_set_btn_width()
292 lv_btnmatrix_set_map(obj, btnm->map_p); in lv_btnmatrix_set_btn_width()
299 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj;; in lv_btnmatrix_set_one_checked() local
300 btnm->one_check = en; in lv_btnmatrix_set_one_checked()
314 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj;; in lv_btnmatrix_get_map() local
315 return btnm->map_p; in lv_btnmatrix_get_map()
322 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj;; in lv_btnmatrix_get_selected_btn() local
323 return btnm->btn_id_sel; in lv_btnmatrix_get_selected_btn()
332 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; in lv_btnmatrix_get_btn_text() local
333 if(btn_id > btnm->btn_cnt) return NULL; in lv_btnmatrix_get_btn_text()
343 if(strcmp(btnm->map_p[txt_i], "\n") == 0) txt_i++; in lv_btnmatrix_get_btn_text()
346 if(btn_i == btnm->btn_cnt) return NULL; in lv_btnmatrix_get_btn_text()
348 return btnm->map_p[txt_i]; in lv_btnmatrix_get_btn_text()
355 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj;; in lv_btnmatrix_has_btn_ctrl() local
356 if(btn_id >= btnm->btn_cnt) return false; in lv_btnmatrix_has_btn_ctrl()
358 return ((btnm->ctrl_bits[btn_id] & ctrl) == ctrl) ? true : false; in lv_btnmatrix_has_btn_ctrl()
365 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj;; in lv_btnmatrix_get_one_checked() local
367 return btnm->one_check; in lv_btnmatrix_get_one_checked()
378 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; in lv_btnmatrix_constructor() local
379 btnm->btn_cnt = 0; in lv_btnmatrix_constructor()
380 btnm->row_cnt = 0; in lv_btnmatrix_constructor()
381 btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; in lv_btnmatrix_constructor()
382 btnm->button_areas = NULL; in lv_btnmatrix_constructor()
383 btnm->ctrl_bits = NULL; in lv_btnmatrix_constructor()
384 btnm->map_p = NULL; in lv_btnmatrix_constructor()
385 btnm->one_check = 0; in lv_btnmatrix_constructor()
396 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; in lv_btnmatrix_destructor() local
397 lv_mem_free(btnm->button_areas); in lv_btnmatrix_destructor()
398 lv_mem_free(btnm->ctrl_bits); in lv_btnmatrix_destructor()
399 btnm->button_areas = NULL; in lv_btnmatrix_destructor()
400 btnm->ctrl_bits = NULL; in lv_btnmatrix_destructor()
416 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; in lv_btnmatrix_event() local
422 lv_coord_t s = btnm->row_cnt > 0 ? lv_obj_get_content_height(obj) / btnm->row_cnt : 0; in lv_btnmatrix_event()
427 lv_btnmatrix_set_map(obj, btnm->map_p); in lv_btnmatrix_event()
430 lv_btnmatrix_set_map(obj, btnm->map_p); in lv_btnmatrix_event()
434 invalidate_button_area(obj, btnm->btn_id_sel); in lv_btnmatrix_event()
443 btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; in lv_btnmatrix_event()
445 if(button_is_inactive(btnm->ctrl_bits[btn_pr]) == false && in lv_btnmatrix_event()
446 button_is_hidden(btnm->ctrl_bits[btn_pr]) == false) { in lv_btnmatrix_event()
447 btnm->btn_id_sel = btn_pr; in lv_btnmatrix_event()
448 invalidate_button_area(obj, btnm->btn_id_sel); /*Invalidate the new area*/ in lv_btnmatrix_event()
452 btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; in lv_btnmatrix_event()
456 if(btnm->btn_id_sel != LV_BTNMATRIX_BTN_NONE) { in lv_btnmatrix_event()
457 if(button_is_click_trig(btnm->ctrl_bits[btnm->btn_id_sel]) == false && in lv_btnmatrix_event()
458 button_is_popover(btnm->ctrl_bits[btnm->btn_id_sel]) == false && in lv_btnmatrix_event()
459 button_is_inactive(btnm->ctrl_bits[btnm->btn_id_sel]) == false && in lv_btnmatrix_event()
460 button_is_hidden(btnm->ctrl_bits[btnm->btn_id_sel]) == false) { in lv_btnmatrix_event()
461 uint32_t b = btnm->btn_id_sel; in lv_btnmatrix_event()
478 if(btn_pr != btnm->btn_id_sel) { in lv_btnmatrix_event()
479 if(btnm->btn_id_sel != LV_BTNMATRIX_BTN_NONE) { in lv_btnmatrix_event()
480 invalidate_button_area(obj, btnm->btn_id_sel); in lv_btnmatrix_event()
483 btnm->btn_id_sel = btn_pr; in lv_btnmatrix_event()
487 button_is_inactive(btnm->ctrl_bits[btn_pr]) == false && in lv_btnmatrix_event()
488 button_is_hidden(btnm->ctrl_bits[btn_pr]) == false) { in lv_btnmatrix_event()
491 if(button_is_click_trig(btnm->ctrl_bits[btn_pr]) == false && in lv_btnmatrix_event()
492 button_is_popover(btnm->ctrl_bits[btnm->btn_id_sel]) == false) { in lv_btnmatrix_event()
501 if(btnm->btn_id_sel != LV_BTNMATRIX_BTN_NONE) { in lv_btnmatrix_event()
503 if(button_is_checkable(btnm->ctrl_bits[btnm->btn_id_sel]) && in lv_btnmatrix_event()
504 !button_is_inactive(btnm->ctrl_bits[btnm->btn_id_sel])) { in lv_btnmatrix_event()
505 if(button_get_checked(btnm->ctrl_bits[btnm->btn_id_sel]) && !btnm->one_check) { in lv_btnmatrix_event()
506 btnm->ctrl_bits[btnm->btn_id_sel] &= (~LV_BTNMATRIX_CTRL_CHECKED); in lv_btnmatrix_event()
509 btnm->ctrl_bits[btnm->btn_id_sel] |= LV_BTNMATRIX_CTRL_CHECKED; in lv_btnmatrix_event()
511 if(btnm->one_check) make_one_button_checked(obj, btnm->btn_id_sel); in lv_btnmatrix_event()
514 if((button_is_click_trig(btnm->ctrl_bits[btnm->btn_id_sel]) == true || in lv_btnmatrix_event()
515 button_is_popover(btnm->ctrl_bits[btnm->btn_id_sel]) == true) && in lv_btnmatrix_event()
516 button_is_inactive(btnm->ctrl_bits[btnm->btn_id_sel]) == false && in lv_btnmatrix_event()
517 button_is_hidden(btnm->ctrl_bits[btnm->btn_id_sel]) == false) { in lv_btnmatrix_event()
518 uint32_t b = btnm->btn_id_sel; in lv_btnmatrix_event()
525 invalidate_button_area(obj, btnm->btn_id_sel); in lv_btnmatrix_event()
529 if(btnm->btn_id_sel != LV_BTNMATRIX_BTN_NONE) { in lv_btnmatrix_event()
530 if(button_is_repeat_disabled(btnm->ctrl_bits[btnm->btn_id_sel]) == false && in lv_btnmatrix_event()
531 button_is_inactive(btnm->ctrl_bits[btnm->btn_id_sel]) == false && in lv_btnmatrix_event()
532 button_is_hidden(btnm->ctrl_bits[btnm->btn_id_sel]) == false) { in lv_btnmatrix_event()
533 uint32_t b = btnm->btn_id_sel; in lv_btnmatrix_event()
540 invalidate_button_area(obj, btnm->btn_id_sel); in lv_btnmatrix_event()
541 btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; in lv_btnmatrix_event()
544 if(btnm->btn_cnt == 0) return; in lv_btnmatrix_event()
557 if(btnm->btn_id_sel == LV_BTNMATRIX_BTN_NONE) { in lv_btnmatrix_event()
560 if(btnm->one_check) { in lv_btnmatrix_event()
561 … while(button_is_hidden(btnm->ctrl_bits[b]) || button_is_inactive(btnm->ctrl_bits[b]) || in lv_btnmatrix_event()
562 button_is_checked(btnm->ctrl_bits[b]) == false) b++; in lv_btnmatrix_event()
565 … while(button_is_hidden(btnm->ctrl_bits[b]) || button_is_inactive(btnm->ctrl_bits[b])) b++; in lv_btnmatrix_event()
568 btnm->btn_id_sel = b; in lv_btnmatrix_event()
571 btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; in lv_btnmatrix_event()
576 if(btnm->btn_id_sel != LV_BTNMATRIX_BTN_NONE) invalidate_button_area(obj, btnm->btn_id_sel); in lv_btnmatrix_event()
577 btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; in lv_btnmatrix_event()
581 invalidate_button_area(obj, btnm->btn_id_sel); in lv_btnmatrix_event()
585 if(btnm->btn_id_sel == LV_BTNMATRIX_BTN_NONE) btnm->btn_id_sel = 0; in lv_btnmatrix_event()
586 else btnm->btn_id_sel++; in lv_btnmatrix_event()
587 if(btnm->btn_id_sel >= btnm->btn_cnt) btnm->btn_id_sel = 0; in lv_btnmatrix_event()
589 uint16_t btn_id_start = btnm->btn_id_sel; in lv_btnmatrix_event()
590 …while(button_is_hidden(btnm->ctrl_bits[btnm->btn_id_sel]) || button_is_inactive(btnm->ctrl_bits[bt… in lv_btnmatrix_event()
591 btnm->btn_id_sel++; in lv_btnmatrix_event()
592 if(btnm->btn_id_sel >= btnm->btn_cnt) btnm->btn_id_sel = 0; in lv_btnmatrix_event()
594 if(btnm->btn_id_sel == btn_id_start) { in lv_btnmatrix_event()
595 btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; in lv_btnmatrix_event()
601 if(btnm->btn_id_sel == LV_BTNMATRIX_BTN_NONE) btnm->btn_id_sel = 0; in lv_btnmatrix_event()
603 if(btnm->btn_id_sel == 0) btnm->btn_id_sel = btnm->btn_cnt - 1; in lv_btnmatrix_event()
604 else if(btnm->btn_id_sel > 0) btnm->btn_id_sel--; in lv_btnmatrix_event()
606 uint16_t btn_id_start = btnm->btn_id_sel; in lv_btnmatrix_event()
607 …while(button_is_hidden(btnm->ctrl_bits[btnm->btn_id_sel]) || button_is_inactive(btnm->ctrl_bits[bt… in lv_btnmatrix_event()
608 if(btnm->btn_id_sel > 0) btnm->btn_id_sel--; in lv_btnmatrix_event()
609 else btnm->btn_id_sel = btnm->btn_cnt - 1; in lv_btnmatrix_event()
611 if(btnm->btn_id_sel == btn_id_start) { in lv_btnmatrix_event()
612 btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; in lv_btnmatrix_event()
620 if(btnm->btn_id_sel == LV_BTNMATRIX_BTN_NONE) { in lv_btnmatrix_event()
621 btnm->btn_id_sel = 0; in lv_btnmatrix_event()
622 …while(button_is_hidden(btnm->ctrl_bits[btnm->btn_id_sel]) || button_is_inactive(btnm->ctrl_bits[bt… in lv_btnmatrix_event()
623 btnm->btn_id_sel++; in lv_btnmatrix_event()
624 if(btnm->btn_id_sel >= btnm->btn_cnt) { in lv_btnmatrix_event()
625 btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; in lv_btnmatrix_event()
633btnm->button_areas[btnm->btn_id_sel].x1 + (lv_area_get_width(&btnm->button_areas[btnm->btn_id_sel]… in lv_btnmatrix_event()
635 for(area_below = btnm->btn_id_sel; area_below < btnm->btn_cnt; area_below++) { in lv_btnmatrix_event()
636 … if(btnm->button_areas[area_below].y1 > btnm->button_areas[btnm->btn_id_sel].y1 && in lv_btnmatrix_event()
637 pr_center >= btnm->button_areas[area_below].x1 && in lv_btnmatrix_event()
638 pr_center <= btnm->button_areas[area_below].x2 + col_gap && in lv_btnmatrix_event()
639 button_is_inactive(btnm->ctrl_bits[area_below]) == false && in lv_btnmatrix_event()
640 button_is_hidden(btnm->ctrl_bits[area_below]) == false) { in lv_btnmatrix_event()
645 if(area_below < btnm->btn_cnt) btnm->btn_id_sel = area_below; in lv_btnmatrix_event()
651 if(btnm->btn_id_sel == LV_BTNMATRIX_BTN_NONE) { in lv_btnmatrix_event()
652 btnm->btn_id_sel = 0; in lv_btnmatrix_event()
653 …while(button_is_hidden(btnm->ctrl_bits[btnm->btn_id_sel]) || button_is_inactive(btnm->ctrl_bits[bt… in lv_btnmatrix_event()
654 btnm->btn_id_sel++; in lv_btnmatrix_event()
655 if(btnm->btn_id_sel >= btnm->btn_cnt) { in lv_btnmatrix_event()
656 btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; in lv_btnmatrix_event()
664btnm->button_areas[btnm->btn_id_sel].x1 + (lv_area_get_width(&btnm->button_areas[btnm->btn_id_sel]… in lv_btnmatrix_event()
666 for(area_above = btnm->btn_id_sel; area_above >= 0; area_above--) { in lv_btnmatrix_event()
667 … if(btnm->button_areas[area_above].y1 < btnm->button_areas[btnm->btn_id_sel].y1 && in lv_btnmatrix_event()
668 pr_center >= btnm->button_areas[area_above].x1 - col_gap && in lv_btnmatrix_event()
669 pr_center <= btnm->button_areas[area_above].x2 && in lv_btnmatrix_event()
670 button_is_inactive(btnm->ctrl_bits[area_above]) == false && in lv_btnmatrix_event()
671 button_is_hidden(btnm->ctrl_bits[area_above]) == false) { in lv_btnmatrix_event()
675 if(area_above >= 0) btnm->btn_id_sel = area_above; in lv_btnmatrix_event()
679 invalidate_button_area(obj, btnm->btn_id_sel); in lv_btnmatrix_event()
690 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; in draw_main() local
691 if(btnm->btn_cnt == 0) return; in draw_main()
738 for(btn_i = 0; btn_i < btnm->btn_cnt; btn_i++, txt_i++) { in draw_main()
740 while(strcmp(btnm->map_p[txt_i], "\n") == 0) { in draw_main()
745 if(button_is_hidden(btnm->ctrl_bits[btn_i])) continue; in draw_main()
749 if(button_get_checked(btnm->ctrl_bits[btn_i])) btn_state |= LV_STATE_CHECKED; in draw_main()
751 if(button_is_inactive(btnm->ctrl_bits[btn_i])) btn_state |= LV_STATE_DISABLED; in draw_main()
752 else if(btn_i == btnm->btn_id_sel) { in draw_main()
760 lv_area_copy(&btn_area, &btnm->button_areas[btn_i]); in draw_main()
783 bool recolor = button_is_recolor(btnm->ctrl_bits[btn_i]); in draw_main()
802 if((btn_state & LV_STATE_PRESSED) && (btnm->ctrl_bits[btn_i] & LV_BTNMATRIX_CTRL_POPOVER)) { in draw_main()
814 const char * txt = btnm->map_p[txt_i]; in draw_main()
833 if((btn_state & LV_STATE_PRESSED) && (btnm->ctrl_bits[btn_i] & LV_BTNMATRIX_CTRL_POPOVER)) { in draw_main()
857 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; in allocate_btn_areas_and_controls() local
858 btnm->row_cnt = 1; in allocate_btn_areas_and_controls()
867 btnm->row_cnt++; in allocate_btn_areas_and_controls()
873 if(btn_cnt == btnm->btn_cnt) return; in allocate_btn_areas_and_controls()
875 if(btnm->button_areas != NULL) { in allocate_btn_areas_and_controls()
876 lv_mem_free(btnm->button_areas); in allocate_btn_areas_and_controls()
877 btnm->button_areas = NULL; in allocate_btn_areas_and_controls()
879 if(btnm->ctrl_bits != NULL) { in allocate_btn_areas_and_controls()
880 lv_mem_free(btnm->ctrl_bits); in allocate_btn_areas_and_controls()
881 btnm->ctrl_bits = NULL; in allocate_btn_areas_and_controls()
884 btnm->button_areas = lv_mem_alloc(sizeof(lv_area_t) * btn_cnt); in allocate_btn_areas_and_controls()
885 LV_ASSERT_MALLOC(btnm->button_areas); in allocate_btn_areas_and_controls()
886 btnm->ctrl_bits = lv_mem_alloc(sizeof(lv_btnmatrix_ctrl_t) * btn_cnt); in allocate_btn_areas_and_controls()
887 LV_ASSERT_MALLOC(btnm->ctrl_bits); in allocate_btn_areas_and_controls()
888 if(btnm->button_areas == NULL || btnm->ctrl_bits == NULL) btn_cnt = 0; in allocate_btn_areas_and_controls()
890 lv_memset_00(btnm->ctrl_bits, sizeof(lv_btnmatrix_ctrl_t) * btn_cnt); in allocate_btn_areas_and_controls()
892 btnm->btn_cnt = btn_cnt; in allocate_btn_areas_and_controls()
960 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj;; in get_button_from_point() local
983 for(i = 0; i < btnm->btn_cnt; i++) { in get_button_from_point()
984 lv_area_copy(&btn_area, &btnm->button_areas[i]); in get_button_from_point()
1004 if(i == btnm->btn_cnt) i = LV_BTNMATRIX_BTN_NONE; in get_button_from_point()
1016 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj;; in invalidate_button_area() local
1017 if(btn_idx >= btnm->btn_cnt) return; in invalidate_button_area()
1019 lv_area_copy(&btn_area, &btnm->button_areas[btn_idx]); in invalidate_button_area()
1038 if((btn_idx == btnm->btn_id_sel) && (btnm->ctrl_bits[btn_idx] & LV_BTNMATRIX_CTRL_POPOVER)) { in invalidate_button_area()
1069 lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; in has_popovers_in_top_row() local
1071 if(btnm->row_cnt <= 0) { in has_popovers_in_top_row()
1075 const char ** map_row = btnm->map_p; in has_popovers_in_top_row()
1079 if(button_is_popover(btnm->ctrl_bits[btn_cnt])) { in has_popovers_in_top_row()