1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

Merge pull request #1019 from canardos/dev-6.0

add lv_obj_set_user_data function
This commit is contained in:
Gabor Kiss-Vamosi 2019-04-19 05:21:42 +02:00 committed by GitHub
commit a3c08e9985
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -1980,6 +1980,16 @@ lv_obj_user_data_t * lv_obj_get_user_data(lv_obj_t * obj)
{
return &obj->user_data;
}
/**
* Set the object's user data. The data will be copied.
* @param obj pointer to an object
* @param data user data
*/
void lv_obj_set_user_data(lv_obj_t * obj, lv_obj_user_data_t data)
{
memcpy(&obj->user_data, &data, sizeof(lv_obj_user_data_t));
}
#endif
#if LV_USE_GROUP

View File

@ -919,6 +919,14 @@ void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf);
* @return pointer to the user data
*/
lv_obj_user_data_t * lv_obj_get_user_data(lv_obj_t * obj);
/**
* Set the object's user data. The data will be copied.
* @param obj pointer to an object
* @param data user data
*/
void lv_obj_set_user_data(lv_obj_t * obj, lv_obj_user_data_t data);
#endif
#if LV_USE_GROUP