Skip to content

Commit 9489759

Browse files
W-MaiuLipe
authored andcommitted
chore(arc_label): rename arc_label to arclabel
1 parent 8487b4c commit 9489759

29 files changed

+435
-435
lines changed

Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ menu "LVGL configuration"
10901090
config LV_USE_ARC
10911091
bool "Arc"
10921092
default y if !LV_CONF_MINIMAL
1093-
config LV_USE_ARC_LABEL
1093+
config LV_USE_ARCLABEL
10941094
bool "Arc Label"
10951095
default y if !LV_CONF_MINIMAL
10961096
config LV_USE_BAR

docs/src/details/widgets/arc_label.rst

Lines changed: 0 additions & 100 deletions
This file was deleted.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
.. _lv_arclabel:
2+
3+
========================
4+
Arc Label (lv_arclabel)
5+
========================
6+
7+
8+
Overview
9+
********
10+
11+
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.
12+
13+
.. _lv_arclabel_parts_and_styles:
14+
15+
Parts and Styles
16+
****************
17+
18+
- :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.
19+
20+
.. _lv_arclabel_usage:
21+
22+
Usage
23+
*****
24+
25+
Text Management
26+
---------------
27+
28+
- Text can be set using :cpp:expr:`lv_arclabel_set_text(arclabel, "Your text")`.
29+
- For formatted text, use :cpp:expr:`lv_arclabel_set_text_fmt(arclabel, "Formatted %s", "text")`.
30+
- Static text can be set with :cpp:expr:`lv_arclabel_set_text_static(arclabel, static_text)`, which avoids dynamic memory allocation.
31+
32+
Angle Configuration
33+
-------------------
34+
35+
- Set the starting angle of the arc with :cpp:expr:`lv_arclabel_set_angle_start(arclabel, angle)`.
36+
- Define the arc size (angular span) using :cpp:expr:`lv_arclabel_set_angle_size(arclabel, size)`.
37+
- Angles are measured in degrees, starting from the positive x-axis (3 o'clock position) and increasing clockwise.
38+
39+
Direction
40+
---------
41+
42+
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)`.
43+
44+
- :cpp:enumerator:`LV_ARCLABEL_DIR_CLOCKWISE` Text flows in a clockwise direction along the arc.
45+
- :cpp:enumerator:`LV_ARCLABEL_DIR_COUNTERCLOCKWISE` Text flows in a counter-clockwise direction along the arc.
46+
47+
Alignment
48+
---------
49+
50+
Adjust vertical text alignment with :cpp:expr:`lv_arclabel_set_text_vertical_align(arclabel, LV_ARCLABEL_TEXT_ALIGN_CENTER)`.
51+
Set horizontal alignment using :cpp:expr:`lv_arclabel_set_text_horizontal_align(arclabel, LV_ARCLABEL_TEXT_ALIGN_CENTER)`.
52+
53+
Both vertical and horizontal use the same logic.
54+
55+
- :cpp:enumerator:`LV_ARCLABEL_TEXT_ALIGN_DEFAULT` Uses the default alignment.
56+
- :cpp:enumerator:`LV_ARCLABEL_TEXT_ALIGN_LEADING` Aligns text to the leading edge of the arc.
57+
- :cpp:enumerator:`LV_ARCLABEL_TEXT_ALIGN_CENTER` Centers text along the arc.
58+
- :cpp:enumerator:`LV_ARCLABEL_TEXT_ALIGN_TRAILING` Aligns text to the trailing edge of the arc.
59+
60+
Radius and Center Offset
61+
------------------------
62+
63+
- Set the radius of the arc with :cpp:expr:`lv_arclabel_set_radius(arclabel, radius)`.
64+
- 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)`.
65+
66+
Color and Recoloring
67+
--------------------
68+
69+
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.
70+
71+
Interactive Behavior
72+
--------------------
73+
74+
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.
75+
76+
.. _lv_arclabel_events:
77+
78+
Events
79+
******
80+
81+
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.
82+
83+
.. _lv_arclabel_keys:
84+
85+
Keys
86+
****
87+
88+
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.
89+
90+
.. _lv_arclabel_example:
91+
92+
Example
93+
*******
94+
95+
.. include:: ../../examples/widgets/arclabel/index.rst
96+
97+
.. _lv_arclabel_api:
98+
99+
API
100+
***

docs/src/details/widgets/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ All Widgets
1717
3dtexture
1818
animimg
1919
arc
20-
arc_label
20+
arclabel
2121
bar
2222
button
2323
buttonmatrix

examples/widgets/arc_label/lv_example_arc_label_1.c

Lines changed: 0 additions & 80 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Simple Arc Label
22
----------------
33

4-
.. lv_example:: widgets/arc_label/lv_example_arc_label_1
4+
.. lv_example:: widgets/arclabel/lv_example_arclabel_1
55
:language: c
66
:description: A simple example to demonstrate the use of an arc label.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#include "../../lv_examples.h"
2+
3+
#if LV_USE_ARCLABEL && LV_BUILD_EXAMPLES
4+
5+
static const char * ARCLABEL_TEXT =
6+
"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";
7+
8+
void lv_example_arclabel_1(void)
9+
{
10+
lv_obj_t * arclabel_inner = NULL;
11+
lv_obj_t * arclabel_outer = NULL;
12+
lv_obj_t * arclabel_slogan_1 = NULL;
13+
lv_obj_t * arclabel_slogan_2 = NULL;
14+
15+
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_black(), LV_PART_MAIN);
16+
17+
arclabel_inner = lv_arclabel_create(lv_screen_active());
18+
lv_obj_set_size(arclabel_inner, 200, 200);
19+
lv_obj_set_style_text_color(arclabel_inner, lv_color_white(), LV_PART_MAIN);
20+
lv_arclabel_set_text_static(arclabel_inner, ARCLABEL_TEXT);
21+
lv_arclabel_set_angle_start(arclabel_inner, 180);
22+
lv_arclabel_set_radius(arclabel_inner, LV_PCT(80));
23+
lv_arclabel_set_recolor(arclabel_inner, true);
24+
lv_arclabel_set_text_vertical_align(arclabel_inner, LV_ARCLABEL_TEXT_ALIGN_TRAILING);
25+
lv_arclabel_set_dir(arclabel_inner, LV_ARCLABEL_DIR_COUNTER_CLOCKWISE);
26+
lv_arclabel_set_text_horizontal_align(arclabel_inner, LV_ARCLABEL_TEXT_ALIGN_CENTER);
27+
lv_obj_center(arclabel_inner);
28+
29+
arclabel_outer = lv_arclabel_create(lv_screen_active());
30+
lv_obj_set_size(arclabel_outer, 200, 200);
31+
lv_obj_set_style_text_letter_space(arclabel_outer, 2, LV_PART_MAIN);
32+
lv_obj_set_style_text_color(arclabel_outer, lv_color_hex(0x888888), LV_PART_MAIN);
33+
lv_arclabel_set_angle_start(arclabel_outer, -180);
34+
lv_arclabel_set_text_static(arclabel_outer, ARCLABEL_TEXT);
35+
lv_arclabel_set_radius(arclabel_outer, LV_PCT(100));
36+
lv_arclabel_set_recolor(arclabel_outer, true);
37+
lv_arclabel_set_text_vertical_align(arclabel_outer, LV_ARCLABEL_TEXT_ALIGN_LEADING);
38+
lv_arclabel_set_dir(arclabel_outer, LV_ARCLABEL_DIR_CLOCKWISE);
39+
lv_arclabel_set_text_horizontal_align(arclabel_outer, LV_ARCLABEL_TEXT_ALIGN_CENTER);
40+
lv_obj_center(arclabel_outer);
41+
42+
arclabel_slogan_1 = lv_arclabel_create(lv_screen_active());
43+
lv_obj_set_size(arclabel_slogan_1, 300, 200);
44+
lv_obj_set_style_text_letter_space(arclabel_slogan_1, 2, LV_PART_MAIN);
45+
lv_obj_set_style_text_color(arclabel_slogan_1, lv_palette_main(LV_PALETTE_AMBER), LV_PART_MAIN);
46+
lv_arclabel_set_text_static(arclabel_slogan_1, "STAY HUNGRY");
47+
lv_arclabel_set_offset(arclabel_slogan_1, 30);
48+
lv_arclabel_set_radius(arclabel_slogan_1, 150);
49+
lv_arclabel_set_recolor(arclabel_slogan_1, true);
50+
lv_arclabel_set_text_vertical_align(arclabel_slogan_1, LV_ARCLABEL_TEXT_ALIGN_TRAILING);
51+
lv_arclabel_set_text_horizontal_align(arclabel_slogan_1, LV_ARCLABEL_TEXT_ALIGN_CENTER);
52+
lv_arclabel_set_dir(arclabel_slogan_1, LV_ARCLABEL_DIR_COUNTER_CLOCKWISE);
53+
lv_obj_center(arclabel_slogan_1);
54+
55+
arclabel_slogan_2 = lv_arclabel_create(lv_screen_active());
56+
lv_obj_set_size(arclabel_slogan_2, 300, 200);
57+
lv_obj_set_style_text_letter_space(arclabel_slogan_2, 2, LV_PART_MAIN);
58+
lv_obj_set_style_text_color(arclabel_slogan_2, lv_palette_main(LV_PALETTE_AMBER), LV_PART_MAIN);
59+
lv_arclabel_set_text_static(arclabel_slogan_2, "STAY FOOLISH");
60+
lv_arclabel_set_offset(arclabel_slogan_2, 30);
61+
lv_arclabel_set_radius(arclabel_slogan_2, 150);
62+
lv_arclabel_set_angle_start(arclabel_slogan_2, 180);
63+
lv_arclabel_set_recolor(arclabel_slogan_2, true);
64+
lv_arclabel_set_text_vertical_align(arclabel_slogan_2, LV_ARCLABEL_TEXT_ALIGN_TRAILING);
65+
lv_arclabel_set_text_horizontal_align(arclabel_slogan_2, LV_ARCLABEL_TEXT_ALIGN_CENTER);
66+
lv_arclabel_set_dir(arclabel_slogan_2, LV_ARCLABEL_DIR_COUNTER_CLOCKWISE);
67+
lv_obj_center(arclabel_slogan_2);
68+
69+
70+
#if LV_FONT_MONTSERRAT_18
71+
lv_obj_set_style_text_font(arclabel_inner, &lv_font_montserrat_18, LV_PART_MAIN);
72+
lv_obj_set_style_text_font(arclabel_outer, &lv_font_montserrat_18, LV_PART_MAIN);
73+
#endif
74+
#if LV_FONT_MONTSERRAT_24
75+
lv_obj_set_style_text_font(arclabel_slogan_1, &lv_font_montserrat_24, LV_PART_MAIN);
76+
lv_obj_set_style_text_font(arclabel_slogan_2, &lv_font_montserrat_24, LV_PART_MAIN);
77+
#endif
78+
}
79+
80+
#endif

examples/widgets/lv_example_widgets.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void lv_example_arc_1(void);
3131
void lv_example_arc_2(void);
3232
void lv_example_arc_3(void);
3333

34-
void lv_example_arc_label_1(void);
34+
void lv_example_arclabel_1(void);
3535

3636
void lv_example_bar_1(void);
3737
void lv_example_bar_2(void);

0 commit comments

Comments
 (0)