chore(arc_label): documentation, formatting, redundant code fixes

This commit is contained in:
Benign X
2025-05-28 16:42:14 +08:00
committed by Felipe Neves
parent 059eb4a321
commit cb593b35ea
7 changed files with 20 additions and 21 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
Simple Arc Label
----------
----------------
.. lv_example:: widgets/arc_label/lv_example_arc_label_1
:language: c
@@ -2,7 +2,7 @@
#if LV_USE_ARC_LABEL && LV_BUILD_EXAMPLES
const char * ARC_LABEL_TEXT =
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)
+1
View File
@@ -699,6 +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.
* */
#define LV_WIDGETS_HAS_DEFAULT_VALUE 1
+1
View File
@@ -2030,6 +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.
* */
#ifndef LV_WIDGETS_HAS_DEFAULT_VALUE
#ifdef LV_KCONFIG_PRESENT
+2 -5
View File
@@ -137,7 +137,6 @@ void lv_arc_label_set_text_fmt(lv_obj_t * obj, const char * fmt, ...)
LV_ASSERT_OBJ(obj, MY_CLASS);
LV_ASSERT_NULL(fmt);
lv_obj_invalidate(obj);
lv_arc_label_t * arc_label = (lv_arc_label_t *)obj;
/*If text is NULL then refresh*/
@@ -346,11 +345,9 @@ static void lv_arc_label_constructor(const lv_obj_class_t * class_p, lv_obj_t *
arc->dir = LV_ARC_LABEL_DIR_CLOCKWISE;
arc->recolor = false;
lv_obj_remove_flag(obj, LV_OBJ_FLAG_CLICKABLE);
lv_arc_label_set_text(obj, LV_ARC_LABEL_DEFAULT_TEXT);
lv_arc_label_set_text_static(obj, LV_ARC_LABEL_DEFAULT_TEXT);
lv_obj_remove_flag(obj, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(obj, LV_OBJ_FLAG_SCROLL_CHAIN | LV_OBJ_FLAG_SCROLLABLE);
lv_obj_remove_flag(obj, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLL_CHAIN | LV_OBJ_FLAG_SCROLLABLE);
LV_TRACE_OBJ_CREATE("finished");
}
+13 -13
View File
@@ -51,9 +51,9 @@ LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_arc_label_class;
**********************/
/**
* Create an arc object
* @param parent pointer to an object, it will be the parent of the new arc
* @return pointer to the created arc
* Create an arc label object
* @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);
@@ -98,35 +98,35 @@ void lv_arc_label_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 object
* @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);
/**
* Set the end angle of an arc. 0 deg: right, 90 bottom, etc.
* @param obj pointer to an arc object
* @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);
/**
* Set the rotation for the whole arc
* @param obj pointer to an arc object
* @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);
/**
* Set the type of arc.
* @param obj pointer to arc object
* @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);
/**
* Enable the recoloring by in-line commands
* @param obj pointer to a label object
* @param obj pointer to an arc label object
* @param en true: enable recoloring, false: disable
* Example: "This is a #ff0000 red# word"
*/
@@ -174,21 +174,21 @@ void lv_arc_label_set_text_horizontal_align(lv_obj_t * obj, lv_arc_label_text_al
/**
* Get the start angle of an arc label.
* @param obj pointer to an arc object
* @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);
/**
* Get the angle size of an arc label.
* @param obj pointer to an arc object
* @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);
/**
* Get whether the arc is type or not.
* @param obj pointer to an arc object
* 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);
@@ -205,7 +205,7 @@ bool lv_arc_label_get_recolor(lv_obj_t * obj);
/**
* Get the text of the arc label.
* @param obj pointer to an arc object
* @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);
@@ -16,7 +16,7 @@
#define EXT_NAME ".lp32.png"
#endif
const char * ARC_LABEL_TEXT =
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;