2021-04-08 13:07:48 +02:00
|
|
|
#include "../../lv_examples.h"
|
2021-02-14 14:56:34 +01:00
|
|
|
#if LV_USE_BAR && LV_BUILD_EXAMPLES
|
2021-02-08 09:53:03 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Bar with LTR and RTL base direction
|
|
|
|
*/
|
|
|
|
void lv_example_bar_5(void)
|
|
|
|
{
|
2021-05-02 21:05:09 +02:00
|
|
|
lv_obj_t * label;
|
|
|
|
|
|
|
|
|
2021-03-25 13:36:50 +01:00
|
|
|
lv_obj_t * bar_ltr = lv_bar_create(lv_scr_act());
|
2021-02-08 09:53:03 +01:00
|
|
|
lv_obj_set_size(bar_ltr, 200, 20);
|
|
|
|
lv_bar_set_value(bar_ltr, 70, LV_ANIM_OFF);
|
2021-03-25 16:14:17 +01:00
|
|
|
lv_obj_align(bar_ltr, LV_ALIGN_CENTER, 0, -30);
|
2021-05-02 21:05:09 +02:00
|
|
|
|
|
|
|
label = lv_label_create(lv_scr_act());
|
|
|
|
lv_label_set_text(label, "Left to Right base direction");
|
|
|
|
lv_obj_align_to(label, bar_ltr, LV_ALIGN_OUT_TOP_MID, 0, -5);
|
2021-02-08 09:53:03 +01:00
|
|
|
|
2021-03-25 13:36:50 +01:00
|
|
|
lv_obj_t * bar_rtl = lv_bar_create(lv_scr_act());
|
2021-02-08 09:53:03 +01:00
|
|
|
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);
|
2021-03-25 16:14:17 +01:00
|
|
|
lv_obj_align(bar_rtl, LV_ALIGN_CENTER, 0, 30);
|
2021-05-02 21:05:09 +02:00
|
|
|
|
|
|
|
label = lv_label_create(lv_scr_act());
|
|
|
|
lv_label_set_text(label, "Right to Left base direction");
|
|
|
|
lv_obj_align_to(label, bar_rtl, LV_ALIGN_OUT_TOP_MID, 0, -5);
|
2021-02-08 09:53:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|