lv_obj_property.h

Defines

LV_PROPERTY_TYPE_INVALID
LV_PROPERTY_TYPE_INT
LV_PROPERTY_TYPE_PRECISE
LV_PROPERTY_TYPE_COLOR
LV_PROPERTY_TYPE_POINT
LV_PROPERTY_TYPE_POINTER
LV_PROPERTY_TYPE_IMGSRC
LV_PROPERTY_TYPE_TEXT
LV_PROPERTY_TYPE_OBJ
LV_PROPERTY_TYPE_DISPLAY
LV_PROPERTY_TYPE_FONT
LV_PROPERTY_TYPE_BOOL
LV_PROPERTY_TYPE_SHIFT
LV_PROPERTY_ID(clz, name, type, index)
LV_PROPERTY_ID_TYPE(id)
LV_PROPERTY_ID_INDEX(id)
LV_OBJ_SET_PROPERTY_ARRAY(obj, array)

Enums

enum [anonymous]

Group of predefined widget ID start value.

Values:

enumerator LV_PROPERTY_ID_INVALID
enumerator LV_PROPERTY_STYLE_START
enumerator LV_PROPERTY_ID_START
enumerator LV_PROPERTY_OBJ_START
enumerator LV_PROPERTY_IMAGE_START
enumerator LV_PROPERTY_LABEL_START
enumerator LV_PROPERTY_KEYBOARD_START
enumerator LV_PROPERTY_TEXTAREA_START
enumerator LV_PROPERTY_ROLLER_START
enumerator LV_PROPERTY_DROPDOWN_START
enumerator LV_PROPERTY_ID_BUILTIN_LAST
enumerator LV_PROPERTY_ID_ANY

Functions

lv_result_t lv_obj_set_property(lv_obj_t *obj, const lv_property_t *value)

Set widget property.

Parameters:
  • obj -- pointer to an object

  • value -- The property value to set

Returns:

return LV_RESULT_OK if success

lv_result_t lv_obj_set_properties(lv_obj_t *obj, const lv_property_t *value, uint32_t count)

Set multiple widget properties. Helper LV_OBJ_SET_PROPERTY_ARRAY can be used for constant property array.

Parameters:
  • obj -- pointer to an object

  • value -- The property value array to set

  • count -- The count of the property value array

Returns:

return LV_RESULT_OK if success

lv_property_t lv_obj_get_property(lv_obj_t *obj, lv_prop_id_t id)

Read property value from object. If id is a style property, the style selector is default to 0.

Parameters:
  • obj -- pointer to an object

  • id -- ID of which property to read

Returns:

return the property value read. The returned property ID is set to LV_PROPERTY_ID_INVALID if failed.

lv_property_t lv_obj_get_style_property(lv_obj_t *obj, lv_prop_id_t id, uint32_t selector)

Read a style property value from object

Parameters:
  • obj -- pointer to an object

  • id -- ID of style property

  • selector -- selector for the style property.

Returns:

return the property value read. The returned property ID is set to LV_PROPERTY_ID_INVALID if failed.

lv_prop_id_t lv_obj_property_get_id(const lv_obj_t *obj, const char *name)

Get the property ID by name recursively to base classes. Requires to enable LV_USE_OBJ_PROPERTY_NAME.

Parameters:
  • obj -- pointer to an object that has specified property or base class has.

  • name -- property name

Returns:

property ID found or LV_PROPERTY_ID_INVALID if not found.

lv_prop_id_t lv_obj_class_property_get_id(const lv_obj_class_t *clz, const char *name)

Get the property ID by name without check base class recursively. Requires to enable LV_USE_OBJ_PROPERTY_NAME.

Parameters:
  • clz -- pointer to an object class that has specified property or base class has.

  • name -- property name

Returns:

property ID found or LV_PROPERTY_ID_INVALID if not found.

lv_prop_id_t lv_style_property_get_id(const char *name)

Get the style property ID by name. Requires to enable LV_USE_OBJ_PROPERTY_NAME.

Parameters:

name -- property name

Returns:

property ID found or LV_PROPERTY_ID_INVALID if not found.

struct _lv_property_name_t

Public Members

const char *name
lv_prop_id_t id
struct lv_property_t

Public Members

lv_prop_id_t id
int32_t num

Number integer number (opacity, enums, booleans or "normal" numbers)

bool enable

booleans

const void *ptr

Constant pointers (font, cone text, etc)

lv_color_t color

Colors

lv_value_precise_t precise

float or int for precise value

lv_point_t point

Point

lv_style_value_t style

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.

uint32_t selector

Style selector, lv_part_t | lv_state_t

union lv_property_t::[anonymous] [anonymous]
struct lv_property_ops_t

Public Members

lv_prop_id_t id
void *setter

Callback used to set property.

void *getter

Callback used to get property.