api(style) add lv_style_selector_t instead of lv_part_t and lv_state_t in style API

This commit is contained in:
Gabor Kiss-Vamosi
2021-03-31 19:57:14 +02:00
parent 0527874f8d
commit 663bcfd030
63 changed files with 763 additions and 734 deletions

View File

@@ -22,9 +22,9 @@ void lv_example_bar_2(void)
lv_style_set_radius(&style_indic, 3);
lv_obj_t * bar = lv_bar_create(lv_scr_act());
lv_obj_remove_style(bar, LV_PART_ANY, LV_STATE_ANY, NULL); /*To have a clean start*/
lv_obj_add_style(bar, LV_PART_MAIN, LV_STATE_DEFAULT, &style_bg);
lv_obj_add_style(bar, LV_PART_INDICATOR, LV_STATE_DEFAULT, &style_indic);
lv_obj_remove_style_all(bar); /*To have a clean start*/
lv_obj_add_style(bar, &style_bg, 0);
lv_obj_add_style(bar, &style_indic, LV_PART_INDICATOR);
lv_obj_set_size(bar, 200, 20);
lv_obj_center(bar);

View File

@@ -27,7 +27,7 @@ void lv_example_bar_3(void)
// lv_style_set_content_color(&style_indic, lv_color_grey());
lv_obj_t * bar = lv_bar_create(lv_scr_act());
lv_obj_add_style(bar, LV_PART_INDICATOR, LV_STATE_DEFAULT, &style_indic);
lv_obj_add_style(bar, &style_indic, LV_PART_INDICATOR);
lv_obj_set_size(bar, 20, 200);
lv_obj_center(bar);
lv_bar_set_range(bar, -20, 40);

View File

@@ -15,7 +15,7 @@ void lv_example_bar_4(void)
lv_style_set_bg_img_opa(&style_indic, LV_OPA_30);
lv_obj_t * bar = lv_bar_create(lv_scr_act());
lv_obj_add_style(bar, LV_PART_INDICATOR, LV_STATE_DEFAULT, &style_indic);
lv_obj_add_style(bar, &style_indic, LV_PART_INDICATOR);
lv_obj_set_size(bar, 260, 20);
lv_obj_center(bar);

View File

@@ -10,16 +10,16 @@ void lv_example_bar_5(void)
lv_obj_set_size(bar_ltr, 200, 20);
lv_bar_set_value(bar_ltr, 70, LV_ANIM_OFF);
lv_obj_align(bar_ltr, LV_ALIGN_CENTER, 0, -30);
// lv_obj_add_style(bar_ltr, LV_PART_MAIN, LV_STATE_DEFAULT, &style_bg);
// lv_obj_set_style_content_text(bar_ltr, LV_PART_MAIN, LV_STATE_DEFAULT, "Left to Right base direction");
// lv_obj_add_style(bar_ltr, &style_bg);
// lv_obj_set_style_content_text(bar_ltr, "Left to Right base direction");
lv_obj_t * bar_rtl = lv_bar_create(lv_scr_act());
lv_obj_set_base_dir(bar_rtl, LV_BIDI_DIR_RTL);
lv_obj_set_size(bar_rtl, 200, 20);
lv_bar_set_value(bar_rtl, 70, LV_ANIM_OFF);
lv_obj_align(bar_rtl, LV_ALIGN_CENTER, 0, 30);
// lv_obj_add_style(bar_rtl, LV_PART_MAIN, LV_STATE_DEFAULT, &style_bg);
// lv_obj_set_style_content_text(bar_rtl, LV_PART_MAIN, LV_STATE_DEFAULT, "Right to Left base direction");
// lv_obj_add_style(bar_rtl, &style_bg);
// lv_obj_set_style_content_text(bar_rtl, "Right to Left base direction");
}
#endif