Lines Matching refs:roller

53 static void transform_vect_recursive(lv_obj_t * roller, lv_point_t * vect);
133 lv_roller_t * roller = (lv_roller_t *)obj; in lv_roller_set_options() local
136 roller->sel_opt_id = 0; in lv_roller_set_options()
137 roller->sel_opt_id_ori = 0; in lv_roller_set_options()
140 roller->option_cnt = 0; in lv_roller_set_options()
143 if(options[cnt] == '\n') roller->option_cnt++; in lv_roller_set_options()
145 roller->option_cnt++; /*Last option has no `\n`*/ in lv_roller_set_options()
148 roller->mode = LV_ROLLER_MODE_NORMAL; in lv_roller_set_options()
152 roller->mode = LV_ROLLER_MODE_INFINITE; in lv_roller_set_options()
155 …int32_t normal_h = roller->option_cnt * (lv_font_get_line_height(font) + lv_obj_get_style_text_let… in lv_roller_set_options()
156 roller->inf_page_cnt = LV_CLAMP(3, EXTRA_INF_SIZE / normal_h, 15); in lv_roller_set_options()
157 if(!(roller->inf_page_cnt & 1)) roller->inf_page_cnt++; /*Make it odd*/ in lv_roller_set_options()
158 … LV_LOG_INFO("Using %" LV_PRIu32 " pages to make the roller look infinite", roller->inf_page_cnt); in lv_roller_set_options()
161 size_t opt_extra_len = opt_len * roller->inf_page_cnt; in lv_roller_set_options()
169 for(i = 0; i < roller->inf_page_cnt; i++) { in lv_roller_set_options()
177 roller->sel_opt_id = ((roller->inf_page_cnt / 2) + 0) * roller->option_cnt; in lv_roller_set_options()
179 roller->option_cnt = roller->option_cnt * roller->inf_page_cnt; in lv_roller_set_options()
183 roller->sel_opt_id_ori = roller->sel_opt_id; in lv_roller_set_options()
197 lv_roller_t * roller = (lv_roller_t *)obj; in lv_roller_set_selected() local
200 if(roller->mode == LV_ROLLER_MODE_INFINITE) { in lv_roller_set_selected()
201 uint32_t real_option_cnt = roller->option_cnt / roller->inf_page_cnt; in lv_roller_set_selected()
202 uint32_t current_page = roller->sel_opt_id / real_option_cnt; in lv_roller_set_selected()
206 uint32_t act_opt = roller->sel_opt_id - current_page * real_option_cnt; in lv_roller_set_selected()
217 roller->sel_opt_id = sel_opt < roller->option_cnt ? sel_opt : roller->option_cnt - 1; in lv_roller_set_selected()
218 roller->sel_opt_id_ori = roller->sel_opt_id; in lv_roller_set_selected()
268 lv_roller_t * roller = (lv_roller_t *)obj; in lv_roller_get_selected() local
269 if(roller->mode == LV_ROLLER_MODE_INFINITE) { in lv_roller_get_selected()
270 uint32_t real_id_cnt = roller->option_cnt / roller->inf_page_cnt; in lv_roller_get_selected()
271 return roller->sel_opt_id % real_id_cnt; in lv_roller_get_selected()
274 return roller->sel_opt_id; in lv_roller_get_selected()
282 lv_roller_t * roller = (lv_roller_t *)obj; in lv_roller_get_selected_str() local
289 for(i = 0; i < txt_len && line != roller->sel_opt_id; i++) { in lv_roller_get_selected_str()
321 lv_roller_t * roller = (lv_roller_t *)obj; in lv_roller_get_option_count() local
322 if(roller->mode == LV_ROLLER_MODE_INFINITE) { in lv_roller_get_option_count()
323 return roller->option_cnt / roller->inf_page_cnt; in lv_roller_get_option_count()
326 return roller->option_cnt; in lv_roller_get_option_count()
337 lv_roller_t * roller = (lv_roller_t *)obj; in lv_roller_constructor() local
339 roller->mode = LV_ROLLER_MODE_NORMAL; in lv_roller_constructor()
340 roller->option_cnt = 0; in lv_roller_constructor()
341 roller->sel_opt_id = 0; in lv_roller_constructor()
342 roller->sel_opt_id_ori = 0; in lv_roller_constructor()
368 lv_roller_t * roller = (lv_roller_t *)obj; in lv_roller_event() local
385 if(roller->option_cnt <= 1) return; in lv_roller_event()
387 roller->moved = 0; in lv_roller_event()
391 if(roller->option_cnt <= 1) return; in lv_roller_event()
400 roller->moved = 1; in lv_roller_event()
404 if(roller->option_cnt <= 1) return; in lv_roller_event()
418 roller->sel_opt_id_ori = roller->sel_opt_id; in lv_roller_event()
421 if(roller->sel_opt_id != roller->sel_opt_id_ori) { in lv_roller_event()
422 roller->sel_opt_id = roller->sel_opt_id_ori; in lv_roller_event()
430 roller->sel_opt_id_ori = roller->sel_opt_id; in lv_roller_event()
435 if(roller->sel_opt_id != roller->sel_opt_id_ori) { in lv_roller_event()
436 roller->sel_opt_id = roller->sel_opt_id_ori; in lv_roller_event()
441 if(roller->option_cnt <= 1) return; in lv_roller_event()
445 if(roller->sel_opt_id + 1 < roller->option_cnt) { in lv_roller_event()
446 … uint32_t ori_id = roller->sel_opt_id_ori; /*lv_roller_set_selected will overwrite this*/ in lv_roller_event()
447 lv_roller_set_selected(obj, roller->sel_opt_id + 1, LV_ANIM_ON); in lv_roller_event()
448 roller->sel_opt_id_ori = ori_id; in lv_roller_event()
452 if(roller->sel_opt_id > 0) { in lv_roller_event()
453 … uint32_t ori_id = roller->sel_opt_id_ori; /*lv_roller_set_selected will overwrite this*/ in lv_roller_event()
454 lv_roller_set_selected(obj, roller->sel_opt_id - 1, LV_ANIM_ON); in lv_roller_event()
455 roller->sel_opt_id_ori = ori_id; in lv_roller_event()
460 if(roller->option_cnt <= 1) return; in lv_roller_event()
463 int32_t new_id = roller->sel_opt_id + r; in lv_roller_event()
464 new_id = LV_CLAMP(0, new_id, (int32_t)roller->option_cnt - 1); in lv_roller_event()
465 if((int32_t)roller->sel_opt_id != new_id) { in lv_roller_event()
466 uint32_t ori_id = roller->sel_opt_id_ori; /*lv_roller_set_selected will overwrite this*/ in lv_roller_event()
468 roller->sel_opt_id_ori = ori_id; in lv_roller_event()
598 lv_obj_t * roller = lv_obj_get_parent(label_obj); in draw_label() local
603 lv_obj_init_draw_label_dsc(roller, LV_PART_MAIN, &label_draw_dsc); in draw_label()
611 if(!lv_area_intersect(&roller_clip_area, &layer->_clip_area, &roller->coords)) return; in draw_label()
615 get_sel_area(roller, &sel_area); in draw_label()
706 lv_roller_t * roller = (lv_roller_t *)obj; in refr_position() local
707 int32_t id = roller->sel_opt_id; in refr_position()
735 lv_roller_t * roller = (lv_roller_t *)obj; in release_handler() local
740 roller->sel_opt_id_ori = roller->sel_opt_id; in release_handler()
753 if(roller->moved == 0) { in release_handler()
799 if(id >= (int32_t)roller->option_cnt) id = roller->option_cnt - 1; in release_handler()
809 uint32_t id = roller->sel_opt_id; /*Just to use uint32_t in event data*/ in release_handler()
820 lv_roller_t * roller = (lv_roller_t *)obj; in inf_normalize() local
822 if(roller->mode == LV_ROLLER_MODE_INFINITE) { in inf_normalize()
823 uint32_t real_id_cnt = roller->option_cnt / roller->inf_page_cnt; in inf_normalize()
824 roller->sel_opt_id = roller->sel_opt_id % real_id_cnt; in inf_normalize()
825 roller->sel_opt_id += (roller->inf_page_cnt / 2) * real_id_cnt; /*Select the middle page*/ in inf_normalize()
827 roller->sel_opt_id_ori = roller->sel_opt_id % real_id_cnt; in inf_normalize()
828roller->sel_opt_id_ori += (roller->inf_page_cnt / 2) * real_id_cnt; /*Select the middle page*/ in inf_normalize()
838 int32_t sel_y1 = roller->sel_opt_id * (font_h + line_space); in inf_normalize()
874 static void transform_vect_recursive(lv_obj_t * roller, lv_point_t * vect) in transform_vect_recursive() argument
879 lv_obj_t * parent = roller; in transform_vect_recursive()