Lines Matching refs:options
106 ext->options = NULL; in lv_dropdown_create()
184 if(ext->options == NULL) return; in lv_dropdown_clear_options()
187 lv_mem_free(ext->options); in lv_dropdown_clear_options()
189 ext->options = NULL; in lv_dropdown_clear_options()
202 void lv_dropdown_set_options(lv_obj_t * ddlist, const char * options) in lv_dropdown_set_options() argument
205 LV_ASSERT_STR(options); in lv_dropdown_set_options()
212 for(i = 0; options[i] != '\0'; i++) { in lv_dropdown_set_options()
213 if(options[i] == '\n') ext->option_cnt++; in lv_dropdown_set_options()
220 size_t len = strlen(options) + 1; in lv_dropdown_set_options()
221 if(ext->options != NULL && ext->static_txt == 0) { in lv_dropdown_set_options()
222 lv_mem_free(ext->options); in lv_dropdown_set_options()
223 ext->options = NULL; in lv_dropdown_set_options()
226 ext->options = lv_mem_alloc(len); in lv_dropdown_set_options()
228 LV_ASSERT_MEM(ext->options); in lv_dropdown_set_options()
229 if(ext->options == NULL) return; in lv_dropdown_set_options()
231 strcpy(ext->options, options); in lv_dropdown_set_options()
242 void lv_dropdown_set_options_static(lv_obj_t * ddlist, const char * options) in lv_dropdown_set_options_static() argument
245 LV_ASSERT_STR(options); in lv_dropdown_set_options_static()
252 for(i = 0; options[i] != '\0'; i++) { in lv_dropdown_set_options_static()
253 if(options[i] == '\n') ext->option_cnt++; in lv_dropdown_set_options_static()
259 if(ext->static_txt == 0 && ext->options != NULL) { in lv_dropdown_set_options_static()
260 lv_mem_free(ext->options); in lv_dropdown_set_options_static()
261 ext->options = NULL; in lv_dropdown_set_options_static()
265 ext->options = (char *)options; in lv_dropdown_set_options_static()
283 char * static_options = ext->options; in lv_dropdown_add_option()
286 ext->options = lv_mem_alloc(len); in lv_dropdown_add_option()
287 LV_ASSERT_MEM(ext->options); in lv_dropdown_add_option()
288 if(ext->options == NULL) return; in lv_dropdown_add_option()
290 strcpy(ext->options, static_options); in lv_dropdown_add_option()
295 size_t old_len = (ext->options == NULL) ? 0 : strlen(ext->options); in lv_dropdown_add_option()
298 ext->options = lv_mem_realloc(ext->options, new_len + 1); in lv_dropdown_add_option()
299 LV_ASSERT_MEM(ext->options); in lv_dropdown_add_option()
300 if(ext->options == NULL) return; in lv_dropdown_add_option()
302 ext->options[old_len] = 0; in lv_dropdown_add_option()
308 for(insert_pos = 0; ext->options[insert_pos] != 0; insert_pos++) { in lv_dropdown_add_option()
311 if(ext->options[insert_pos] == '\n') in lv_dropdown_add_option()
318 _lv_txt_ins(ext->options, _lv_txt_encoded_get_char_id(ext->options, insert_pos++), "\n"); in lv_dropdown_add_option()
327 _lv_txt_ins(ext->options, _lv_txt_encoded_get_char_id(ext->options, insert_pos), ins_buf); in lv_dropdown_add_option()
455 return ext->options; in lv_dropdown_get_options()
500 size_t txt_len = strlen(ext->options); in lv_dropdown_get_selected_str()
503 if(ext->options[i] == '\n') line++; in lv_dropdown_get_selected_str()
507 for(c = 0; i < txt_len && ext->options[i] != '\n'; c++, i++) { in lv_dropdown_get_selected_str()
512 buf[c] = ext->options[i]; in lv_dropdown_get_selected_str()
617 lv_label_set_text_static(label, ext->options); in lv_dropdown_open()
907 lv_mem_free(ext->options); in lv_dropdown_signal()
908 ext->options = NULL; in lv_dropdown_signal()