Lines Matching refs:options
179 void lv_dropdown_set_options(lv_obj_t * obj, const char * options) in lv_dropdown_set_options() argument
182 LV_ASSERT_NULL(options); in lv_dropdown_set_options()
189 for(i = 0; options[i] != '\0'; i++) { in lv_dropdown_set_options()
190 if(options[i] == '\n') dropdown->option_cnt++; in lv_dropdown_set_options()
198 size_t len = lv_strlen(options) + 1; in lv_dropdown_set_options()
200 size_t len = lv_text_ap_calc_bytes_count(options) + 1; in lv_dropdown_set_options()
203 if(dropdown->options != NULL && dropdown->static_txt == 0) { in lv_dropdown_set_options()
204 lv_free(dropdown->options); in lv_dropdown_set_options()
205 dropdown->options = NULL; in lv_dropdown_set_options()
208 dropdown->options = lv_malloc(len); in lv_dropdown_set_options()
210 LV_ASSERT_MALLOC(dropdown->options); in lv_dropdown_set_options()
211 if(dropdown->options == NULL) return; in lv_dropdown_set_options()
214 lv_strcpy(dropdown->options, options); in lv_dropdown_set_options()
216 lv_text_ap_proc(options, dropdown->options); in lv_dropdown_set_options()
226 void lv_dropdown_set_options_static(lv_obj_t * obj, const char * options) in lv_dropdown_set_options_static() argument
229 LV_ASSERT_NULL(options); in lv_dropdown_set_options_static()
236 for(i = 0; options[i] != '\0'; i++) { in lv_dropdown_set_options_static()
237 if(options[i] == '\n') dropdown->option_cnt++; in lv_dropdown_set_options_static()
243 if(dropdown->static_txt == 0 && dropdown->options != NULL) { in lv_dropdown_set_options_static()
244 lv_free(dropdown->options); in lv_dropdown_set_options_static()
245 dropdown->options = NULL; in lv_dropdown_set_options_static()
249 dropdown->options = (char *)options; in lv_dropdown_set_options_static()
264 char * static_options = dropdown->options; in lv_dropdown_add_option()
265 dropdown->options = lv_strdup(static_options); in lv_dropdown_add_option()
266 LV_ASSERT_MALLOC(dropdown->options); in lv_dropdown_add_option()
267 if(dropdown->options == NULL) return; in lv_dropdown_add_option()
272 size_t old_len = (dropdown->options == NULL) ? 0 : lv_strlen(dropdown->options); in lv_dropdown_add_option()
280 dropdown->options = lv_realloc(dropdown->options, new_len + 1); in lv_dropdown_add_option()
281 LV_ASSERT_MALLOC(dropdown->options); in lv_dropdown_add_option()
282 if(dropdown->options == NULL) return; in lv_dropdown_add_option()
284 dropdown->options[old_len] = '\0'; in lv_dropdown_add_option()
290 for(insert_pos = 0; dropdown->options[insert_pos] != 0; insert_pos++) { in lv_dropdown_add_option()
293 if(dropdown->options[insert_pos] == '\n') in lv_dropdown_add_option()
300 …lv_text_ins(dropdown->options, lv_text_encoded_get_char_id(dropdown->options, insert_pos++), "\n"); in lv_dropdown_add_option()
313 …lv_text_ins(dropdown->options, lv_text_encoded_get_char_id(dropdown->options, insert_pos), ins_buf… in lv_dropdown_add_option()
326 if(dropdown->options == NULL) return; in lv_dropdown_clear_options()
329 lv_free(dropdown->options); in lv_dropdown_clear_options()
331 dropdown->options = NULL; in lv_dropdown_clear_options()
411 return dropdown->options == NULL ? "" : dropdown->options; in lv_dropdown_get_options()
442 if(dropdown->options) { in lv_dropdown_get_selected_str()
443 txt_len = lv_strlen(dropdown->options); in lv_dropdown_get_selected_str()
451 if(dropdown->options[i] == '\n') line++; in lv_dropdown_get_selected_str()
455 for(c = 0; i < txt_len && dropdown->options[i] != '\n'; c++, i++) { in lv_dropdown_get_selected_str()
460 buf[c] = dropdown->options[i]; in lv_dropdown_get_selected_str()
530 lv_label_set_text_static(label, dropdown->options); in lv_dropdown_open()
596 … lv_text_align_t align = lv_obj_calculate_style_text_align(label, LV_PART_MAIN, dropdown->options); in lv_dropdown_open()
655 dropdown->options = NULL; in lv_dropdown_constructor()
689 lv_free(dropdown->options); in lv_dropdown_destructor()
690 dropdown->options = NULL; in lv_dropdown_destructor()