lv_obj_property.h
API reference for lv_obj_property.h
Functions
lv_obj_set_property
Set Widget property.
lv_result_t lv_obj_set_property(lv_obj_t *obj, const lv_property_t *value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
value | const lv_property_t * | property value to set |
Returns: lv_result_t — return LV_RESULT_OK if call succeeded
lv_obj_set_properties
Set multiple Widget properties. Helper LV_OBJ_SET_PROPERTY_ARRAY can be used for constant property array.
lv_result_t lv_obj_set_properties(lv_obj_t *obj, const lv_property_t *value, uint32_t count)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
value | const lv_property_t * | property value array to set |
count | uint32_t | number of array elements |
Returns: lv_result_t — return LV_RESULT_OK if call succeeded
lv_obj_get_property
Read property value from Widget. If id is a style property, computes the style of PART_MAIN.
lv_property_t lv_obj_get_property(lv_obj_t *obj, lv_prop_id_t id)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
id | lv_prop_id_t | ID of property to read |
Returns: lv_property_t — return property value read. The returned property ID is set to LV_PROPERTY_ID_INVALID if read failed.
lv_obj_get_style_property
Read style property value from Widget
lv_property_t lv_obj_get_style_property(lv_obj_t *obj, lv_prop_id_t id, lv_part_t part)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
id | lv_prop_id_t | ID of style property |
part | lv_part_t | part for which the style property should be computed |
Returns: lv_property_t — return property value read. The returned property ID is set to LV_PROPERTY_ID_INVALID if read failed.
lv_obj_property_get_id
Get property ID by recursively searching for name in Widget's class hierarchy, and if still not found, then search style properties. Requires to enabling LV_USE_OBJ_PROPERTY_NAME.
lv_prop_id_t lv_obj_property_get_id(const lv_obj_t *obj, const char *name)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to Widget whose class and base-class hierarchy are to be searched. |
name | const char * | property name |
Returns: lv_prop_id_t — property ID found or LV_PROPERTY_ID_INVALID if not found.
lv_obj_class_property_get_id
Get property ID by doing a non-recursive search for name directly in Widget class properties. Requires enabling LV_USE_OBJ_PROPERTY_NAME.
lv_prop_id_t lv_obj_class_property_get_id(const lv_obj_class_t *clz, const char *name)| Name | Type | Description |
|---|---|---|
clz | const lv_obj_class_t * | pointer to Widget class that has specified property. |
name | const char * | property name |
Returns: lv_prop_id_t — property ID found or LV_PROPERTY_ID_INVALID if not found.
lv_style_property_get_id
Get style property ID by name. Requires enabling LV_USE_OBJ_PROPERTY_NAME.
lv_prop_id_t lv_style_property_get_id(const char *name)| Name | Type | Description |
|---|---|---|
name | const char * | property name |
Returns: lv_prop_id_t — property ID found or LV_PROPERTY_ID_INVALID if not found.
Enums
_lv_prop_id_range_boundary_t
Group of predefined widget ID start value.
| Name | Value |
|---|---|
LV_PROPERTY_ID_INVALID | 0 |
LV_PROPERTY_STYLE_START | 0x00 |
LV_PROPERTY_ID_START | 0x0100 |
LV_PROPERTY_OBJ_START | 0x0100 |
LV_PROPERTY_IMAGE_START | 0x0200 |
LV_PROPERTY_LABEL_START | 0x0300 |
LV_PROPERTY_KEYBOARD_START | 0x0400 |
LV_PROPERTY_TEXTAREA_START | 0x0500 |
LV_PROPERTY_ROLLER_START | 0x0600 |
LV_PROPERTY_DROPDOWN_START | 0x0700 |
LV_PROPERTY_SLIDER_START | 0x0800 |
LV_PROPERTY_ANIMIMAGE_START | 0x0900 |
LV_PROPERTY_ARC_START | 0x0a00 |
LV_PROPERTY_BAR_START | 0x0b00 |
LV_PROPERTY_SWITCH_START | 0x0c00 |
LV_PROPERTY_CHECKBOX_START | 0x0d00 |
LV_PROPERTY_LED_START | 0x0e00 |
LV_PROPERTY_LINE_START | 0x0f00 |
LV_PROPERTY_SCALE_START | 0x1000 |
LV_PROPERTY_SPINBOX_START | 0x1100 |
LV_PROPERTY_SPINNER_START | 0x1200 |
LV_PROPERTY_TABLE_START | 0x1300 |
LV_PROPERTY_TABVIEW_START | 0x1400 |
LV_PROPERTY_BUTTONMATRIX_START | 0x1500 |
LV_PROPERTY_SPAN_START | 0x1600 |
LV_PROPERTY_MENU_START | 0x1700 |
LV_PROPERTY_CHART_START | 0x1800 |
LV_PROPERTY_ID_BUILTIN_LAST | 0xffff |
LV_PROPERTY_ID_ANY | 0x7ffffffe |
Structs
_lv_property_name_t
| Member | Type | Description |
|---|---|---|
name | const char * | |
id | lv_prop_id_t |
lv_property_t
| Member | Type | Description |
|---|---|---|
id | lv_prop_id_t | |
num | int32_t | Signed integer number (enums or "normal" numbers) |
num_u | uint32_t | Unsigned integer number (opacity, Booleans) <br/> |
enable | bool | Booleans |
ptr | const void * | Constant pointers (font, cone text, etc.) |
color | lv_color_t | Colors |
precise | lv_value_precise_t | float or int for precise value |
point | lv_point_t | Point, contains two int32_t |
style | lv_style_value_t | Note that place struct member style at first place is intended. style shares same memory with num, ptr, color. So we set the style value directly without using prop.style.num.E.g. static const lv_property_t obj_pos_x = { .id = LV_PROPERTY_STYLE_X, .num = 123, .selector = LV_STATE_PRESSED, }instead of: static const lv_property_t obj_pos_x = { .id = LV_PROPERTY_STYLE_X, .style.num = 123, // note this line. .selector = LV_STATE_PRESSED, } Make sure it's the first element in struct. |
selector | uint32_t | Style selector, lv_part_t | lv_state_t |
arg1 | union lv_property_t | |
arg2 | union lv_property_t | |
| `` | union lv_property_t |
Used by 2 functions
lv_obj_set_property— paramvaluelv_obj_set_properties— paramvalue
lv_property_ops_t
| Member | Type | Description |
|---|---|---|
id | lv_prop_id_t | |
setter | void * | Callback used to set property. |
getter | void * | Callback used to get property. |
Macros
LV_PROPERTY_TYPE_INVALID
#define LV_PROPERTY_TYPE_INVALID 0 /*Use default 0 as invalid to detect program outliers*/LV_PROPERTY_TYPE_INT
#define LV_PROPERTY_TYPE_INT 1 /*int32_t type*/LV_PROPERTY_TYPE_PRECISE
#define LV_PROPERTY_TYPE_PRECISE 2 /*lv_value_precise_t, int32_t or float depending on LV_USE_FLOAT*/LV_PROPERTY_TYPE_COLOR
#define LV_PROPERTY_TYPE_COLOR 3 /*ARGB8888 type*/LV_PROPERTY_TYPE_POINT
#define LV_PROPERTY_TYPE_POINT 4 /*lv_point_t */LV_PROPERTY_TYPE_POINTER
#define LV_PROPERTY_TYPE_POINTER 5 /*void * pointer*/LV_PROPERTY_TYPE_IMGSRC
#define LV_PROPERTY_TYPE_IMGSRC 6 /*Special pointer for image*/LV_PROPERTY_TYPE_TEXT
#define LV_PROPERTY_TYPE_TEXT 7 /*Special pointer of char* */LV_PROPERTY_TYPE_OBJ
#define LV_PROPERTY_TYPE_OBJ 8 /*Special pointer of lv_obj_t* */LV_PROPERTY_TYPE_DISPLAY
#define LV_PROPERTY_TYPE_DISPLAY 9 /*Special pointer of lv_display_t* */LV_PROPERTY_TYPE_FONT
#define LV_PROPERTY_TYPE_FONT 10 /*Special pointer of lv_font_t* */LV_PROPERTY_TYPE_BOOL
#define LV_PROPERTY_TYPE_BOOL 11 /*int32_t type*/LV_PROPERTY_TYPE_SHIFT
#define LV_PROPERTY_TYPE_SHIFT 28LV_PROPERTY_TYPE2_SHIFT
#define LV_PROPERTY_TYPE2_SHIFT 24LV_PROPERTY_ID
#define LV_PROPERTY_ID(clz, name, type, index) \
LV_PROPERTY_## clz ##_##name = (LV_PROPERTY_## clz ##_START + ((int)index)) | ((type) << LV_PROPERTY_TYPE_SHIFT)LV_PROPERTY_ID2
#define LV_PROPERTY_ID2(clz, name, type, type2, index) \
LV_PROPERTY_ID(clz, name, type, index) | ((type2) << LV_PROPERTY_TYPE2_SHIFT)LV_PROPERTY_ID_TYPE
#define LV_PROPERTY_ID_TYPE(id) \
((id) >> LV_PROPERTY_TYPE_SHIFT)LV_PROPERTY_ID_TYPE2
#define LV_PROPERTY_ID_TYPE2(id) \
((id) >> LV_PROPERTY_TYPE_SHIFT)LV_PROPERTY_ID_INDEX
#define LV_PROPERTY_ID_INDEX(id) \
((id) & 0xfffffff)LV_OBJ_SET_PROPERTY_ARRAY
#define LV_OBJ_SET_PROPERTY_ARRAY(obj, array) \
lv_obj_set_properties(obj, array, LV_ARRAYLEN(array))LV_PROPERTY_CLASS_FIELDS
#define LV_PROPERTY_CLASS_FIELDS(widget, uppercase) \
.prop_index_start = LV_PROPERTY_##uppercase##_START, \
.prop_index_end = LV_PROPERTY_##uppercase##_END, \
.properties = lv_##widget##_properties, \
.properties_count = LV_ARRAYLEN(lv_##widget##_properties), \
.property_names = lv_##widget##_property_names, \
.names_count = LV_ARRAYLEN(lv_##widget##_property_names)Dependencies
Indirect dependencies
Last updated on