lv_event.h

Typedefs

typedef void (*lv_event_cb_t)(lv_event_t *e)

Enums

enum lv_event_code_t

Type of event being sent to Widget

Values:

enumerator LV_EVENT_ALL
enumerator LV_EVENT_PRESSED

Input device events Widget has been pressed

enumerator LV_EVENT_PRESSING

Widget is being pressed (sent continuously while pressing)

enumerator LV_EVENT_PRESS_LOST

Widget is still being pressed but slid cursor/finger off Widget

enumerator LV_EVENT_SHORT_CLICKED

Widget was pressed for a short period of time, then released. Not sent if scrolled.

enumerator LV_EVENT_SINGLE_CLICKED

Sent for first short click within a small distance and short time

enumerator LV_EVENT_DOUBLE_CLICKED

Sent for second short click within small distance and short time

enumerator LV_EVENT_TRIPLE_CLICKED

Sent for third short click within small distance and short time

enumerator LV_EVENT_LONG_PRESSED

Object has been pressed for at least long_press_time. Not sent if scrolled.

enumerator LV_EVENT_LONG_PRESSED_REPEAT

Sent after long_press_time in every long_press_repeat_time ms. Not sent if scrolled.

enumerator LV_EVENT_CLICKED

Sent on release if not scrolled (regardless to long press)

enumerator LV_EVENT_RELEASED

Sent in every cases when Widget has been released

enumerator LV_EVENT_SCROLL_BEGIN

Scrolling begins. The event parameter is a pointer to the animation of the scroll. Can be modified

enumerator LV_EVENT_SCROLL_THROW_BEGIN
enumerator LV_EVENT_SCROLL_END

Scrolling ends

enumerator LV_EVENT_SCROLL

Scrolling

enumerator LV_EVENT_GESTURE

A gesture is detected. Get gesture with lv_indev_get_gesture_dir(lv_indev_active());

enumerator LV_EVENT_KEY

A key is sent to Widget. Get key with lv_indev_get_key(lv_indev_active());

enumerator LV_EVENT_ROTARY

An encoder or wheel was rotated. Get rotation count with lv_event_get_rotary_diff(e);

enumerator LV_EVENT_FOCUSED

Widget received focus

enumerator LV_EVENT_DEFOCUSED

Widget's focus has been lost

enumerator LV_EVENT_LEAVE

Widget's focus has been lost but is still selected

enumerator LV_EVENT_HIT_TEST

Perform advanced hit-testing

enumerator LV_EVENT_INDEV_RESET

Indev has been reset

enumerator LV_EVENT_HOVER_OVER

Indev hover over object

enumerator LV_EVENT_HOVER_LEAVE

Indev hover leave object

enumerator LV_EVENT_COVER_CHECK

Drawing events Check if Widget fully covers an area. The event parameter is lv_cover_check_info_t *.

enumerator LV_EVENT_REFR_EXT_DRAW_SIZE

Get required extra draw area around Widget (e.g. for shadow). The event parameter is int32_t * to store the size.

enumerator LV_EVENT_DRAW_MAIN_BEGIN

Starting the main drawing phase

enumerator LV_EVENT_DRAW_MAIN

Perform the main drawing

enumerator LV_EVENT_DRAW_MAIN_END

Finishing the main drawing phase

enumerator LV_EVENT_DRAW_POST_BEGIN

Starting the post draw phase (when all children are drawn)

enumerator LV_EVENT_DRAW_POST

Perform the post draw phase (when all children are drawn)

enumerator LV_EVENT_DRAW_POST_END

Finishing the post draw phase (when all children are drawn)

enumerator LV_EVENT_DRAW_TASK_ADDED

Adding a draw task

enumerator LV_EVENT_VALUE_CHANGED

Special events Widget's value has changed (i.e. slider moved)

enumerator LV_EVENT_INSERT

Text has been inserted into Widget. The event data is char * being inserted.

enumerator LV_EVENT_REFRESH

Notify Widget to refresh something on it (for user)

enumerator LV_EVENT_READY

A process has finished

enumerator LV_EVENT_CANCEL

A process has been cancelled

enumerator LV_EVENT_CREATE

Other events Object is being created

enumerator LV_EVENT_DELETE

Object is being deleted

enumerator LV_EVENT_CHILD_CHANGED

Child was removed, added, or its size, position were changed

enumerator LV_EVENT_CHILD_CREATED

Child was created, always bubbles up to all parents

enumerator LV_EVENT_CHILD_DELETED

Child was deleted, always bubbles up to all parents

enumerator LV_EVENT_SCREEN_UNLOAD_START

A screen unload started, fired immediately when scr_load is called

enumerator LV_EVENT_SCREEN_LOAD_START

A screen load started, fired when the screen change delay is expired

enumerator LV_EVENT_SCREEN_LOADED

A screen was loaded

enumerator LV_EVENT_SCREEN_UNLOADED

A screen was unloaded

enumerator LV_EVENT_SIZE_CHANGED

Object coordinates/size have changed

enumerator LV_EVENT_STYLE_CHANGED

Object's style has changed

enumerator LV_EVENT_LAYOUT_CHANGED

A child's position position has changed due to a layout recalculation

enumerator LV_EVENT_GET_SELF_SIZE

Get internal size of a widget

enumerator LV_EVENT_INVALIDATE_AREA

Events of optional LVGL components

enumerator LV_EVENT_RESOLUTION_CHANGED
enumerator LV_EVENT_COLOR_FORMAT_CHANGED
enumerator LV_EVENT_REFR_REQUEST
enumerator LV_EVENT_REFR_START
enumerator LV_EVENT_REFR_READY
enumerator LV_EVENT_RENDER_START
enumerator LV_EVENT_RENDER_READY
enumerator LV_EVENT_FLUSH_START
enumerator LV_EVENT_FLUSH_FINISH
enumerator LV_EVENT_FLUSH_WAIT_START
enumerator LV_EVENT_FLUSH_WAIT_FINISH
enumerator LV_EVENT_VSYNC
enumerator LV_EVENT_LAST
enumerator LV_EVENT_PREPROCESS

Number of default events

enumerator LV_EVENT_MARKED_DELETING

This is a flag that can be set with an event so it's processed before the class default event processing

Functions

lv_result_t lv_event_send(lv_event_list_t *list, lv_event_t *e, bool preprocess)

Event callback. Events are used to notify the user of some action being taken on Widget. For details, see ::lv_event_t.

lv_event_dsc_t *lv_event_add(lv_event_list_t *list, lv_event_cb_t cb, lv_event_code_t filter, void *user_data)
bool lv_event_remove_dsc(lv_event_list_t *list, lv_event_dsc_t *dsc)
uint32_t lv_event_get_count(lv_event_list_t *list)
lv_event_dsc_t *lv_event_get_dsc(lv_event_list_t *list, uint32_t index)
lv_event_cb_t lv_event_dsc_get_cb(lv_event_dsc_t *dsc)
void *lv_event_dsc_get_user_data(lv_event_dsc_t *dsc)
bool lv_event_remove(lv_event_list_t *list, uint32_t index)
void lv_event_remove_all(lv_event_list_t *list)
void *lv_event_get_target(lv_event_t *e)

Get Widget originally targeted by the event. It's the same even if event was bubbled.

Parameters:

e – pointer to the event descriptor

Returns:

the target of the event_code

void *lv_event_get_current_target(lv_event_t *e)

Get current target of the event. It's the Widget for which the event handler being called. If the event is not bubbled it's the same as "normal" target.

Parameters:

e – pointer to the event descriptor

Returns:

pointer to the current target of the event_code

lv_event_code_t lv_event_get_code(lv_event_t *e)

Get event code of an event.

Parameters:

e – pointer to the event descriptor

Returns:

the event code. (E.g. LV_EVENT_CLICKED, LV_EVENT_FOCUSED, etc)

void *lv_event_get_param(lv_event_t *e)

Get parameter passed when event was sent.

Parameters:

e – pointer to the event descriptor

Returns:

pointer to the parameter

void *lv_event_get_user_data(lv_event_t *e)

Get user_data passed when event was registered on Widget.

Parameters:

e – pointer to the event descriptor

Returns:

pointer to the user_data

void lv_event_stop_bubbling(lv_event_t *e)

Stop event from bubbling. This is only valid when called in the middle of an event processing chain.

Parameters:

e – pointer to the event descriptor

void lv_event_stop_processing(lv_event_t *e)

Stop processing this event. This is only valid when called in the middle of an event processing chain.

Parameters:

e – pointer to the event descriptor

uint32_t lv_event_register_id(void)

Register a new, custom event ID. It can be used the same way as e.g. LV_EVENT_CLICKED

to send custom events

Example:

uint32_t LV_EVENT_MINE = 0;
...
e = lv_event_register_id();
...
lv_obj_send_event(obj, LV_EVENT_MINE, &some_data);

Returns:

the new event id

const char *lv_event_code_get_name(lv_event_code_t code)

Get the name of an event code.

Parameters:

code – the event code

Returns:

the name of the event code as a string

struct lv_event_list_t

Public Members

lv_array_t array
uint8_t is_traversing

True: the list is being nested traversed

uint8_t has_marked_deleting

True: the list has marked deleting objects when some of events are marked as deleting