lv_span.h
Typedefs
-
typedef struct _lv_span_coords_t lv_span_coords_t
Coords of a span
Enums
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_style_t *lv_span_get_style(lv_span_t *span)
Get a pointer to the style of a span
- 参数:
span -- pointer to the span
- 返回:
pointer to the style. valid as long as the span is valid
-
const char *lv_span_get_text(lv_span_t *span)
Get a pointer to the text of a span
- 参数:
span -- pointer to the span
- 返回:
pointer to the text
-
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.
-
lv_span_coords_t lv_spangroup_get_span_coords(lv_obj_t *obj, const lv_span_t *span)
Get 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 | +-------------------+
- 参数:
obj -- pointer to a spangroup object.
span -- pointer to a span.
- 返回:
the span's coords in the spangroup.
-
lv_span_t *lv_spangroup_get_span_by_point(lv_obj_t *obj, const lv_point_t *point)
Get the span object by point.
- 参数:
obj -- pointer to a spangroup object.
point -- pointer to point containing absolute coordinates
- 返回:
pointer to the span under the point or
NULL
if not found.
Variables
-
const lv_obj_class_t lv_spangroup_class
-
struct _lv_span_coords_t
- #include <lv_span.h>
Coords of a span