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 *parent)

Create a spangroup object

参数:

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

返回:

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.

参数:

obj -- pointer to a spangroup object.

返回:

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • 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.

参数:
  • 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.

参数:
  • obj -- pointer to a spangroup object.

  • overflow -- see lv_span_overflow_t for details.

void lv_spangroup_set_indent(lv_obj_t *obj, int32_t indent)

Set the indent of the spangroup.

参数:
  • 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.

参数:
  • 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.

参数:
  • 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.

参数:
  • 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

返回:

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

uint32_t lv_spangroup_get_span_count(const lv_obj_t *obj)

Get number of spans

参数:

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

返回:

the span count of the spangroup.

lv_text_align_t lv_spangroup_get_align(lv_obj_t *obj)

Get the align of the spangroup.

参数:

obj -- pointer to a spangroup object.

返回:

the align value.

lv_span_overflow_t lv_spangroup_get_overflow(lv_obj_t *obj)

Get the overflow of the spangroup.

参数:

obj -- pointer to a spangroup object.

返回:

the overflow value.

int32_t lv_spangroup_get_indent(lv_obj_t *obj)

Get the indent of the spangroup.

参数:

obj -- pointer to a spangroup object.

返回:

the indent value.

lv_span_mode_t lv_spangroup_get_mode(lv_obj_t *obj)

Get the mode of the spangroup.

参数:

obj -- pointer to a spangroup object.

int32_t lv_spangroup_get_max_lines(lv_obj_t *obj)

Get maximum lines of the spangroup.

参数:

obj -- pointer to a spangroup object.

返回:

the max lines value.

int32_t lv_spangroup_get_max_line_height(lv_obj_t *obj)

Get max line height of all span in the spangroup.

参数:

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.

参数:
  • 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.

返回:

text content width or max_width.

int32_t lv_spangroup_get_expand_height(lv_obj_t *obj, int32_t width)

Get the text content height with width fixed.

参数:
  • 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.

参数:

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
int32_t indent
int32_t cache_w
int32_t cache_h
lv_ll_t child_ll
uint32_t mode
uint32_t overflow
uint32_t refresh