Skip to content

Commit 8487b4c

Browse files
W-MaiuLipe
authored andcommitted
docs(arc_label): add arc label docs
1 parent cb593b3 commit 8487b4c

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
.. _lv_arc_label:
2+
3+
========================
4+
Arc Label (lv_arc_label)
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_arc_label_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_arc_label_usage:
21+
22+
Usage
23+
*****
24+
25+
Text Management
26+
---------------
27+
28+
- Text can be set using :cpp:expr:`lv_arc_label_set_text(arc_label, "Your text")`.
29+
- For formatted text, use :cpp:expr:`lv_arc_label_set_text_fmt(arc_label, "Formatted %s", "text")`.
30+
- Static text can be set with :cpp:expr:`lv_arc_label_set_text_static(arc_label, 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_arc_label_set_angle_start(arc_label, angle)`.
36+
- Define the arc size (angular span) using :cpp:expr:`lv_arc_label_set_angle_size(arc_label, 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_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)`.
43+
44+
- :cpp:enumerator:`LV_ARC_LABEL_DIR_CLOCKWISE` Text flows in a clockwise direction along the arc.
45+
- :cpp:enumerator:`LV_ARC_LABEL_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_arc_label_set_text_vertical_align(arc_label, LV_ARC_LABEL_TEXT_ALIGN_CENTER)`.
51+
Set horizontal alignment using :cpp:expr:`lv_arc_label_set_text_horizontal_align(arc_label, LV_ARC_LABEL_TEXT_ALIGN_CENTER)`.
52+
53+
Both vertical and horizontal use the same logic.
54+
55+
- :cpp:enumerator:`LV_ARC_LABEL_TEXT_ALIGN_DEFAULT` Uses the default alignment.
56+
- :cpp:enumerator:`LV_ARC_LABEL_TEXT_ALIGN_LEADING` Aligns text to the leading edge of the arc.
57+
- :cpp:enumerator:`LV_ARC_LABEL_TEXT_ALIGN_CENTER` Centers text along the arc.
58+
- :cpp:enumerator:`LV_ARC_LABEL_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_arc_label_set_radius(arc_label, radius)`.
64+
- 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)`.
65+
66+
Color and Recoloring
67+
--------------------
68+
69+
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.
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_arc_label_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_arc_label_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_arc_label_example:
91+
92+
Example
93+
*******
94+
95+
.. include:: ../../examples/widgets/arc_label/index.rst
96+
97+
.. _lv_arc_label_api:
98+
99+
API
100+
***

docs/src/details/widgets/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ All Widgets
1717
3dtexture
1818
animimg
1919
arc
20+
arc_label
2021
bar
2122
button
2223
buttonmatrix

0 commit comments

Comments
 (0)