lv_obj_event.h
Enums
Functions
-
lv_result_t lv_obj_send_event(lv_obj_t *obj, lv_event_code_t event_code, void *param)
Send an event to the object
- 参数:
obj -- pointer to an object
event_code -- the type of the event from
lv_event_t
param -- arbitrary data depending on the widget type and the event. (Usually
NULL
)
- 返回:
LV_RESULT_OK:
obj
was not deleted in the event; LV_RESULT_INVALID:obj
was deleted in the event_code
-
lv_result_t lv_obj_event_base(const lv_obj_class_t *class_p, lv_event_t *e)
Used by the widgets internally to call the ancestor widget types's event handler
- 参数:
class_p -- pointer to the class of the widget (NOT the ancestor class)
e -- pointer to the event descriptor
- 返回:
LV_RESULT_OK: the target object was not deleted in the event; LV_RESULT_INVALID: it was deleted in the event_code
-
lv_obj_t *lv_event_get_current_target_obj(lv_event_t *e)
Get the current target of the event. It's the object which event handler being called. If the event is not bubbled it's the same as "original" target.
- 参数:
e -- pointer to the event descriptor
- 返回:
the target of the event_code
-
lv_obj_t *lv_event_get_target_obj(lv_event_t *e)
Get the object originally targeted by the event. It's the same even if the event is bubbled.
- 参数:
e -- pointer to the event descriptor
- 返回:
pointer to the original target of the event_code
-
lv_event_dsc_t *lv_obj_add_event_cb(lv_obj_t *obj, lv_event_cb_t event_cb, lv_event_code_t filter, void *user_data)
Add an event handler function for an object. Used by the user to react on event which happens with the object. An object can have multiple event handler. They will be called in the same order as they were added.
- 参数:
obj -- pointer to an object
filter -- an event code (e.g.
LV_EVENT_CLICKED
) on which the event should be called.LV_EVENT_ALL
can be used to receive all the events.event_cb -- the new event function
user_data -- custom data will be available in
event_cb
- 返回:
handler to the event. It can be used in
lv_obj_remove_event_dsc
.
-
lv_event_dsc_t *lv_obj_get_event_dsc(lv_obj_t *obj, uint32_t index)
-
bool lv_obj_remove_event_cb(lv_obj_t *obj, lv_event_cb_t event_cb)
-
bool lv_obj_remove_event_dsc(lv_obj_t *obj, lv_event_dsc_t *dsc)
-
uint32_t lv_obj_remove_event_cb_with_user_data(lv_obj_t *obj, lv_event_cb_t event_cb, void *user_data)
Remove an event_cb with user_data
- 参数:
obj -- pointer to a obj
event_cb -- the event_cb of the event to remove
user_data -- user_data
- 返回:
the count of the event removed
-
lv_indev_t *lv_event_get_indev(lv_event_t *e)
Get the input device passed as parameter to indev related events.
- 参数:
e -- pointer to an event
- 返回:
the indev that triggered the event or NULL if called on a not indev related event
-
lv_layer_t *lv_event_get_layer(lv_event_t *e)
Get the draw context which should be the first parameter of the draw functions. Namely:
LV_EVENT_DRAW_MAIN/POST
,LV_EVENT_DRAW_MAIN/POST_BEGIN
,LV_EVENT_DRAW_MAIN/POST_END
- 参数:
e -- pointer to an event
- 返回:
pointer to a draw context or NULL if called on an unrelated event
-
const lv_area_t *lv_event_get_old_size(lv_event_t *e)
Get the old area of the object before its size was changed. Can be used in
LV_EVENT_SIZE_CHANGED
- 参数:
e -- pointer to an event
- 返回:
the old absolute area of the object or NULL if called on an unrelated event
-
uint32_t lv_event_get_key(lv_event_t *e)
Get the key passed as parameter to an event. Can be used in
LV_EVENT_KEY
- 参数:
e -- pointer to an event
- 返回:
the triggering key or NULL if called on an unrelated event
-
int32_t lv_event_get_rotary_diff(lv_event_t *e)
Get the signed rotary encoder diff. passed as parameter to an event. Can be used in
LV_EVENT_ROTARY
- 参数:
e -- pointer to an event
- 返回:
the triggering key or NULL if called on an unrelated event
-
lv_anim_t *lv_event_get_scroll_anim(lv_event_t *e)
Get the animation descriptor of a scrolling. Can be used in
LV_EVENT_SCROLL_BEGIN
- 参数:
e -- pointer to an event
- 返回:
the animation that will scroll the object. (can be modified as required)
-
void lv_event_set_ext_draw_size(lv_event_t *e, int32_t size)
Set the new extra draw size. Can be used in
LV_EVENT_REFR_EXT_DRAW_SIZE
- 参数:
e -- pointer to an event
size -- The new extra draw size
-
lv_point_t *lv_event_get_self_size_info(lv_event_t *e)
Get a pointer to an
lv_point_t
variable in which the self size should be saved (width inpoint->x
and heightpoint->y
). Can be used inLV_EVENT_GET_SELF_SIZE
- 参数:
e -- pointer to an event
- 返回:
pointer to
lv_point_t
or NULL if called on an unrelated event
-
lv_hit_test_info_t *lv_event_get_hit_test_info(lv_event_t *e)
Get a pointer to an
lv_hit_test_info_t
variable in which the hit test result should be saved. Can be used inLV_EVENT_HIT_TEST
- 参数:
e -- pointer to an event
- 返回:
pointer to
lv_hit_test_info_t
or NULL if called on an unrelated event
-
const lv_area_t *lv_event_get_cover_area(lv_event_t *e)
Get a pointer to an area which should be examined whether the object fully covers it or not. Can be used in
LV_EVENT_HIT_TEST
- 参数:
e -- pointer to an event
- 返回:
an area with absolute coordinates to check
-
void lv_event_set_cover_res(lv_event_t *e, lv_cover_res_t res)
Set the result of cover checking. Can be used in
LV_EVENT_COVER_CHECK
- 参数:
e -- pointer to an event
res -- an element of lv_cover_check_info_t
-
lv_draw_task_t *lv_event_get_draw_task(lv_event_t *e)
Get the draw task which was just added. Can be used in
LV_EVENT_DRAW_TASK_ADDED event
- 参数:
e -- pointer to an event
- 返回:
the added draw task