lv_span.h

Typedefs

typedef _lv_span_overflow_t lv_span_overflow_t
typedef _lv_span_mode_t lv_span_mode_t

Enums

enum _lv_span_overflow_t

Values:

enumerator LV_SPAN_OVERFLOW_CLIP
enumerator LV_SPAN_OVERFLOW_ELLIPSIS
enumerator _LV_SPAN_OVERFLOW_LAST

Fence member

enum _lv_span_mode_t

Values:

enumerator LV_SPAN_MODE_FIXED

fixed the obj size

enumerator LV_SPAN_MODE_EXPAND

Expand the object size to the text size

enumerator LV_SPAN_MODE_BREAK

Keep width, break the too long lines and expand height

enumerator _LV_SPAN_MODE_LAST

Fence member

Functions

void lv_span_stack_init(void)
void lv_span_stack_deinit(void)
lv_obj_t *lv_spangroup_create(lv_obj_t *par)

Create a spangroup object

Parameters:

par -- pointer to an object, it will be the parent of the new spangroup

Returns:

pointer to the created spangroup

lv_span_t *lv_spangroup_new_span(lv_obj_t *obj)

Create a span string descriptor and add to spangroup.

Parameters:

obj -- pointer to a spangroup object.

Returns:

pointer to the created span.

void lv_spangroup_delete_span(lv_obj_t *obj, lv_span_t *span)

Remove the span from the spangroup and free memory.

Parameters:
  • obj -- pointer to a spangroup object.

  • span -- pointer to a span.

void lv_span_set_text(lv_span_t *span, const char *text)

Set a new text for a span. Memory will be allocated to store the text by the span.

Parameters:
  • span -- pointer to a span.

  • text -- pointer to a text.

void lv_span_set_text_static(lv_span_t *span, const char *text)

Set a static text. It will not be saved by the span so the 'text' variable has to be 'alive' while the span exist.

Parameters:
  • span -- pointer to a span.

  • text -- pointer to a text.

void lv_spangroup_set_align(lv_obj_t *obj, lv_text_align_t align)

Set the align of the spangroup.

Parameters:
  • obj -- pointer to a spangroup object.

  • align -- see lv_text_align_t for details.

void lv_spangroup_set_overflow(lv_obj_t *obj, lv_span_overflow_t overflow)

Set the overflow of the spangroup.

Parameters:
  • obj -- pointer to a spangroup object.

  • overflow -- see lv_span_overflow_t for details.

void lv_spangroup_set_indent(lv_obj_t *obj, lv_coord_t indent)

Set the indent of the spangroup.

Parameters:
  • obj -- pointer to a spangroup object.

  • indent -- The first line indentation

void lv_spangroup_set_mode(lv_obj_t *obj, lv_span_mode_t mode)

Set the mode of the spangroup.

Parameters:
  • obj -- pointer to a spangroup object.

  • mode -- see lv_span_mode_t for details.

void lv_spangroup_set_max_lines(lv_obj_t *obj, int32_t lines)

Set maximum lines of the spangroup.

Parameters:
  • obj -- pointer to a spangroup object.

  • lines -- max lines that can be displayed in LV_SPAN_MODE_BREAK mode. < 0 means no limit.

lv_span_t *lv_spangroup_get_child(const lv_obj_t *obj, int32_t id)

Get a spangroup child by its index.

Parameters:
  • obj -- The spangroup object

  • id -- 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:

The child span at index id, or NULL if the ID does not exist

uint32_t lv_spangroup_get_child_cnt(const lv_obj_t *obj)
Parameters:

obj -- The spangroup object to get the child count of.

Returns:

The span count of the spangroup.

lv_text_align_t lv_spangroup_get_align(lv_obj_t *obj)

get the align of the spangroup.

Parameters:

obj -- pointer to a spangroup object.

Returns:

the align value.

lv_span_overflow_t lv_spangroup_get_overflow(lv_obj_t *obj)

get the overflow of the spangroup.

Parameters:

obj -- pointer to a spangroup object.

Returns:

the overflow value.

lv_coord_t lv_spangroup_get_indent(lv_obj_t *obj)

get the indent of the spangroup.

Parameters:

obj -- pointer to a spangroup object.

Returns:

the indent value.

lv_span_mode_t lv_spangroup_get_mode(lv_obj_t *obj)

get the mode of the spangroup.

Parameters:

obj -- pointer to a spangroup object.

int32_t lv_spangroup_get_max_lines(lv_obj_t *obj)

get maximum lines of the spangroup.

Parameters:

obj -- pointer to a spangroup object.

Returns:

the max lines value.

lv_coord_t lv_spangroup_get_max_line_h(lv_obj_t *obj)

get max line height of all span in the spangroup.

Parameters:

obj -- pointer to a spangroup object.

uint32_t lv_spangroup_get_expand_width(lv_obj_t *obj, uint32_t max_width)

get the text content width when all span of spangroup on a line.

Parameters:
  • obj -- pointer to a spangroup object.

  • max_width -- if text content width >= max_width, return max_width to reduce computation, if max_width == 0, returns the text content width.

Returns:

text content width or max_width.

lv_coord_t lv_spangroup_get_expand_height(lv_obj_t *obj, lv_coord_t width)

get the text content height with width fixed.

Parameters:
  • obj -- pointer to a spangroup object.

  • width -- the width of the span group.

void lv_spangroup_refr_mode(lv_obj_t *obj)

update the mode of the spangroup.

Parameters:

obj -- pointer to a spangroup object.

Variables

const lv_obj_class_t lv_spangroup_class
struct lv_span_t

Public Members

char *txt
lv_obj_t *spangroup
lv_style_t style
uint32_t static_flag
struct lv_spangroup_t
#include <lv_span.h>

Data of label

Public Members

lv_obj_t obj
int32_t lines
lv_coord_t indent
lv_coord_t cache_w
lv_coord_t cache_h
lv_ll_t child_ll
uint32_t mode
uint32_t overflow
uint32_t refresh