lv_group.h

Typedefs

typedef void (*lv_group_focus_cb_t)(lv_group_t*)
typedef void (*lv_group_edge_cb_t)(lv_group_t*, bool)

Enums

enum lv_key_t

Predefined keys to control which Widget has focus via lv_group_send(group, c)

Values:

enumerator LV_KEY_UP
enumerator LV_KEY_DOWN
enumerator LV_KEY_RIGHT
enumerator LV_KEY_LEFT
enumerator LV_KEY_ESC
enumerator LV_KEY_DEL
enumerator LV_KEY_BACKSPACE
enumerator LV_KEY_ENTER
enumerator LV_KEY_NEXT
enumerator LV_KEY_PREV
enumerator LV_KEY_HOME
enumerator LV_KEY_END
enum lv_group_refocus_policy_t

Values:

enumerator LV_GROUP_REFOCUS_POLICY_NEXT
enumerator LV_GROUP_REFOCUS_POLICY_PREV

Functions

lv_group_t *lv_group_create(void)

Create new Widget group.

Returns:

pointer to the new Widget group

void lv_group_delete(lv_group_t *group)

Delete group object.

Parameters:

group – pointer to a group

void lv_group_set_default(lv_group_t *group)

Set default group. New Widgets will be added to this group if it's enabled in their class with add_to_def_group = true.

Parameters:

group – pointer to a group (can be NULL)

lv_group_t *lv_group_get_default(void)

Get default group.

Returns:

pointer to the default group

void lv_group_add_obj(lv_group_t *group, lv_obj_t *obj)

Add an Widget to group.

Parameters:
  • group – pointer to a group

  • obj – pointer to a Widget to add

void lv_group_swap_obj(lv_obj_t *obj1, lv_obj_t *obj2)

Swap 2 Widgets in group. Widgets must be in the same group.

Parameters:
  • obj1 – pointer to a Widget

  • obj2 – pointer to another Widget

void lv_group_remove_obj(lv_obj_t *obj)

Remove a Widget from its group.

Parameters:

obj – pointer to Widget to remove

void lv_group_remove_all_objs(lv_group_t *group)

Remove all Widgets from a group.

Parameters:

group – pointer to a group

void lv_group_focus_obj(lv_obj_t *obj)

Focus on a Widget (defocus the current).

Parameters:

obj – pointer to Widget to focus on

void lv_group_focus_next(lv_group_t *group)

Focus on next Widget in a group (defocus the current).

Parameters:

group – pointer to a group

void lv_group_focus_prev(lv_group_t *group)

Focus on previous Widget in a group (defocus the current).

Parameters:

group – pointer to a group

void lv_group_focus_freeze(lv_group_t *group, bool en)

Do not allow changing focus from current Widget.

Parameters:
  • group – pointer to a group

  • en – true: freeze, false: release freezing (normal mode)

lv_result_t lv_group_send_data(lv_group_t *group, uint32_t c)

Send a control character to Widget that has focus in a group.

Parameters:
  • group – pointer to a group

  • c – a character (use LV_KEY_.. to navigate)

Returns:

result of Widget with focus in group.

void lv_group_set_focus_cb(lv_group_t *group, lv_group_focus_cb_t focus_cb)

Set a function for a group which will be called when a new Widget has focus.

Parameters:
  • group – pointer to a group

  • focus_cb – the call back function or NULL if unused

void lv_group_set_edge_cb(lv_group_t *group, lv_group_edge_cb_t edge_cb)

Set a function for a group which will be called when a focus edge is reached

Parameters:
  • group – pointer to a group

  • edge_cb – the call back function or NULL if unused

void lv_group_set_refocus_policy(lv_group_t *group, lv_group_refocus_policy_t policy)

Set whether the next or previous Widget in a group gets focus when Widget that has focus is deleted.

Parameters:
  • group – pointer to a group

  • policy – new refocus policy enum

void lv_group_set_editing(lv_group_t *group, bool edit)

Manually set the current mode (edit or navigate).

Parameters:
  • group – pointer to group

  • edit – true: edit mode; false: navigate mode

void lv_group_set_wrap(lv_group_t *group, bool en)

Set whether moving focus to next/previous Widget will allow wrapping from first->last or last->first Widget.

Parameters:
  • group – pointer to group

  • en – true: wrapping enabled; false: wrapping disabled

lv_obj_t *lv_group_get_focused(const lv_group_t *group)

Get Widget that has focus, or NULL if there isn't one.

Parameters:

group – pointer to a group

Returns:

pointer to Widget with focus

lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t *group)

Get focus callback function of a group.

Parameters:

group – pointer to a group

Returns:

the call back function or NULL if not set

lv_group_edge_cb_t lv_group_get_edge_cb(const lv_group_t *group)

Get edge callback function of a group.

Parameters:

group – pointer to a group

Returns:

the call back function or NULL if not set

bool lv_group_get_editing(const lv_group_t *group)

Get current mode (edit or navigate).

Parameters:

group – pointer to group

Returns:

true: edit mode; false: navigate mode

bool lv_group_get_wrap(lv_group_t *group)

Get whether moving focus to next/previous Widget will allow wrapping from first->last or last->first Widget.

Parameters:

group – pointer to group

uint32_t lv_group_get_obj_count(lv_group_t *group)

Get number of Widgets in group.

Parameters:

group – pointer to a group

Returns:

number of Widgets in the group

lv_obj_t *lv_group_get_obj_by_index(lv_group_t *group, uint32_t index)

Get nth Widget within group.

Parameters:
  • group – pointer to a group

  • index – index of Widget within the group

Returns:

pointer to Widget

uint32_t lv_group_get_count(void)

Get the number of groups.

Returns:

number of groups

lv_group_t *lv_group_by_index(uint32_t index)

Get a group by its index.

Parameters:

index – index of the group

Returns:

pointer to the group