diff --git a/Kconfig b/Kconfig index 8991c4bb02..e47c39c89c 100644 --- a/Kconfig +++ b/Kconfig @@ -1090,7 +1090,7 @@ menu "LVGL configuration" config LV_USE_ARC bool "Arc" default y if !LV_CONF_MINIMAL - config LV_USE_ARC_LABEL + config LV_USE_ARCLABEL bool "Arc Label" default y if !LV_CONF_MINIMAL config LV_USE_BAR diff --git a/docs/src/details/widgets/arc_label.rst b/docs/src/details/widgets/arc_label.rst deleted file mode 100644 index 198dac2993..0000000000 --- a/docs/src/details/widgets/arc_label.rst +++ /dev/null @@ -1,100 +0,0 @@ -.. _lv_arc_label: - -======================== -Arc Label (lv_arc_label) -======================== - - -Overview -******** - -The Arc Label is a specialized widget designed to display text along an arc. It allows for flexible text placement and styling, making it suitable for applications where text needs to follow a curved path, such as in gauges, dials, or custom interfaces. The widget supports various configurations, including text alignment, direction, radius adjustment, and color customization. - -.. _lv_arc_label_parts_and_styles: - -Parts and Styles -**************** - -- :cpp:enumerator:`LV_PART_MAIN` Represents the main part of the Arc Label, including the arc path and the text rendered along it. The appearance of the text and the arc can be customized using typical text and background style properties. - -.. _lv_arc_label_usage: - -Usage -***** - -Text Management ---------------- - -- Text can be set using :cpp:expr:`lv_arc_label_set_text(arc_label, "Your text")`. -- For formatted text, use :cpp:expr:`lv_arc_label_set_text_fmt(arc_label, "Formatted %s", "text")`. -- Static text can be set with :cpp:expr:`lv_arc_label_set_text_static(arc_label, static_text)`, which avoids dynamic memory allocation. - -Angle Configuration -------------------- - -- Set the starting angle of the arc with :cpp:expr:`lv_arc_label_set_angle_start(arc_label, angle)`. -- Define the arc size (angular span) using :cpp:expr:`lv_arc_label_set_angle_size(arc_label, size)`. -- Angles are measured in degrees, starting from the positive x-axis (3 o'clock position) and increasing clockwise. - -Direction ---------- - -Specify the text direction along the arc using :cpp:expr:`lv_arc_label_set_dir(arc_label, LV_ARC_LABEL_DIR_CLOCKWISE)` or :cpp:expr:`lv_arc_label_set_dir(arc_label, LV_ARC_LABEL_DIR_COUNTERCLOCKWISE)`. - -- :cpp:enumerator:`LV_ARC_LABEL_DIR_CLOCKWISE` Text flows in a clockwise direction along the arc. -- :cpp:enumerator:`LV_ARC_LABEL_DIR_COUNTERCLOCKWISE` Text flows in a counter-clockwise direction along the arc. - -Alignment ---------- - -Adjust vertical text alignment with :cpp:expr:`lv_arc_label_set_text_vertical_align(arc_label, LV_ARC_LABEL_TEXT_ALIGN_CENTER)`. -Set horizontal alignment using :cpp:expr:`lv_arc_label_set_text_horizontal_align(arc_label, LV_ARC_LABEL_TEXT_ALIGN_CENTER)`. - -Both vertical and horizontal use the same logic. - -- :cpp:enumerator:`LV_ARC_LABEL_TEXT_ALIGN_DEFAULT` Uses the default alignment. -- :cpp:enumerator:`LV_ARC_LABEL_TEXT_ALIGN_LEADING` Aligns text to the leading edge of the arc. -- :cpp:enumerator:`LV_ARC_LABEL_TEXT_ALIGN_CENTER` Centers text along the arc. -- :cpp:enumerator:`LV_ARC_LABEL_TEXT_ALIGN_TRAILING` Aligns text to the trailing edge of the arc. - -Radius and Center Offset ------------------------- - -- Set the radius of the arc with :cpp:expr:`lv_arc_label_set_radius(arc_label, radius)`. -- Adjust the center offset of the arc using :cpp:expr:`lv_arc_label_set_center_offset_x(arc_label, x)` and :cpp:expr:`lv_arc_label_set_center_offset_y(arc_label, y)`. - -Color and Recoloring --------------------- - -Enable text recoloring with :cpp:expr:`lv_arc_label_set_recolor(arc_label, true)`. This allows parts of the text to be colored differently using color commands embedded in the text string. - -Interactive Behavior --------------------- - -By default, Arc Label is not clickable. To make it interactive, you would need to add custom event handling, as it does not inherit clickability by default. - -.. _lv_arc_label_events: - -Events -****** - -The Arc Label primarily inherits events from the base object class. It does not define specific events beyond those common to all widgets. You can attach custom event handlers to respond to interactions if needed. - -.. _lv_arc_label_keys: - -Keys -**** - -The Arc Label does not define specific key bindings beyond those inherited from the base object class. Keyboard navigation and interaction would require additional implementation. - -.. _lv_arc_label_example: - -Example -******* - -.. include:: ../../examples/widgets/arc_label/index.rst - -.. _lv_arc_label_api: - -API -*** diff --git a/docs/src/details/widgets/arclabel.rst b/docs/src/details/widgets/arclabel.rst new file mode 100644 index 0000000000..3f89a052b1 --- /dev/null +++ b/docs/src/details/widgets/arclabel.rst @@ -0,0 +1,100 @@ +.. _lv_arclabel: + +======================== +Arc Label (lv_arclabel) +======================== + + +Overview +******** + +The Arc Label is a specialized widget designed to display text along an arc. It allows for flexible text placement and styling, making it suitable for applications where text needs to follow a curved path, such as in gauges, dials, or custom interfaces. The widget supports various configurations, including text alignment, direction, radius adjustment, and color customization. + +.. _lv_arclabel_parts_and_styles: + +Parts and Styles +**************** + +- :cpp:enumerator:`LV_PART_MAIN` Represents the main part of the Arc Label, including the arc path and the text rendered along it. The appearance of the text and the arc can be customized using typical text and background style properties. + +.. _lv_arclabel_usage: + +Usage +***** + +Text Management +--------------- + +- Text can be set using :cpp:expr:`lv_arclabel_set_text(arclabel, "Your text")`. +- For formatted text, use :cpp:expr:`lv_arclabel_set_text_fmt(arclabel, "Formatted %s", "text")`. +- Static text can be set with :cpp:expr:`lv_arclabel_set_text_static(arclabel, static_text)`, which avoids dynamic memory allocation. + +Angle Configuration +------------------- + +- Set the starting angle of the arc with :cpp:expr:`lv_arclabel_set_angle_start(arclabel, angle)`. +- Define the arc size (angular span) using :cpp:expr:`lv_arclabel_set_angle_size(arclabel, size)`. +- Angles are measured in degrees, starting from the positive x-axis (3 o'clock position) and increasing clockwise. + +Direction +--------- + +Specify the text direction along the arc using :cpp:expr:`lv_arclabel_set_dir(arclabel, LV_ARCLABEL_DIR_CLOCKWISE)` or :cpp:expr:`lv_arclabel_set_dir(arclabel, LV_ARCLABEL_DIR_COUNTERCLOCKWISE)`. + +- :cpp:enumerator:`LV_ARCLABEL_DIR_CLOCKWISE` Text flows in a clockwise direction along the arc. +- :cpp:enumerator:`LV_ARCLABEL_DIR_COUNTERCLOCKWISE` Text flows in a counter-clockwise direction along the arc. + +Alignment +--------- + +Adjust vertical text alignment with :cpp:expr:`lv_arclabel_set_text_vertical_align(arclabel, LV_ARCLABEL_TEXT_ALIGN_CENTER)`. +Set horizontal alignment using :cpp:expr:`lv_arclabel_set_text_horizontal_align(arclabel, LV_ARCLABEL_TEXT_ALIGN_CENTER)`. + +Both vertical and horizontal use the same logic. + +- :cpp:enumerator:`LV_ARCLABEL_TEXT_ALIGN_DEFAULT` Uses the default alignment. +- :cpp:enumerator:`LV_ARCLABEL_TEXT_ALIGN_LEADING` Aligns text to the leading edge of the arc. +- :cpp:enumerator:`LV_ARCLABEL_TEXT_ALIGN_CENTER` Centers text along the arc. +- :cpp:enumerator:`LV_ARCLABEL_TEXT_ALIGN_TRAILING` Aligns text to the trailing edge of the arc. + +Radius and Center Offset +------------------------ + +- Set the radius of the arc with :cpp:expr:`lv_arclabel_set_radius(arclabel, radius)`. +- Adjust the center offset of the arc using :cpp:expr:`lv_arclabel_set_center_offset_x(arclabel, x)` and :cpp:expr:`lv_arclabel_set_center_offset_y(arclabel, y)`. + +Color and Recoloring +-------------------- + +Enable text recoloring with :cpp:expr:`lv_arclabel_set_recolor(arclabel, true)`. This allows parts of the text to be colored differently using color commands embedded in the text string. + +Interactive Behavior +-------------------- + +By default, Arc Label is not clickable. To make it interactive, you would need to add custom event handling, as it does not inherit clickability by default. + +.. _lv_arclabel_events: + +Events +****** + +The Arc Label primarily inherits events from the base object class. It does not define specific events beyond those common to all widgets. You can attach custom event handlers to respond to interactions if needed. + +.. _lv_arclabel_keys: + +Keys +**** + +The Arc Label does not define specific key bindings beyond those inherited from the base object class. Keyboard navigation and interaction would require additional implementation. + +.. _lv_arclabel_example: + +Example +******* + +.. include:: ../../examples/widgets/arclabel/index.rst + +.. _lv_arclabel_api: + +API +*** diff --git a/docs/src/details/widgets/index.rst b/docs/src/details/widgets/index.rst index 94ae36a654..3162853245 100644 --- a/docs/src/details/widgets/index.rst +++ b/docs/src/details/widgets/index.rst @@ -17,7 +17,7 @@ All Widgets 3dtexture animimg arc - arc_label + arclabel bar button buttonmatrix diff --git a/examples/widgets/arc_label/lv_example_arc_label_1.c b/examples/widgets/arc_label/lv_example_arc_label_1.c deleted file mode 100644 index 13c30c48d5..0000000000 --- a/examples/widgets/arc_label/lv_example_arc_label_1.c +++ /dev/null @@ -1,80 +0,0 @@ -#include "../../lv_examples.h" - -#if LV_USE_ARC_LABEL && LV_BUILD_EXAMPLES - -static const char * ARC_LABEL_TEXT = - "I'm on an #FA7C45 ARC#! Centered with #12c2E9 C##8B68E8 O##c471ed L##B654E5 O##C84AB2 R##DB417A F##f64659 U##ff8888 L# feature!\n"; - -void lv_example_arc_label_1(void) -{ - lv_obj_t * arc_label_inner = NULL; - lv_obj_t * arc_label_outer = NULL; - lv_obj_t * arc_label_slogan_1 = NULL; - lv_obj_t * arc_label_slogan_2 = NULL; - - lv_obj_set_style_bg_color(lv_screen_active(), lv_color_black(), LV_PART_MAIN); - - arc_label_inner = lv_arc_label_create(lv_screen_active()); - lv_obj_set_size(arc_label_inner, 200, 200); - lv_obj_set_style_text_color(arc_label_inner, lv_color_white(), LV_PART_MAIN); - lv_arc_label_set_text_static(arc_label_inner, ARC_LABEL_TEXT); - lv_arc_label_set_angle_start(arc_label_inner, 180); - lv_arc_label_set_radius(arc_label_inner, LV_PCT(80)); - lv_arc_label_set_recolor(arc_label_inner, true); - lv_arc_label_set_text_vertical_align(arc_label_inner, LV_ARC_LABEL_TEXT_ALIGN_TRAILING); - lv_arc_label_set_dir(arc_label_inner, LV_ARC_LABEL_DIR_COUNTER_CLOCKWISE); - lv_arc_label_set_text_horizontal_align(arc_label_inner, LV_ARC_LABEL_TEXT_ALIGN_CENTER); - lv_obj_center(arc_label_inner); - - arc_label_outer = lv_arc_label_create(lv_screen_active()); - lv_obj_set_size(arc_label_outer, 200, 200); - lv_obj_set_style_text_letter_space(arc_label_outer, 2, LV_PART_MAIN); - lv_obj_set_style_text_color(arc_label_outer, lv_color_hex(0x888888), LV_PART_MAIN); - lv_arc_label_set_angle_start(arc_label_outer, -180); - lv_arc_label_set_text_static(arc_label_outer, ARC_LABEL_TEXT); - lv_arc_label_set_radius(arc_label_outer, LV_PCT(100)); - lv_arc_label_set_recolor(arc_label_outer, true); - lv_arc_label_set_text_vertical_align(arc_label_outer, LV_ARC_LABEL_TEXT_ALIGN_LEADING); - lv_arc_label_set_dir(arc_label_outer, LV_ARC_LABEL_DIR_CLOCKWISE); - lv_arc_label_set_text_horizontal_align(arc_label_outer, LV_ARC_LABEL_TEXT_ALIGN_CENTER); - lv_obj_center(arc_label_outer); - - arc_label_slogan_1 = lv_arc_label_create(lv_screen_active()); - lv_obj_set_size(arc_label_slogan_1, 300, 200); - lv_obj_set_style_text_letter_space(arc_label_slogan_1, 2, LV_PART_MAIN); - lv_obj_set_style_text_color(arc_label_slogan_1, lv_palette_main(LV_PALETTE_AMBER), LV_PART_MAIN); - lv_arc_label_set_text_static(arc_label_slogan_1, "STAY HUNGRY"); - lv_arc_label_set_offset(arc_label_slogan_1, 30); - lv_arc_label_set_radius(arc_label_slogan_1, 150); - lv_arc_label_set_recolor(arc_label_slogan_1, true); - lv_arc_label_set_text_vertical_align(arc_label_slogan_1, LV_ARC_LABEL_TEXT_ALIGN_TRAILING); - lv_arc_label_set_text_horizontal_align(arc_label_slogan_1, LV_ARC_LABEL_TEXT_ALIGN_CENTER); - lv_arc_label_set_dir(arc_label_slogan_1, LV_ARC_LABEL_DIR_COUNTER_CLOCKWISE); - lv_obj_center(arc_label_slogan_1); - - arc_label_slogan_2 = lv_arc_label_create(lv_screen_active()); - lv_obj_set_size(arc_label_slogan_2, 300, 200); - lv_obj_set_style_text_letter_space(arc_label_slogan_2, 2, LV_PART_MAIN); - lv_obj_set_style_text_color(arc_label_slogan_2, lv_palette_main(LV_PALETTE_AMBER), LV_PART_MAIN); - lv_arc_label_set_text_static(arc_label_slogan_2, "STAY FOOLISH"); - lv_arc_label_set_offset(arc_label_slogan_2, 30); - lv_arc_label_set_radius(arc_label_slogan_2, 150); - lv_arc_label_set_angle_start(arc_label_slogan_2, 180); - lv_arc_label_set_recolor(arc_label_slogan_2, true); - lv_arc_label_set_text_vertical_align(arc_label_slogan_2, LV_ARC_LABEL_TEXT_ALIGN_TRAILING); - lv_arc_label_set_text_horizontal_align(arc_label_slogan_2, LV_ARC_LABEL_TEXT_ALIGN_CENTER); - lv_arc_label_set_dir(arc_label_slogan_2, LV_ARC_LABEL_DIR_COUNTER_CLOCKWISE); - lv_obj_center(arc_label_slogan_2); - - -#if LV_FONT_MONTSERRAT_18 - lv_obj_set_style_text_font(arc_label_inner, &lv_font_montserrat_18, LV_PART_MAIN); - lv_obj_set_style_text_font(arc_label_outer, &lv_font_montserrat_18, LV_PART_MAIN); -#endif -#if LV_FONT_MONTSERRAT_24 - lv_obj_set_style_text_font(arc_label_slogan_1, &lv_font_montserrat_24, LV_PART_MAIN); - lv_obj_set_style_text_font(arc_label_slogan_2, &lv_font_montserrat_24, LV_PART_MAIN); -#endif -} - -#endif diff --git a/examples/widgets/arc_label/index.rst b/examples/widgets/arclabel/index.rst similarity index 67% rename from examples/widgets/arc_label/index.rst rename to examples/widgets/arclabel/index.rst index 5cdc217bf2..cb2c0abd67 100644 --- a/examples/widgets/arc_label/index.rst +++ b/examples/widgets/arclabel/index.rst @@ -1,6 +1,6 @@ Simple Arc Label ---------------- -.. lv_example:: widgets/arc_label/lv_example_arc_label_1 +.. lv_example:: widgets/arclabel/lv_example_arclabel_1 :language: c :description: A simple example to demonstrate the use of an arc label. diff --git a/examples/widgets/arclabel/lv_example_arclabel_1.c b/examples/widgets/arclabel/lv_example_arclabel_1.c new file mode 100644 index 0000000000..104f77e765 --- /dev/null +++ b/examples/widgets/arclabel/lv_example_arclabel_1.c @@ -0,0 +1,80 @@ +#include "../../lv_examples.h" + +#if LV_USE_ARCLABEL && LV_BUILD_EXAMPLES + +static const char * ARCLABEL_TEXT = + "I'm on an #FA7C45 ARC#! Centered with #12c2E9 C##8B68E8 O##c471ed L##B654E5 O##C84AB2 R##DB417A F##f64659 U##ff8888 L# feature!\n"; + +void lv_example_arclabel_1(void) +{ + lv_obj_t * arclabel_inner = NULL; + lv_obj_t * arclabel_outer = NULL; + lv_obj_t * arclabel_slogan_1 = NULL; + lv_obj_t * arclabel_slogan_2 = NULL; + + lv_obj_set_style_bg_color(lv_screen_active(), lv_color_black(), LV_PART_MAIN); + + arclabel_inner = lv_arclabel_create(lv_screen_active()); + lv_obj_set_size(arclabel_inner, 200, 200); + lv_obj_set_style_text_color(arclabel_inner, lv_color_white(), LV_PART_MAIN); + lv_arclabel_set_text_static(arclabel_inner, ARCLABEL_TEXT); + lv_arclabel_set_angle_start(arclabel_inner, 180); + lv_arclabel_set_radius(arclabel_inner, LV_PCT(80)); + lv_arclabel_set_recolor(arclabel_inner, true); + lv_arclabel_set_text_vertical_align(arclabel_inner, LV_ARCLABEL_TEXT_ALIGN_TRAILING); + lv_arclabel_set_dir(arclabel_inner, LV_ARCLABEL_DIR_COUNTER_CLOCKWISE); + lv_arclabel_set_text_horizontal_align(arclabel_inner, LV_ARCLABEL_TEXT_ALIGN_CENTER); + lv_obj_center(arclabel_inner); + + arclabel_outer = lv_arclabel_create(lv_screen_active()); + lv_obj_set_size(arclabel_outer, 200, 200); + lv_obj_set_style_text_letter_space(arclabel_outer, 2, LV_PART_MAIN); + lv_obj_set_style_text_color(arclabel_outer, lv_color_hex(0x888888), LV_PART_MAIN); + lv_arclabel_set_angle_start(arclabel_outer, -180); + lv_arclabel_set_text_static(arclabel_outer, ARCLABEL_TEXT); + lv_arclabel_set_radius(arclabel_outer, LV_PCT(100)); + lv_arclabel_set_recolor(arclabel_outer, true); + lv_arclabel_set_text_vertical_align(arclabel_outer, LV_ARCLABEL_TEXT_ALIGN_LEADING); + lv_arclabel_set_dir(arclabel_outer, LV_ARCLABEL_DIR_CLOCKWISE); + lv_arclabel_set_text_horizontal_align(arclabel_outer, LV_ARCLABEL_TEXT_ALIGN_CENTER); + lv_obj_center(arclabel_outer); + + arclabel_slogan_1 = lv_arclabel_create(lv_screen_active()); + lv_obj_set_size(arclabel_slogan_1, 300, 200); + lv_obj_set_style_text_letter_space(arclabel_slogan_1, 2, LV_PART_MAIN); + lv_obj_set_style_text_color(arclabel_slogan_1, lv_palette_main(LV_PALETTE_AMBER), LV_PART_MAIN); + lv_arclabel_set_text_static(arclabel_slogan_1, "STAY HUNGRY"); + lv_arclabel_set_offset(arclabel_slogan_1, 30); + lv_arclabel_set_radius(arclabel_slogan_1, 150); + lv_arclabel_set_recolor(arclabel_slogan_1, true); + lv_arclabel_set_text_vertical_align(arclabel_slogan_1, LV_ARCLABEL_TEXT_ALIGN_TRAILING); + lv_arclabel_set_text_horizontal_align(arclabel_slogan_1, LV_ARCLABEL_TEXT_ALIGN_CENTER); + lv_arclabel_set_dir(arclabel_slogan_1, LV_ARCLABEL_DIR_COUNTER_CLOCKWISE); + lv_obj_center(arclabel_slogan_1); + + arclabel_slogan_2 = lv_arclabel_create(lv_screen_active()); + lv_obj_set_size(arclabel_slogan_2, 300, 200); + lv_obj_set_style_text_letter_space(arclabel_slogan_2, 2, LV_PART_MAIN); + lv_obj_set_style_text_color(arclabel_slogan_2, lv_palette_main(LV_PALETTE_AMBER), LV_PART_MAIN); + lv_arclabel_set_text_static(arclabel_slogan_2, "STAY FOOLISH"); + lv_arclabel_set_offset(arclabel_slogan_2, 30); + lv_arclabel_set_radius(arclabel_slogan_2, 150); + lv_arclabel_set_angle_start(arclabel_slogan_2, 180); + lv_arclabel_set_recolor(arclabel_slogan_2, true); + lv_arclabel_set_text_vertical_align(arclabel_slogan_2, LV_ARCLABEL_TEXT_ALIGN_TRAILING); + lv_arclabel_set_text_horizontal_align(arclabel_slogan_2, LV_ARCLABEL_TEXT_ALIGN_CENTER); + lv_arclabel_set_dir(arclabel_slogan_2, LV_ARCLABEL_DIR_COUNTER_CLOCKWISE); + lv_obj_center(arclabel_slogan_2); + + +#if LV_FONT_MONTSERRAT_18 + lv_obj_set_style_text_font(arclabel_inner, &lv_font_montserrat_18, LV_PART_MAIN); + lv_obj_set_style_text_font(arclabel_outer, &lv_font_montserrat_18, LV_PART_MAIN); +#endif +#if LV_FONT_MONTSERRAT_24 + lv_obj_set_style_text_font(arclabel_slogan_1, &lv_font_montserrat_24, LV_PART_MAIN); + lv_obj_set_style_text_font(arclabel_slogan_2, &lv_font_montserrat_24, LV_PART_MAIN); +#endif +} + +#endif diff --git a/examples/widgets/lv_example_widgets.h b/examples/widgets/lv_example_widgets.h index 5c1611fc52..b24e77e458 100644 --- a/examples/widgets/lv_example_widgets.h +++ b/examples/widgets/lv_example_widgets.h @@ -31,7 +31,7 @@ void lv_example_arc_1(void); void lv_example_arc_2(void); void lv_example_arc_3(void); -void lv_example_arc_label_1(void); +void lv_example_arclabel_1(void); void lv_example_bar_1(void); void lv_example_bar_2(void); diff --git a/lv_conf_template.h b/lv_conf_template.h index 1c0ce4fe66..5580d99091 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -699,7 +699,7 @@ * - lv_dropdown_t : Options set to "Option 1", "Option 2", "Option 3", else no values are set. * - lv_roller_t : Options set to "Option 1", "Option 2", "Option 3", "Option 4", "Option 5", else no values are set. * - lv_label_t : Text set to "Text", else empty string. - * - lv_arc_label_t : Text set to "Arced Text", else empty string. + * - lv_arclabel_t : Text set to "Arced Text", else empty string. * */ #define LV_WIDGETS_HAS_DEFAULT_VALUE 1 @@ -707,7 +707,7 @@ #define LV_USE_ARC 1 -#define LV_USE_ARC_LABEL 1 +#define LV_USE_ARCLABEL 1 #define LV_USE_BAR 1 diff --git a/lvgl.h b/lvgl.h index 1f419cf1f9..4dc19ac459 100644 --- a/lvgl.h +++ b/lvgl.h @@ -53,7 +53,7 @@ extern "C" { #include "src/widgets/animimage/lv_animimage.h" #include "src/widgets/arc/lv_arc.h" -#include "src/widgets/arc_label/lv_arc_label.h" +#include "src/widgets/arclabel/lv_arclabel.h" #include "src/widgets/bar/lv_bar.h" #include "src/widgets/button/lv_button.h" #include "src/widgets/buttonmatrix/lv_buttonmatrix.h" diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index e4e6bb2569..53bccb99e8 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -2030,7 +2030,7 @@ * - lv_dropdown_t : Options set to "Option 1", "Option 2", "Option 3", else no values are set. * - lv_roller_t : Options set to "Option 1", "Option 2", "Option 3", "Option 4", "Option 5", else no values are set. * - lv_label_t : Text set to "Text", else empty string. - * - lv_arc_label_t : Text set to "Arced Text", else empty string. + * - lv_arclabel_t : Text set to "Arced Text", else empty string. * */ #ifndef LV_WIDGETS_HAS_DEFAULT_VALUE #ifdef LV_KCONFIG_PRESENT @@ -2068,15 +2068,15 @@ #endif #endif -#ifndef LV_USE_ARC_LABEL +#ifndef LV_USE_ARCLABEL #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_ARC_LABEL - #define LV_USE_ARC_LABEL CONFIG_LV_USE_ARC_LABEL + #ifdef CONFIG_LV_USE_ARCLABEL + #define LV_USE_ARCLABEL CONFIG_LV_USE_ARCLABEL #else - #define LV_USE_ARC_LABEL 0 + #define LV_USE_ARCLABEL 0 #endif #else - #define LV_USE_ARC_LABEL 1 + #define LV_USE_ARCLABEL 1 #endif #endif diff --git a/src/misc/lv_types.h b/src/misc/lv_types.h index 769c93d511..0df7500fa8 100644 --- a/src/misc/lv_types.h +++ b/src/misc/lv_types.h @@ -197,7 +197,7 @@ typedef struct _lv_animimg_t lv_animimg_t; typedef struct _lv_arc_t lv_arc_t; -typedef struct _lv_arc_label_t lv_arc_label_t; +typedef struct _lv_arclabel_t lv_arclabel_t; typedef struct _lv_label_t lv_label_t; diff --git a/src/widgets/arc_label/lv_arc_label.c b/src/widgets/arclabel/lv_arclabel.c similarity index 68% rename from src/widgets/arc_label/lv_arc_label.c rename to src/widgets/arclabel/lv_arclabel.c index ca67535129..812d38c29b 100644 --- a/src/widgets/arc_label/lv_arc_label.c +++ b/src/widgets/arclabel/lv_arclabel.c @@ -1,5 +1,5 @@ /** - * @file lv_arc_label.c + * @file lv_arclabel.c * */ @@ -7,9 +7,9 @@ * INCLUDES *********************/ -#include "lv_arc_label_private.h" +#include "lv_arclabel_private.h" -#if LV_USE_ARC_LABEL != 0 +#if LV_USE_ARCLABEL != 0 #include "../../core/lv_obj_class_private.h" #include "../../core/lv_obj_event_private.h" @@ -33,9 +33,9 @@ * DEFINES *********************/ -#define MY_CLASS (&lv_arc_label_class) +#define MY_CLASS (&lv_arclabel_class) -#define LV_ARC_LABEL_DEBUG 0 +#define LV_ARCLABEL_DEBUG 0 /********************** * TYPEDEFS @@ -45,9 +45,9 @@ * STATIC PROTOTYPES **********************/ -static void lv_arc_label_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void arc_label_draw_main(lv_event_t * e); -static void lv_arc_label_event(const lv_obj_class_t * class_p, lv_event_t * e); +static void lv_arclabel_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void arclabel_draw_main(lv_event_t * e); +static void lv_arclabel_event(const lv_obj_class_t * class_p, lv_event_t * e); static lv_value_precise_t calc_arc_text_total_angle(const char * text, const lv_font_t * font, uint32_t radius, const lv_value_precise_t angle_size, int32_t letter_space, bool recolor); static const char * recolor_cmd_get_next(const char * text_in, uint32_t len_in, @@ -59,13 +59,13 @@ static lv_value_precise_t rad_to_deg(lv_value_precise_t rad, int32_t radius); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_arc_label_class = { - .constructor_cb = lv_arc_label_constructor, - .event_cb = lv_arc_label_event, - .instance_size = sizeof(lv_arc_label_t), +const lv_obj_class_t lv_arclabel_class = { + .constructor_cb = lv_arclabel_constructor, + .event_cb = lv_arclabel_event, + .instance_size = sizeof(lv_arclabel_t), .editable = LV_OBJ_CLASS_EDITABLE_FALSE, .base_class = &lv_obj_class, - .name = "arc_label", + .name = "arclabel", }; /********************** @@ -76,7 +76,7 @@ const lv_obj_class_t lv_arc_label_class = { * GLOBAL FUNCTIONS **********************/ -lv_obj_t * lv_arc_label_create(lv_obj_t * parent) +lv_obj_t * lv_arclabel_create(lv_obj_t * parent) { LV_LOG_INFO("begin"); lv_obj_t * obj = lv_obj_class_create_obj(MY_CLASS, parent); @@ -96,48 +96,48 @@ lv_obj_t * lv_arc_label_create(lv_obj_t * parent) * Setter functions *====================*/ -void lv_arc_label_set_text(lv_obj_t * obj, const char * text) +void lv_arclabel_set_text(lv_obj_t * obj, const char * text) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_arc_label_t * arc_label = (lv_arc_label_t *)obj; + lv_arclabel_t * arclabel = (lv_arclabel_t *)obj; /*If text is NULL then just refresh with the current text*/ - if(text == NULL) text = arc_label->text; + if(text == NULL) text = arclabel->text; const size_t text_len = lv_strlen(text) + 1; /*If set its own text then reallocate it (maybe its size changed)*/ - if(arc_label->text == text && arc_label->static_txt == 0) { - arc_label->text = lv_realloc(arc_label->text, text_len); - LV_ASSERT_MALLOC(arc_label->text); - if(arc_label->text == NULL) return; + if(arclabel->text == text && arclabel->static_txt == 0) { + arclabel->text = lv_realloc(arclabel->text, text_len); + LV_ASSERT_MALLOC(arclabel->text); + if(arclabel->text == NULL) return; } else { /*Free the old text*/ - if(arc_label->text != NULL && arc_label->static_txt == 0) { - lv_free(arc_label->text); - arc_label->text = NULL; + if(arclabel->text != NULL && arclabel->static_txt == 0) { + lv_free(arclabel->text); + arclabel->text = NULL; } - arc_label->text = lv_malloc(text_len); - LV_ASSERT_MALLOC(arc_label->text); - if(arc_label->text == NULL) return; + arclabel->text = lv_malloc(text_len); + LV_ASSERT_MALLOC(arclabel->text); + if(arclabel->text == NULL) return; - lv_strcpy(arc_label->text, text); + lv_strcpy(arclabel->text, text); /*Now the text is dynamically allocated*/ - arc_label->static_txt = 0; + arclabel->static_txt = 0; } lv_obj_invalidate(obj); } -void lv_arc_label_set_text_fmt(lv_obj_t * obj, const char * fmt, ...) +void lv_arclabel_set_text_fmt(lv_obj_t * obj, const char * fmt, ...) { LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_NULL(fmt); - lv_arc_label_t * arc_label = (lv_arc_label_t *)obj; + lv_arclabel_t * arclabel = (lv_arclabel_t *)obj; /*If text is NULL then refresh*/ if(fmt == NULL) { @@ -145,122 +145,122 @@ void lv_arc_label_set_text_fmt(lv_obj_t * obj, const char * fmt, ...) return; } - if(arc_label->text != NULL && arc_label->static_txt == 0) { - lv_free(arc_label->text); - arc_label->text = NULL; + if(arclabel->text != NULL && arclabel->static_txt == 0) { + lv_free(arclabel->text); + arclabel->text = NULL; } va_list args; va_start(args, fmt); - arc_label->text = lv_text_set_text_vfmt(fmt, args); + arclabel->text = lv_text_set_text_vfmt(fmt, args); va_end(args); - arc_label->static_txt = 0; /*Now the text is dynamically allocated*/ + arclabel->static_txt = 0; /*Now the text is dynamically allocated*/ lv_obj_invalidate(obj); } -void lv_arc_label_set_text_static(lv_obj_t * obj, const char * text) +void lv_arclabel_set_text_static(lv_obj_t * obj, const char * text) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_arc_label_t * arc_label = (lv_arc_label_t *)obj; + lv_arclabel_t * arclabel = (lv_arclabel_t *)obj; - if(arc_label->static_txt == 0 && arc_label->text != NULL) { - lv_free(arc_label->text); - arc_label->text = NULL; + if(arclabel->static_txt == 0 && arclabel->text != NULL) { + lv_free(arclabel->text); + arclabel->text = NULL; } if(text != NULL) { - arc_label->static_txt = 1; - arc_label->text = (char *)text; + arclabel->static_txt = 1; + arclabel->text = (char *)text; } lv_obj_invalidate(obj); } -void lv_arc_label_set_angle_start(lv_obj_t * obj, lv_value_precise_t start) +void lv_arclabel_set_angle_start(lv_obj_t * obj, lv_value_precise_t start) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_arc_label_t * arc = (lv_arc_label_t *)obj; + lv_arclabel_t * arc = (lv_arclabel_t *)obj; arc->angle_start = start; lv_obj_invalidate(obj); } -void lv_arc_label_set_angle_size(lv_obj_t * obj, lv_value_precise_t size) +void lv_arclabel_set_angle_size(lv_obj_t * obj, lv_value_precise_t size) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_arc_label_t * arc = (lv_arc_label_t *)obj; + lv_arclabel_t * arc = (lv_arclabel_t *)obj; arc->angle_size = size; lv_obj_invalidate(obj); } -void lv_arc_label_set_offset(lv_obj_t * obj, int32_t offset) +void lv_arclabel_set_offset(lv_obj_t * obj, int32_t offset) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_arc_label_t * arc = (lv_arc_label_t *)obj; + lv_arclabel_t * arc = (lv_arclabel_t *)obj; arc->offset = offset; lv_obj_invalidate(obj); } -void lv_arc_label_set_dir(lv_obj_t * obj, lv_arc_label_dir_t dir) +void lv_arclabel_set_dir(lv_obj_t * obj, lv_arclabel_dir_t dir) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_arc_label_t * arc = (lv_arc_label_t *)obj; + lv_arclabel_t * arc = (lv_arclabel_t *)obj; arc->dir = dir; lv_obj_invalidate(obj); } -void lv_arc_label_set_recolor(lv_obj_t * obj, bool en) +void lv_arclabel_set_recolor(lv_obj_t * obj, bool en) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_arc_label_t * arc = (lv_arc_label_t *)obj; + lv_arclabel_t * arc = (lv_arclabel_t *)obj; arc->recolor = en; lv_obj_invalidate(obj); } -void lv_arc_label_set_radius(lv_obj_t * obj, uint32_t radius) +void lv_arclabel_set_radius(lv_obj_t * obj, uint32_t radius) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_arc_label_t * arc = (lv_arc_label_t *)obj; + lv_arclabel_t * arc = (lv_arclabel_t *)obj; arc->radius = radius; lv_obj_invalidate(obj); } -void lv_arc_label_set_center_offset_x(lv_obj_t * obj, uint32_t x) +void lv_arclabel_set_center_offset_x(lv_obj_t * obj, uint32_t x) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_arc_label_t * arc = (lv_arc_label_t *)obj; + lv_arclabel_t * arc = (lv_arclabel_t *)obj; arc->center_offset.x = x; lv_obj_invalidate(obj); } -void lv_arc_label_set_center_offset_y(lv_obj_t * obj, uint32_t y) +void lv_arclabel_set_center_offset_y(lv_obj_t * obj, uint32_t y) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_arc_label_t * arc = (lv_arc_label_t *)obj; + lv_arclabel_t * arc = (lv_arclabel_t *)obj; arc->center_offset.y = y; lv_obj_invalidate(obj); } -void lv_arc_label_set_text_vertical_align(lv_obj_t * obj, lv_arc_label_text_align_t align) +void lv_arclabel_set_text_vertical_align(lv_obj_t * obj, lv_arclabel_text_align_t align) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_arc_label_t * arc = (lv_arc_label_t *)obj; + lv_arclabel_t * arc = (lv_arclabel_t *)obj; arc->text_align_v = align; lv_obj_invalidate(obj); } -void lv_arc_label_set_text_horizontal_align(lv_obj_t * obj, lv_arc_label_text_align_t align) +void lv_arclabel_set_text_horizontal_align(lv_obj_t * obj, lv_arclabel_text_align_t align) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_arc_label_t * arc = (lv_arc_label_t *)obj; + lv_arclabel_t * arc = (lv_arclabel_t *)obj; arc->text_align_h = align; lv_obj_invalidate(obj); @@ -270,59 +270,59 @@ void lv_arc_label_set_text_horizontal_align(lv_obj_t * obj, lv_arc_label_text_al * Getter functions *====================*/ -lv_value_precise_t lv_arc_label_get_angle_start(lv_obj_t * obj) +lv_value_precise_t lv_arclabel_get_angle_start(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); - return ((lv_arc_label_t *) obj)->angle_start; + return ((lv_arclabel_t *) obj)->angle_start; } -lv_value_precise_t lv_arc_label_get_angle_size(lv_obj_t * obj) +lv_value_precise_t lv_arclabel_get_angle_size(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_arc_label_t * arc_label = (lv_arc_label_t *)obj; - return arc_label->angle_size; + lv_arclabel_t * arclabel = (lv_arclabel_t *)obj; + return arclabel->angle_size; } -lv_arc_label_dir_t lv_arc_label_get_dir(const lv_obj_t * obj) +lv_arclabel_dir_t lv_arclabel_get_dir(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); - return ((lv_arc_label_t *) obj)->dir; + return ((lv_arclabel_t *) obj)->dir; } -bool lv_arc_label_get_recolor(lv_obj_t * obj) +bool lv_arclabel_get_recolor(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); - return ((lv_arc_label_t *) obj)->recolor; + return ((lv_arclabel_t *) obj)->recolor; } -uint32_t lv_arc_label_get_radius(lv_obj_t * obj) +uint32_t lv_arclabel_get_radius(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); - return ((lv_arc_label_t *) obj)->radius; + return ((lv_arclabel_t *) obj)->radius; } -uint32_t lv_arc_label_get_center_offset_x(lv_obj_t * obj) +uint32_t lv_arclabel_get_center_offset_x(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); - return ((lv_arc_label_t *) obj)->center_offset.x; + return ((lv_arclabel_t *) obj)->center_offset.x; } -uint32_t lv_arc_label_get_center_offset_y(lv_obj_t * obj) +uint32_t lv_arclabel_get_center_offset_y(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); - return ((lv_arc_label_t *) obj)->center_offset.y; + return ((lv_arclabel_t *) obj)->center_offset.y; } -lv_arc_label_text_align_t lv_arc_label_get_text_vertical_align(lv_obj_t * obj) +lv_arclabel_text_align_t lv_arclabel_get_text_vertical_align(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); - return ((lv_arc_label_t *) obj)->text_align_v; + return ((lv_arclabel_t *) obj)->text_align_v; } -lv_arc_label_text_align_t lv_arc_label_get_text_horizontal_align(lv_obj_t * obj) +lv_arclabel_text_align_t lv_arclabel_get_text_horizontal_align(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); - return ((lv_arc_label_t *) obj)->text_align_h; + return ((lv_arclabel_t *) obj)->text_align_h; } /*===================== @@ -333,26 +333,26 @@ lv_arc_label_text_align_t lv_arc_label_get_text_horizontal_align(lv_obj_t * obj) * STATIC FUNCTIONS **********************/ -static void lv_arc_label_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) +static void lv_arclabel_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { LV_UNUSED(class_p); LV_TRACE_OBJ_CREATE("begin"); - lv_arc_label_t * arc = (lv_arc_label_t *)obj; + lv_arclabel_t * arc = (lv_arclabel_t *)obj; arc->angle_start = 0; arc->angle_size = 360; - arc->dir = LV_ARC_LABEL_DIR_CLOCKWISE; + arc->dir = LV_ARCLABEL_DIR_CLOCKWISE; arc->recolor = false; - lv_arc_label_set_text_static(obj, LV_ARC_LABEL_DEFAULT_TEXT); + lv_arclabel_set_text_static(obj, LV_ARCLABEL_DEFAULT_TEXT); lv_obj_remove_flag(obj, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLL_CHAIN | LV_OBJ_FLAG_SCROLLABLE); LV_TRACE_OBJ_CREATE("finished"); } -static void lv_arc_label_event(const lv_obj_class_t * class_p, lv_event_t * e) +static void lv_arclabel_event(const lv_obj_class_t * class_p, lv_event_t * e) { LV_UNUSED(class_p); @@ -363,16 +363,16 @@ static void lv_arc_label_event(const lv_obj_class_t * class_p, lv_event_t * e) const lv_event_code_t code = lv_event_get_code(e); if(code == LV_EVENT_DRAW_MAIN) { - arc_label_draw_main(e); + arclabel_draw_main(e); } } -static void arc_label_draw_main(lv_event_t * e) +static void arclabel_draw_main(lv_event_t * e) { lv_obj_t * obj = lv_event_get_current_target(e); - lv_arc_label_t * arc_label = (lv_arc_label_t *)obj; + lv_arclabel_t * arclabel = (lv_arclabel_t *)obj; - const char * text = arc_label->text; + const char * text = arclabel->text; const char * text_start = text; lv_area_t coords; @@ -388,7 +388,7 @@ static void arc_label_draw_main(lv_event_t * e) const int32_t line_height = font->line_height; const int32_t base_line = font->base_line; int32_t arc_r_delta = 0; - int32_t arc_r = arc_label->radius; + int32_t arc_r = arclabel->radius; lv_value_precise_t angle_start = 0; if(arc_r == LV_SIZE_CONTENT) arc_r = LV_PCT(100); @@ -398,36 +398,36 @@ static void arc_label_draw_main(lv_event_t * e) arc_r = lv_pct_to_px(arc_r, LV_MIN(width, height)) / 2; } - switch(arc_label->text_align_v) { - case LV_ARC_LABEL_TEXT_ALIGN_LEADING: + switch(arclabel->text_align_v) { + case LV_ARCLABEL_TEXT_ALIGN_LEADING: arc_r_delta = line_height - base_line; break; - case LV_ARC_LABEL_TEXT_ALIGN_CENTER: + case LV_ARCLABEL_TEXT_ALIGN_CENTER: arc_r_delta = line_height / 2 - base_line; break; - case LV_ARC_LABEL_TEXT_ALIGN_TRAILING: + case LV_ARCLABEL_TEXT_ALIGN_TRAILING: arc_r_delta = -base_line; break; default: break; } - arc_r += arc_label->dir == LV_ARC_LABEL_DIR_CLOCKWISE ? -arc_r_delta : arc_r_delta; + arc_r += arclabel->dir == LV_ARCLABEL_DIR_CLOCKWISE ? -arc_r_delta : arc_r_delta; - const int32_t offset = arc_label->offset; + const int32_t offset = arclabel->offset; const lv_value_precise_t angle_offset = rad_to_deg(offset, arc_r); - switch(arc_label->text_align_h) { - case LV_ARC_LABEL_TEXT_ALIGN_LEADING: + switch(arclabel->text_align_h) { + case LV_ARCLABEL_TEXT_ALIGN_LEADING: angle_start = angle_offset; break; - case LV_ARC_LABEL_TEXT_ALIGN_CENTER: - angle_start = (arc_label->angle_size + angle_offset - calc_arc_text_total_angle(text_start, font, arc_r, - arc_label->angle_size, letter_space, arc_label->recolor)) / 2; + case LV_ARCLABEL_TEXT_ALIGN_CENTER: + angle_start = (arclabel->angle_size + angle_offset - calc_arc_text_total_angle(text_start, font, arc_r, + arclabel->angle_size, letter_space, arclabel->recolor)) / 2; break; - case LV_ARC_LABEL_TEXT_ALIGN_TRAILING: - angle_start = arc_label->angle_size - calc_arc_text_total_angle(text_start, font, arc_r, arc_label->angle_size, - letter_space, arc_label->recolor); + case LV_ARCLABEL_TEXT_ALIGN_TRAILING: + angle_start = arclabel->angle_size - calc_arc_text_total_angle(text_start, font, arc_r, arclabel->angle_size, + letter_space, arclabel->recolor); break; default: break; @@ -435,14 +435,14 @@ static void arc_label_draw_main(lv_event_t * e) uint32_t processed_word_count = 0; lv_value_precise_t prev_letter_w = 0; - lv_value_precise_t total_arc_length = deg_to_rad(arc_label->angle_size, arc_r); + lv_value_precise_t total_arc_length = deg_to_rad(arclabel->angle_size, arc_r); lv_value_precise_t curr_total_arc_length = deg_to_rad(angle_start, arc_r); while(text) { uint32_t word_i = 0; uint32_t text_len = LV_TEXT_LEN_MAX; lv_color_t recolor_color = color; - if(arc_label->recolor) text = recolor_cmd_get_next(text, LV_TEXT_LEN_MAX, &text_start, &text_len, &recolor_color); + if(arclabel->recolor) text = recolor_cmd_get_next(text, LV_TEXT_LEN_MAX, &text_start, &text_len, &recolor_color); else text = NULL; while(word_i < text_len && curr_total_arc_length <= total_arc_length) { @@ -459,8 +459,8 @@ static void arc_label_draw_main(lv_event_t * e) } } - const lv_value_precise_t curr_angle = arc_label->angle_start - + rad_to_deg(arc_label->dir == LV_ARC_LABEL_DIR_CLOCKWISE + const lv_value_precise_t curr_angle = arclabel->angle_start + + rad_to_deg(arclabel->dir == LV_ARCLABEL_DIR_CLOCKWISE ? curr_total_arc_length : total_arc_length - curr_total_arc_length, arc_r); @@ -473,16 +473,16 @@ static void arc_label_draw_main(lv_event_t * e) #endif lv_point_t point = { - (int32_t)(x + (lv_value_precise_t)(lv_area_get_width(&coords) / 2 + coords.x1 + arc_label->center_offset.x)), - (int32_t)(y + (lv_value_precise_t)(lv_area_get_height(&coords) / 2 + coords.y1 + arc_label->center_offset.y)), + (int32_t)(x + (lv_value_precise_t)(lv_area_get_width(&coords) / 2 + coords.x1 + arclabel->center_offset.x)), + (int32_t)(y + (lv_value_precise_t)(lv_area_get_height(&coords) / 2 + coords.y1 + arclabel->center_offset.y)), }; lv_draw_letter_dsc_t dsc; lv_draw_letter_dsc_init(&dsc); dsc.font = font; - dsc.color = arc_label->recolor ? recolor_color : color; + dsc.color = arclabel->recolor ? recolor_color : color; dsc.opa = opa; - if(arc_label->dir == LV_ARC_LABEL_DIR_CLOCKWISE) dsc.rotation = (int32_t)((curr_angle + 90) * 10); + if(arclabel->dir == LV_ARCLABEL_DIR_CLOCKWISE) dsc.rotation = (int32_t)((curr_angle + 90) * 10); else dsc.rotation = (int32_t)((curr_angle - 90) * 10); dsc.unicode = letter; @@ -495,7 +495,7 @@ static void arc_label_draw_main(lv_event_t * e) prev_letter_w = letter_w; processed_word_count++; -#if LV_ARC_LABEL_DEBUG +#if LV_ARCLABEL_DEBUG lv_draw_line_dsc_t line_dsc; lv_draw_line_dsc_init(&line_dsc); line_dsc.color = lv_color_make(0x11, 0x45, 0x14); diff --git a/src/widgets/arc_label/lv_arc_label.h b/src/widgets/arclabel/lv_arclabel.h similarity index 70% rename from src/widgets/arc_label/lv_arc_label.h rename to src/widgets/arclabel/lv_arclabel.h index 558a8a3339..39078c95c7 100644 --- a/src/widgets/arc_label/lv_arc_label.h +++ b/src/widgets/arclabel/lv_arclabel.h @@ -1,10 +1,10 @@ /** - * @file lv_arc_label.h + * @file lv_arclabel.h * */ -#ifndef LV_ARC_LABEL_H -#define LV_ARC_LABEL_H +#ifndef LV_ARCLABEL_H +#define LV_ARCLABEL_H #ifdef __cplusplus extern "C" { @@ -15,17 +15,17 @@ extern "C" { *********************/ #include "../../lv_conf_internal.h" -#if LV_USE_ARC_LABEL != 0 +#if LV_USE_ARCLABEL != 0 /********************* * DEFINES *********************/ -#define LV_ARC_LABEL_DOT_NUM 3 +#define LV_ARCLABEL_DOT_NUM 3 #if LV_WIDGETS_HAS_DEFAULT_VALUE -#define LV_ARC_LABEL_DEFAULT_TEXT "Arced Text" +#define LV_ARCLABEL_DEFAULT_TEXT "Arced Text" #else -#define LV_ARC_LABEL_DEFAULT_TEXT "" +#define LV_ARCLABEL_DEFAULT_TEXT "" #endif /********************** @@ -33,18 +33,18 @@ extern "C" { **********************/ typedef enum { - LV_ARC_LABEL_DIR_CLOCKWISE = 0, - LV_ARC_LABEL_DIR_COUNTER_CLOCKWISE = 1 -} lv_arc_label_dir_t; + LV_ARCLABEL_DIR_CLOCKWISE = 0, + LV_ARCLABEL_DIR_COUNTER_CLOCKWISE = 1 +} lv_arclabel_dir_t; typedef enum { - LV_ARC_LABEL_TEXT_ALIGN_DEFAULT = 0, - LV_ARC_LABEL_TEXT_ALIGN_LEADING = 1, - LV_ARC_LABEL_TEXT_ALIGN_CENTER = 2, - LV_ARC_LABEL_TEXT_ALIGN_TRAILING = 3, -} lv_arc_label_text_align_t; + LV_ARCLABEL_TEXT_ALIGN_DEFAULT = 0, + LV_ARCLABEL_TEXT_ALIGN_LEADING = 1, + LV_ARCLABEL_TEXT_ALIGN_CENTER = 2, + LV_ARCLABEL_TEXT_ALIGN_TRAILING = 3, +} lv_arclabel_text_align_t; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_arc_label_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_arclabel_class; /********************** * GLOBAL PROTOTYPES @@ -55,7 +55,7 @@ LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_arc_label_class; * @param parent pointer to an object, it will be the parent of the new arc label * @return pointer to the created arc label */ -lv_obj_t * lv_arc_label_create(lv_obj_t * parent); +lv_obj_t * lv_arclabel_create(lv_obj_t * parent); /*====================== * Add/remove functions @@ -73,7 +73,7 @@ lv_obj_t * lv_arc_label_create(lv_obj_t * parent); * @param obj Pointer to the arc label object. * @param text Pointer to a null-terminated string containing the new text for the label. */ -void lv_arc_label_set_text(lv_obj_t * obj, const char * text); +void lv_arclabel_set_text(lv_obj_t * obj, const char * text); /** * Set the formatted text of an arc label object. @@ -85,7 +85,7 @@ void lv_arc_label_set_text(lv_obj_t * obj, const char * text); * @param fmt A format string that specifies how subsequent arguments are converted to text. * @param ... Arguments following the format string that are used to replace format specifiers in the format string. */ -void lv_arc_label_set_text_fmt(lv_obj_t * obj, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3); +void lv_arclabel_set_text_fmt(lv_obj_t * obj, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3); /** * Sets a new static text for the arc label or refreshes it with the current text. @@ -94,35 +94,35 @@ void lv_arc_label_set_text_fmt(lv_obj_t * obj, const char * fmt, ...) LV_FORMAT_ * @param obj Pointer to the arc label object. * @param text Pointer to the new text. If NULL, the label is refreshed with its current text. */ -void lv_arc_label_set_text_static(lv_obj_t * obj, const char * text); +void lv_arclabel_set_text_static(lv_obj_t * obj, const char * text); /** * Set the start angle of an arc. 0 deg: right, 90 bottom, etc. * @param obj pointer to an arc label object * @param start the start angle. (if `LV_USE_FLOAT` is enabled it can be fractional too.) */ -void lv_arc_label_set_angle_start(lv_obj_t * obj, lv_value_precise_t start); +void lv_arclabel_set_angle_start(lv_obj_t * obj, lv_value_precise_t start); /** * Set the end angle of an arc. 0 deg: right, 90 bottom, etc. * @param obj pointer to an arc label object * @param size the angle size (if `LV_USE_FLOAT` is enabled it can be fractional too.) */ -void lv_arc_label_set_angle_size(lv_obj_t * obj, lv_value_precise_t size); +void lv_arclabel_set_angle_size(lv_obj_t * obj, lv_value_precise_t size); /** * Set the rotation for the whole arc * @param obj pointer to an arc label object * @param offset rotation angle */ -void lv_arc_label_set_offset(lv_obj_t * obj, int32_t offset); +void lv_arclabel_set_offset(lv_obj_t * obj, int32_t offset); /** * Set the type of arc. * @param obj pointer to and arc label object * @param dir arc label's direction */ -void lv_arc_label_set_dir(lv_obj_t * obj, lv_arc_label_dir_t dir); +void lv_arclabel_set_dir(lv_obj_t * obj, lv_arclabel_dir_t dir); /** * Enable the recoloring by in-line commands @@ -130,7 +130,7 @@ void lv_arc_label_set_dir(lv_obj_t * obj, lv_arc_label_dir_t dir); * @param en true: enable recoloring, false: disable * Example: "This is a #ff0000 red# word" */ -void lv_arc_label_set_recolor(lv_obj_t * obj, bool en); +void lv_arclabel_set_recolor(lv_obj_t * obj, bool en); /** * Set the radius for an arc label object. @@ -138,35 +138,35 @@ void lv_arc_label_set_recolor(lv_obj_t * obj, bool en); * @param obj pointer to the arc label object. * @param radius The radius value to set for the label's curvature, in pixels. */ -void lv_arc_label_set_radius(lv_obj_t * obj, uint32_t radius); +void lv_arclabel_set_radius(lv_obj_t * obj, uint32_t radius); /** * Set the center offset x for an arc label object. * @param obj pointer to an arc label object * @param x the x offset */ -void lv_arc_label_set_center_offset_x(lv_obj_t * obj, uint32_t x); +void lv_arclabel_set_center_offset_x(lv_obj_t * obj, uint32_t x); /** * Set the center offset y for an arc label object. * @param obj pointer to an arc label object * @param y the y offset */ -void lv_arc_label_set_center_offset_y(lv_obj_t * obj, uint32_t y); +void lv_arclabel_set_center_offset_y(lv_obj_t * obj, uint32_t y); /** * Set the text vertical alignment for an arc label object. * @param obj pointer to an arc label object * @param align the vertical alignment */ -void lv_arc_label_set_text_vertical_align(lv_obj_t * obj, lv_arc_label_text_align_t align); +void lv_arclabel_set_text_vertical_align(lv_obj_t * obj, lv_arclabel_text_align_t align); /** * Set the text horizontal alignment for an arc label object. * @param obj pointer to an arc label object * @param align the horizontal alignment */ -void lv_arc_label_set_text_horizontal_align(lv_obj_t * obj, lv_arc_label_text_align_t align); +void lv_arclabel_set_text_horizontal_align(lv_obj_t * obj, lv_arclabel_text_align_t align); /*===================== * Getter functions @@ -177,66 +177,66 @@ void lv_arc_label_set_text_horizontal_align(lv_obj_t * obj, lv_arc_label_text_al * @param obj pointer to an arc label object * @return the start angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.) */ -lv_value_precise_t lv_arc_label_get_angle_start(lv_obj_t * obj); +lv_value_precise_t lv_arclabel_get_angle_start(lv_obj_t * obj); /** * Get the angle size of an arc label. * @param obj pointer to an arc label object * @return the end angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.) */ -lv_value_precise_t lv_arc_label_get_angle_size(lv_obj_t * obj); +lv_value_precise_t lv_arclabel_get_angle_size(lv_obj_t * obj); /** * Get whether the arc label is type or not. * @param obj pointer to an arc label object * @return arc label's direction */ -lv_arc_label_dir_t lv_arc_label_get_dir(const lv_obj_t * obj); +lv_arclabel_dir_t lv_arclabel_get_dir(const lv_obj_t * obj); /** * Enable the recoloring by in-line commands * - * @see lv_arc_label_set_recolor + * @see lv_arclabel_set_recolor * * @param obj pointer to a label object * @return true: enable recoloring, false: disable */ -bool lv_arc_label_get_recolor(lv_obj_t * obj); +bool lv_arclabel_get_recolor(lv_obj_t * obj); /** * Get the text of the arc label. * @param obj pointer to an arc label object * @return the radius of the arc label */ -uint32_t lv_arc_label_get_radius(lv_obj_t * obj); +uint32_t lv_arclabel_get_radius(lv_obj_t * obj); /** * Get the center offset x for an arc label object. * @param obj pointer to an arc label object * @return the x offset */ -uint32_t lv_arc_label_get_center_offset_x(lv_obj_t * obj); +uint32_t lv_arclabel_get_center_offset_x(lv_obj_t * obj); /** * Get the center offset y for an arc label object. * @param obj pointer to an arc label object * @return the y offset */ -uint32_t lv_arc_label_get_center_offset_y(lv_obj_t * obj); +uint32_t lv_arclabel_get_center_offset_y(lv_obj_t * obj); /** * Get the text vertical alignment for an arc label object. * @param obj pointer to an arc label object * @return the vertical alignment */ -lv_arc_label_text_align_t lv_arc_label_get_text_vertical_align(lv_obj_t * obj); +lv_arclabel_text_align_t lv_arclabel_get_text_vertical_align(lv_obj_t * obj); /** * Get the text horizontal alignment for an arc label object. * @param obj pointer to an arc label object * @return the horizontal alignment */ -lv_arc_label_text_align_t lv_arc_label_get_text_horizontal_align(lv_obj_t * obj); +lv_arclabel_text_align_t lv_arclabel_get_text_horizontal_align(lv_obj_t * obj); /*===================== * Other functions @@ -246,10 +246,10 @@ lv_arc_label_text_align_t lv_arc_label_get_text_horizontal_align(lv_obj_t * obj) * MACROS **********************/ -#endif /*LV_USE_ARC_LABEL*/ +#endif /*LV_USE_ARCLABEL*/ #ifdef __cplusplus } /*extern "C"*/ #endif -#endif /*LV_ARC_LABEL_H*/ +#endif /*LV_ARCLABEL_H*/ diff --git a/src/widgets/arc_label/lv_arc_label_private.h b/src/widgets/arclabel/lv_arclabel_private.h similarity index 77% rename from src/widgets/arc_label/lv_arc_label_private.h rename to src/widgets/arclabel/lv_arclabel_private.h index 482fa0bc6b..9f32ad9c86 100644 --- a/src/widgets/arc_label/lv_arc_label_private.h +++ b/src/widgets/arclabel/lv_arclabel_private.h @@ -1,10 +1,10 @@ /** - * @file lv_arc_label_private.h + * @file lv_arclabel_private.h * */ -#ifndef LV_ARC_LABEL_PRIVATE_H -#define LV_ARC_LABEL_PRIVATE_H +#ifndef LV_ARCLABEL_PRIVATE_H +#define LV_ARCLABEL_PRIVATE_H #ifdef __cplusplus extern "C" { @@ -15,8 +15,8 @@ extern "C" { *********************/ #include "../../core/lv_obj_private.h" -#if LV_USE_ARC_LABEL != 0 -#include "lv_arc_label.h" +#if LV_USE_ARCLABEL != 0 +#include "lv_arclabel.h" /********************* * DEFINES @@ -26,11 +26,11 @@ extern "C" { * TYPEDEFS **********************/ -struct _lv_arc_label_t { +struct _lv_arclabel_t { lv_obj_t obj; char * text; - char dot[LV_ARC_LABEL_DOT_NUM + 1]; /**< Bytes that have been replaced with dots */ + char dot[LV_ARCLABEL_DOT_NUM + 1]; /**< Bytes that have been replaced with dots */ uint32_t dot_begin; /**< Offset where bytes have been replaced with dots */ /** @@ -53,9 +53,9 @@ struct _lv_arc_label_t { uint32_t offset; uint32_t radius; lv_point_t center_offset; - lv_arc_label_dir_t dir; - lv_arc_label_text_align_t text_align_v; /**< Vertical text alignment */ - lv_arc_label_text_align_t text_align_h; /**< Horizontal text alignment */ + lv_arclabel_dir_t dir; + lv_arclabel_text_align_t text_align_v; /**< Vertical text alignment */ + lv_arclabel_text_align_t text_align_h; /**< Horizontal text alignment */ uint8_t static_txt : 1; /**< Flag to indicate the text is static */ uint8_t recolor : 1; /**< Enable in-line letter re-coloring */ }; @@ -68,10 +68,10 @@ struct _lv_arc_label_t { * MACROS **********************/ -#endif /* LV_USE_ARC_LABEL != 0 */ +#endif /* LV_USE_ARCLABEL != 0 */ #ifdef __cplusplus } /*extern "C"*/ #endif -#endif /*LV_ARC_LABEL_PRIVATE_H*/ +#endif /*LV_ARCLABEL_PRIVATE_H*/ diff --git a/tests/ref_imgs/widgets/arc_label_0.lp32.png b/tests/ref_imgs/widgets/arclabel_0.lp32.png similarity index 100% rename from tests/ref_imgs/widgets/arc_label_0.lp32.png rename to tests/ref_imgs/widgets/arclabel_0.lp32.png diff --git a/tests/ref_imgs/widgets/arc_label_0.lp64.png b/tests/ref_imgs/widgets/arclabel_0.lp64.png similarity index 100% rename from tests/ref_imgs/widgets/arc_label_0.lp64.png rename to tests/ref_imgs/widgets/arclabel_0.lp64.png diff --git a/tests/ref_imgs/widgets/arc_label_1.lp32.png b/tests/ref_imgs/widgets/arclabel_1.lp32.png similarity index 100% rename from tests/ref_imgs/widgets/arc_label_1.lp32.png rename to tests/ref_imgs/widgets/arclabel_1.lp32.png diff --git a/tests/ref_imgs/widgets/arc_label_1.lp64.png b/tests/ref_imgs/widgets/arclabel_1.lp64.png similarity index 100% rename from tests/ref_imgs/widgets/arc_label_1.lp64.png rename to tests/ref_imgs/widgets/arclabel_1.lp64.png diff --git a/tests/ref_imgs/widgets/arc_label_2.lp32.png b/tests/ref_imgs/widgets/arclabel_2.lp32.png similarity index 100% rename from tests/ref_imgs/widgets/arc_label_2.lp32.png rename to tests/ref_imgs/widgets/arclabel_2.lp32.png diff --git a/tests/ref_imgs/widgets/arc_label_2.lp64.png b/tests/ref_imgs/widgets/arclabel_2.lp64.png similarity index 100% rename from tests/ref_imgs/widgets/arc_label_2.lp64.png rename to tests/ref_imgs/widgets/arclabel_2.lp64.png diff --git a/tests/ref_imgs_vg_lite/widgets/arc_label_0.lp32.png b/tests/ref_imgs_vg_lite/widgets/arclabel_0.lp32.png similarity index 100% rename from tests/ref_imgs_vg_lite/widgets/arc_label_0.lp32.png rename to tests/ref_imgs_vg_lite/widgets/arclabel_0.lp32.png diff --git a/tests/ref_imgs_vg_lite/widgets/arc_label_0.lp64.png b/tests/ref_imgs_vg_lite/widgets/arclabel_0.lp64.png similarity index 100% rename from tests/ref_imgs_vg_lite/widgets/arc_label_0.lp64.png rename to tests/ref_imgs_vg_lite/widgets/arclabel_0.lp64.png diff --git a/tests/ref_imgs_vg_lite/widgets/arc_label_1.lp32.png b/tests/ref_imgs_vg_lite/widgets/arclabel_1.lp32.png similarity index 100% rename from tests/ref_imgs_vg_lite/widgets/arc_label_1.lp32.png rename to tests/ref_imgs_vg_lite/widgets/arclabel_1.lp32.png diff --git a/tests/ref_imgs_vg_lite/widgets/arc_label_1.lp64.png b/tests/ref_imgs_vg_lite/widgets/arclabel_1.lp64.png similarity index 100% rename from tests/ref_imgs_vg_lite/widgets/arc_label_1.lp64.png rename to tests/ref_imgs_vg_lite/widgets/arclabel_1.lp64.png diff --git a/tests/ref_imgs_vg_lite/widgets/arc_label_2.lp32.png b/tests/ref_imgs_vg_lite/widgets/arclabel_2.lp32.png similarity index 100% rename from tests/ref_imgs_vg_lite/widgets/arc_label_2.lp32.png rename to tests/ref_imgs_vg_lite/widgets/arclabel_2.lp32.png diff --git a/tests/ref_imgs_vg_lite/widgets/arc_label_2.lp64.png b/tests/ref_imgs_vg_lite/widgets/arclabel_2.lp64.png similarity index 100% rename from tests/ref_imgs_vg_lite/widgets/arc_label_2.lp64.png rename to tests/ref_imgs_vg_lite/widgets/arclabel_2.lp64.png diff --git a/tests/src/test_cases/widgets/test_arc_label.c b/tests/src/test_cases/widgets/test_arc_label.c deleted file mode 100644 index 12e9d547f0..0000000000 --- a/tests/src/test_cases/widgets/test_arc_label.c +++ /dev/null @@ -1,72 +0,0 @@ -#if LV_BUILD_TEST -#include "../lvgl.h" -#include "../../lvgl_private.h" - -#include "unity/unity.h" - -#if LV_USE_VG_LITE_THORVG - #define FREETYPE_FONT_TYPE LV_FREETYPE_FONT_RENDER_MODE_OUTLINE -#else - #define FREETYPE_FONT_TYPE LV_FREETYPE_FONT_RENDER_MODE_BITMAP -#endif - -#ifndef NON_AMD64_BUILD - #define EXT_NAME ".lp64.png" -#else - #define EXT_NAME ".lp32.png" -#endif - -static const char * ARC_LABEL_TEXT = - "I'm on an #FA7C45 ARC#! Centered with #12c2E9 C##8B68E8 O##c471ed L##B654E5 O##C84AB2 R##DB417A F##f64659 U##ff8888 L# 特性! \n"; - -static lv_font_t * font; -static lv_obj_t * active_screen = NULL; - -void setUp(void) -{ - active_screen = lv_screen_active(); - font = lv_freetype_font_create("src/test_files/fonts/noto/NotoSansSC-Regular.ttf", FREETYPE_FONT_TYPE, 18, - LV_FREETYPE_FONT_STYLE_NORMAL); -} - -void tearDown(void) -{ - lv_obj_clean(active_screen); - lv_obj_set_style_layout(active_screen, LV_LAYOUT_NONE, 0); - - if(font) { - lv_freetype_font_delete(font); - } -} - -void test_arc_label_simple(void) -{ - if(!font) { - LV_LOG_ERROR("freetype font create failed."); - TEST_FAIL(); - } - - lv_obj_t * arc_label = lv_arc_label_create(active_screen); - lv_obj_set_style_text_font(arc_label, font, LV_PART_MAIN); - lv_obj_set_size(arc_label, 200, 200); - lv_obj_set_style_text_letter_space(arc_label, 2, LV_PART_MAIN); - lv_obj_set_style_text_color(arc_label, lv_color_hex(0x888888), LV_PART_MAIN); - lv_arc_label_set_angle_start(arc_label, -180); - lv_arc_label_set_text_static(arc_label, ARC_LABEL_TEXT); - lv_arc_label_set_radius(arc_label, LV_PCT(100)); - lv_arc_label_set_recolor(arc_label, true); - lv_arc_label_set_text_vertical_align(arc_label, LV_ARC_LABEL_TEXT_ALIGN_LEADING); - lv_arc_label_set_dir(arc_label, LV_ARC_LABEL_DIR_CLOCKWISE); - lv_arc_label_set_text_horizontal_align(arc_label, LV_ARC_LABEL_TEXT_ALIGN_CENTER); - lv_obj_center(arc_label); - - TEST_ASSERT_EQUAL_SCREENSHOT("widgets/arc_label_0" EXT_NAME); - - lv_obj_set_size(arc_label, 300, 300); - TEST_ASSERT_EQUAL_SCREENSHOT("widgets/arc_label_1" EXT_NAME); - - lv_arc_label_set_recolor(arc_label, false); - TEST_ASSERT_EQUAL_SCREENSHOT("widgets/arc_label_2" EXT_NAME); -} - -#endif diff --git a/tests/src/test_cases/widgets/test_arclabel.c b/tests/src/test_cases/widgets/test_arclabel.c new file mode 100644 index 0000000000..9d4bafda09 --- /dev/null +++ b/tests/src/test_cases/widgets/test_arclabel.c @@ -0,0 +1,72 @@ +#if LV_BUILD_TEST +#include "../lvgl.h" +#include "../../lvgl_private.h" + +#include "unity/unity.h" + +#if LV_USE_VG_LITE_THORVG + #define FREETYPE_FONT_TYPE LV_FREETYPE_FONT_RENDER_MODE_OUTLINE +#else + #define FREETYPE_FONT_TYPE LV_FREETYPE_FONT_RENDER_MODE_BITMAP +#endif + +#ifndef NON_AMD64_BUILD + #define EXT_NAME ".lp64.png" +#else + #define EXT_NAME ".lp32.png" +#endif + +static const char * ARCLABEL_TEXT = + "I'm on an #FA7C45 ARC#! Centered with #12c2E9 C##8B68E8 O##c471ed L##B654E5 O##C84AB2 R##DB417A F##f64659 U##ff8888 L# 特性! \n"; + +static lv_font_t * font; +static lv_obj_t * active_screen = NULL; + +void setUp(void) +{ + active_screen = lv_screen_active(); + font = lv_freetype_font_create("src/test_files/fonts/noto/NotoSansSC-Regular.ttf", FREETYPE_FONT_TYPE, 18, + LV_FREETYPE_FONT_STYLE_NORMAL); +} + +void tearDown(void) +{ + lv_obj_clean(active_screen); + lv_obj_set_style_layout(active_screen, LV_LAYOUT_NONE, 0); + + if(font) { + lv_freetype_font_delete(font); + } +} + +void test_arclabel_simple(void) +{ + if(!font) { + LV_LOG_ERROR("freetype font create failed."); + TEST_FAIL(); + } + + lv_obj_t * arclabel = lv_arclabel_create(active_screen); + lv_obj_set_style_text_font(arclabel, font, LV_PART_MAIN); + lv_obj_set_size(arclabel, 200, 200); + lv_obj_set_style_text_letter_space(arclabel, 2, LV_PART_MAIN); + lv_obj_set_style_text_color(arclabel, lv_color_hex(0x888888), LV_PART_MAIN); + lv_arclabel_set_angle_start(arclabel, -180); + lv_arclabel_set_text_static(arclabel, ARCLABEL_TEXT); + lv_arclabel_set_radius(arclabel, LV_PCT(100)); + lv_arclabel_set_recolor(arclabel, true); + lv_arclabel_set_text_vertical_align(arclabel, LV_ARCLABEL_TEXT_ALIGN_LEADING); + lv_arclabel_set_dir(arclabel, LV_ARCLABEL_DIR_CLOCKWISE); + lv_arclabel_set_text_horizontal_align(arclabel, LV_ARCLABEL_TEXT_ALIGN_CENTER); + lv_obj_center(arclabel); + + TEST_ASSERT_EQUAL_SCREENSHOT("widgets/arclabel_0" EXT_NAME); + + lv_obj_set_size(arclabel, 300, 300); + TEST_ASSERT_EQUAL_SCREENSHOT("widgets/arclabel_1" EXT_NAME); + + lv_arclabel_set_recolor(arclabel, false); + TEST_ASSERT_EQUAL_SCREENSHOT("widgets/arclabel_2" EXT_NAME); +} + +#endif