mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-23 15:56:59 +08:00
fix(obj) Add missing getter and setter for user_data (#2221)
* fix(obj) Add missing getter and setter for user_data This is needed for Micropython bindings, which stores a reference to the Python object which wraps the LVGL object. * Added comments to lv_obj_[get/set]_user_data
This commit is contained in:
@@ -263,6 +263,18 @@ void lv_obj_clear_state(lv_obj_t * obj, lv_state_t state);
|
||||
*/
|
||||
void lv_obj_set_base_dir(lv_obj_t * obj, lv_bidi_dir_t dir);
|
||||
|
||||
/**
|
||||
* Set the user_data field of the object
|
||||
* @param obj pointer to an object
|
||||
* @param user_data pointer to the new user_data.
|
||||
*/
|
||||
#if LV_USE_USER_DATA
|
||||
static inline void lv_obj_set_user_data(lv_obj_t * obj, void * user_data)
|
||||
{
|
||||
obj->user_data = user_data;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*=======================
|
||||
* Getter functions
|
||||
*======================*/
|
||||
@@ -313,6 +325,18 @@ bool lv_obj_has_state(const lv_obj_t * obj, lv_state_t state);
|
||||
*/
|
||||
void * lv_obj_get_group(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the user_data field of the object
|
||||
* @param obj pointer to an object
|
||||
* @return the pointer to the user_data of the object
|
||||
*/
|
||||
#if LV_USE_USER_DATA
|
||||
static inline void * lv_obj_get_user_data(lv_obj_t * obj)
|
||||
{
|
||||
return obj->user_data;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*=======================
|
||||
* Other functions
|
||||
*======================*/
|
||||
|
||||
Reference in New Issue
Block a user