lv_span.h
API reference for lv_span.h
Functions
lv_span_set_text
Set a new text for a span. Memory will be allocated to store the text by the span. As the spangroup is not passed a redraw (invalidation) can't be triggered automatically. Therefore lv_spangroup_refresh(spangroup) needs to be called manually,
void lv_span_set_text(lv_span_t *span, const char *text)| Name | Type | Description |
|---|---|---|
span | lv_span_t * | pointer to a span. |
text | const char * | pointer to a text. |
lv_span_set_text_fmt
Set a new text for a span using a printf-like formatting string. Memory will be allocated to store the text by the span. As the spangroup is not passed a redraw (invalidation) can't be triggered automatically. Therefore lv_spangroup_refresh(spangroup) needs to be called manually,
void lv_span_set_text_fmt(lv_span_t *span, const char *fmt,...)| Name | Type | Description |
|---|---|---|
span | lv_span_t * | pointer to a span. |
fmt | const char * | printf-like format string |
... |
lv_span_set_text_static
Set a static text. It will not be saved by the span so the 'text' variable has to be 'alive' while the span exist. As the spangroup is not passed a redraw (invalidation) can't be triggered automatically. Therefore lv_spangroup_refresh(spangroup) needs to be called manually,
void lv_span_set_text_static(lv_span_t *span, const char *text)| Name | Type | Description |
|---|---|---|
span | lv_span_t * | pointer to a span. |
text | const char * | pointer to a text. |
lv_spangroup_set_span_text
Set a new text for a span. Memory will be allocated to store the text by the span.
void lv_spangroup_set_span_text(lv_obj_t *obj, lv_span_t *span, const char *text)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup widget. |
span | lv_span_t * | pointer to a span. |
text | const char * | pointer to a text. |
lv_spangroup_set_span_text_static
Set a new text for a span. Memory will be allocated to store the text by the span.
void lv_spangroup_set_span_text_static(lv_obj_t *obj, lv_span_t *span, const char *text)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup widget. |
span | lv_span_t * | pointer to a span. |
text | const char * | pointer to a text. |
lv_spangroup_set_span_text_fmt
Set a new text for a span using a printf-like formatting string. Memory will be allocated to store the text by the span.
void lv_spangroup_set_span_text_fmt(lv_obj_t *obj, lv_span_t *span, const char *fmt,...)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup widget. |
span | lv_span_t * | pointer to a span. |
fmt | const char * | printf-like format string |
... |
lv_spangroup_set_span_style
Copy all style properties of style to the bbuilt-in static style of the span.
void lv_spangroup_set_span_style(lv_obj_t *obj, lv_span_t *span, const lv_style_t *style)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer_to a spangroup |
span | lv_span_t * | pointer to a span. |
style | const lv_style_t * | pointer to a style to copy into the span's built-in style |
lv_spangroup_set_align
DEPRECATED. Use the text_align style property instead Set the align of the spangroup.
void lv_spangroup_set_align(lv_obj_t *obj, lv_text_align_t align)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
align | lv_text_align_t | see lv_text_align_t for details. |
lv_spangroup_set_overflow
Set the overflow of the spangroup.
void lv_spangroup_set_overflow(lv_obj_t *obj, lv_span_overflow_t overflow)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
overflow | lv_span_overflow_t | see lv_span_overflow_t for details. |
lv_spangroup_set_indent
Set the indent of the spangroup.
void lv_spangroup_set_indent(lv_obj_t *obj, int32_t indent)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
indent | int32_t | the first line indentation |
lv_spangroup_set_mode
DEPRECATED, set the width to LV_SIZE_CONTENT or fixed value to control expanding/wrapping" Set the mode of the spangroup.
void lv_spangroup_set_mode(lv_obj_t *obj, lv_span_mode_t mode)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
mode | lv_span_mode_t | see lv_span_mode_t for details. |
lv_spangroup_set_max_lines
Set maximum lines of the spangroup.
void lv_spangroup_set_max_lines(lv_obj_t *obj, int32_t lines)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
lines | int32_t | max lines that can be displayed in LV_SPAN_MODE_BREAK mode. < 0 means no limit. |
lv_span_get_style
Get a pointer to the style of a span's built-in style. Any lv_style_set_... functions can be applied on the returned style.
lv_style_t * lv_span_get_style(lv_span_t *span)| Name | Type | Description |
|---|---|---|
span | lv_span_t * | pointer to the span |
Returns: lv_style_t * — pointer to the style. (valid as long as the span is valid)
lv_span_get_text
Get a pointer to the text of a span
const char * lv_span_get_text(lv_span_t *span)| Name | Type | Description |
|---|---|---|
span | lv_span_t * | pointer to the span |
Returns: const char * — pointer to the text
lv_spangroup_get_child
Get a spangroup child by its index.
lv_span_t * lv_spangroup_get_child(const lv_obj_t *obj, int32_t id)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | The spangroup object |
id | int32_t | the index of the child. 0: the oldest (firstly created) child 1: the second oldest child count-1: the youngest -1: the youngest -2: the second youngest |
Returns: lv_span_t * — The child span at index id, or NULL if the ID does not exist
lv_spangroup_get_span_count
Get number of spans
uint32_t lv_spangroup_get_span_count(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | the spangroup object to get the child count of. |
Returns: uint32_t — the span count of the spangroup.
lv_spangroup_get_align
Get the align of the spangroup.
lv_text_align_t lv_spangroup_get_align(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
Returns: lv_text_align_t — the align value.
lv_spangroup_get_overflow
Get the overflow of the spangroup.
lv_span_overflow_t lv_spangroup_get_overflow(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
Returns: lv_span_overflow_t — the overflow value.
lv_spangroup_get_indent
Get the indent of the spangroup.
int32_t lv_spangroup_get_indent(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
Returns: int32_t — the indent value.
lv_spangroup_get_mode
Get the mode of the spangroup.
lv_span_mode_t lv_spangroup_get_mode(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
lv_spangroup_get_max_lines
Get maximum lines of the spangroup.
int32_t lv_spangroup_get_max_lines(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
Returns: int32_t — the max lines value.
lv_spangroup_get_max_line_height
Get max line height of all span in the spangroup.
int32_t lv_spangroup_get_max_line_height(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
lv_spangroup_get_expand_width
Get the text content width when all span of spangroup on a line.
uint32_t lv_spangroup_get_expand_width(lv_obj_t *obj, uint32_t max_width)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
max_width | uint32_t | if text content width >= max_width, return max_width to reduce computation, if max_width == 0, returns the text content width. |
Returns: uint32_t — text content width or max_width.
lv_spangroup_get_expand_height
Get the text content height with width fixed.
int32_t lv_spangroup_get_expand_height(lv_obj_t *obj, int32_t width)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
width | int32_t | the width of the span group. |
lv_spangroup_get_span_coords
Get the span's coords in the spangroup.
lv_span_coords_t lv_spangroup_get_span_coords(lv_obj_t *obj, const lv_span_t *span)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
span | const lv_span_t * | pointer to a span. |
Returns: lv_span_coords_t — the span's coords in the spangroup.
Before calling this function, please make sure that the layout of span group has been updated. Like calling lv_obj_update_layout() like function.
+--------+
|Heading +--->------------------+
| Pos | | Heading |
+--------+---+------------------+
| |
| |
| |
| Middle +--------+|
| |Trailing||
| +-| Pos ||
| | +--------+|
+-------------------v-----------+
| Trailing |
+-------------------+lv_spangroup_get_span_by_point
Get the span object by point.
lv_span_t * lv_spangroup_get_span_by_point(lv_obj_t *obj, const lv_point_t *p)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
p | const lv_point_t * | pointer to point containing absolute coordinates |
Returns: lv_span_t * — pointer to the span under the point or NULL if not found.
lv_span_stack_init
void lv_span_stack_init(void)lv_span_stack_deinit
void lv_span_stack_deinit(void)lv_spangroup_create
Create a spangroup object
lv_obj_t * lv_spangroup_create(lv_obj_t *parent)| Name | Type | Description |
|---|---|---|
parent | lv_obj_t * | pointer to a parent widget May be NULL.. When NULL, the widget is created as a screen on the default display. |
Returns: lv_obj_t * — pointer to the created spangroup
lv_spangroup_add_span
Create a span string descriptor and add to spangroup.
lv_span_t * lv_spangroup_add_span(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
Returns: lv_span_t * — pointer to the created span.
lv_spangroup_delete_span
Remove the span from the spangroup and free memory.
void lv_spangroup_delete_span(lv_obj_t *obj, lv_span_t *span)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
span | lv_span_t * | pointer to a span. May be NULL.. When NULL nothing will be deleted |
Note that before calling lv_spangroup_delete_span lv_observer_delete needs to be called manually as LVGL can't remove the binding automatically.
lv_spangroup_refresh
Update the mode of the spangroup.
void lv_spangroup_refresh(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a spangroup object. |
lv_spangroup_bind_span_text
Bind an integer, string, or pointer Subject to a Spangroup's Span.
lv_observer_t * lv_spangroup_bind_span_text(lv_obj_t *obj, lv_span_t *span, lv_subject_t *subject, const char *fmt)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Spangroup |
span | lv_span_t * | pointer to Span |
subject | lv_subject_t * | pointer to Subject |
fmt | const char * | optional printf-like format string with 1 format specifier (e.g. "%d °C") May be NULL.. See note below |
Returns: lv_observer_t * — pointer to newly-created Observer
If fmt == NULL strings and pointers (\0 terminated string) will be shown as text as they are, integers as d, floats as %0.1f
Enums
lv_span_overflow_t
| Name | Description |
|---|---|
LV_SPAN_OVERFLOW_CLIP | |
LV_SPAN_OVERFLOW_ELLIPSIS | |
LV_SPAN_OVERFLOW_LAST | Fence member |
Used by 1 function
lv_spangroup_set_overflow— paramoverflow
lv_span_mode_t
| Name | Description |
|---|---|
LV_SPAN_MODE_FIXED | fixed the obj size |
LV_SPAN_MODE_EXPAND | Expand the object size to the text size |
LV_SPAN_MODE_BREAK | Keep width, break the too long lines and expand height |
LV_SPAN_MODE_LAST | Fence member |
Used by 1 function
lv_spangroup_set_mode— parammode
_lv_property_span_id_t
| Name | Value |
|---|---|
LV_PROPERTY_SPAN_ALIGN | (LV_PROPERTY_SPAN_START + ((int) 0 )) | (( 1 ) << 28 ) |
LV_PROPERTY_SPAN_OVERFLOW | (LV_PROPERTY_SPAN_START + ((int) 1 )) | (( 1 ) << 28 ) |
LV_PROPERTY_SPAN_INDENT | (LV_PROPERTY_SPAN_START + ((int) 2 )) | (( 1 ) << 28 ) |
LV_PROPERTY_SPAN_MODE | (LV_PROPERTY_SPAN_START + ((int) 3 )) | (( 1 ) << 28 ) |
LV_PROPERTY_SPAN_MAX_LINES | (LV_PROPERTY_SPAN_START + ((int) 4 )) | (( 1 ) << 28 ) |
LV_PROPERTY_SPAN_END |
Structs
_lv_span_coords_t
Coords of a span
Typedefs
lv_span_coords_t
typedef struct _lv_span_coords_t lv_span_coords_tCoords of a span
Variables
lv_spangroup_class
const lv_obj_class_t lv_spangroup_classDependencies
Indirect dependencies
lv_anim.hlv_area.hlv_assert.hlv_bidi.hlv_color.hlv_color_op.hlv_display.hlv_draw.hlv_draw_arc.hlv_draw_blur.hlv_draw_buf.hlv_draw_image.hlv_draw_label.hlv_draw_line.hlv_draw_rect.hlv_draw_triangle.hlv_event.hlv_ext_data.hlv_flex.hlv_font.hlv_fs.hlv_grad.hlv_grid.hlv_group.hlv_image_decoder.hlv_image_dsc.hlv_indev.hlv_layout.hlv_ll.hlv_log.hlv_math.hlv_matrix.hlv_mem.hlv_obj_class.hlv_obj_draw.hlv_obj_event.hlv_obj_pos.hlv_obj_scroll.hlv_obj_style.hlv_obj_style_gen.hlv_obj_tree.hlv_palette.hlv_profiler.hlv_profiler_builtin.hlv_sprintf.hlv_string.hlv_style.hlv_style_gen.hlv_symbol_def.hlv_text.hlv_timer.hlv_types.h
Last updated on