lv_obj_event.h
Enums
Functions
-
lv_result_t lv_obj_send_event(struct _lv_obj_t *obj, lv_event_code_t event_code, void *param)
Send an event to the object
- Parameters:
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
)
- Returns:
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 struct _lv_obj_class_t *class_p, lv_event_t *e)
Used by the widgets internally to call the ancestor widget types's event handler
- Parameters:
class_p -- pointer to the class of the widget (NOT the ancestor class)
e -- pointer to the event descriptor
- Returns:
LV_RESULT_OK: the target object was not deleted in the event; LV_RESULT_INVALID: it was deleted in the event_code
-
struct _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.
- Parameters:
e -- pointer to the event descriptor
- Returns:
the target of the event_code
-
struct _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.
- Parameters:
e -- pointer to the event descriptor
- Returns:
pointer to the original target of the event_code
-
void lv_obj_add_event(struct _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.
- Parameters:
obj -- pointer to an object
filter -- and event code (e.g.
LV_EVENT_CLICKED
) on which the event should be called.LV_EVENT_ALL
can be sued the receive all the events.event_cb -- the new event function
user_data -- custom data data will be available in
event_cb
-
lv_event_dsc_t *lv_obj_get_event_dsc(struct _lv_obj_t *obj, uint32_t index)
-
bool lv_obj_remove_event_cb(struct _lv_obj_t *obj, lv_event_cb_t event_cb)
-
lv_indev_t *lv_event_get_indev(lv_event_t *e)
Get the input device passed as parameter to indev related events.
- Parameters:
e -- pointer to an event
- Returns:
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
- Parameters:
e -- pointer to an event
- Returns:
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
- Parameters:
e -- pointer to an event
- Returns:
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
- Parameters:
e -- pointer to an event
- Returns:
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
- Parameters:
e -- pointer to an event
- Returns:
the animation that will scroll the object. (can be modified as required)
-
void lv_event_set_ext_draw_size(lv_event_t *e, lv_coord_t size)
Set the new extra draw size. Can be used in
LV_EVENT_REFR_EXT_DRAW_SIZE
- Parameters:
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
- Parameters:
e -- pointer to an event
- Returns:
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
- Parameters:
e -- pointer to an event
- Returns:
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
- Parameters:
e -- pointer to an event
- Returns:
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
- Parameters:
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
- Parameters:
e -- pointer to an event
- Returns:
the added draw task
-
struct lv_hit_test_info_t
- #include <lv_obj_event.h>
Used as the event parameter of LV_EVENT_HIT_TEST to check if an
point
can click the object or not.res
should be set like this:If already set to
false
an other event wants that point non clickable. If you want to respect it leave it asfalse
or settrue
to overwrite it.If already set
true
andpoint
shouldn't be clickable set tofalse
If already set to
true
you agree thatpoint
can click the object leave it astrue
Public Members
-
const lv_point_t *point
A point relative to screen to check if it can click the object or not
-
bool res
true:
point
can click the object; false: it cannot
-
struct lv_cover_check_info_t
- #include <lv_obj_event.h>
Used as the event parameter of LV_EVENT_COVER_CHECK to check if an area is covered by the object or not. In the event use
const lv_area_t * area = lv_event_get_cover_area(e)
to get the area to check andlv_event_set_cover_res(e, res)
to set the result.