lv_group.h
Typedefs
-
typedef void (*lv_group_focus_cb_t)(struct _lv_group_t*)
-
typedef void (*lv_group_edge_cb_t)(struct _lv_group_t*, bool)
-
typedef struct _lv_group_t lv_group_t
Groups can be used to logically hold objects so that they can be individually focused. They are NOT for laying out objects on a screen (try layouts for that).
Enums
-
enum _lv_key_t
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
-
enumerator LV_KEY_UP
Functions
-
void _lv_group_init(void)
Init. the group module
Remark
Internal function, do not call directly.
-
lv_group_t *lv_group_create(void)
Create a new object group
- Returns:
pointer to the new object group
-
void lv_group_delete(lv_group_t *group)
Delete a group object
- Parameters:
group -- pointer to a group
-
void lv_group_set_default(lv_group_t *group)
Set a default group. New object are 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 the default group
- Returns:
pointer to the default group
-
void lv_group_add_obj(lv_group_t *group, struct _lv_obj_t *obj)
Add an object to a group
- Parameters:
group -- pointer to a group
obj -- pointer to an object to add
-
void lv_group_swap_obj(struct _lv_obj_t *obj1, struct _lv_obj_t *obj2)
Swap 2 object in a group. The object must be in the same group
- Parameters:
obj1 -- pointer to an object
obj2 -- pointer to an other object
-
void lv_group_remove_obj(struct _lv_obj_t *obj)
Remove an object from its group
- Parameters:
obj -- pointer to an object to remove
-
void lv_group_remove_all_objs(lv_group_t *group)
Remove all objects from a group
- Parameters:
group -- pointer to a group
-
void lv_group_focus_obj(struct _lv_obj_t *obj)
Focus on an object (defocus the current)
- Parameters:
obj -- pointer to an object to focus on
-
void lv_group_focus_next(lv_group_t *group)
Focus the next object in a group (defocus the current)
- Parameters:
group -- pointer to a group
-
void lv_group_focus_prev(lv_group_t *group)
Focus the previous object 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 let to change the focus from the current object
- 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 the focuses object of a group
- Parameters:
group -- pointer to a group
c -- a character (use LV_KEY_.. to navigate)
- Returns:
result of focused object 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 object is focused
- 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 item in a group is focused if the currently focused obj 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 focus next/prev will allow wrapping from first->last or last->first object.
- Parameters:
group -- pointer to group
en -- true: wrapping enabled; false: wrapping disabled
-
struct _lv_obj_t *lv_group_get_focused(const lv_group_t *group)
Get the focused object or NULL if there isn't one
- Parameters:
group -- pointer to a group
- Returns:
pointer to the focused object
-
lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t *group)
Get the 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 the 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 the 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 focus next/prev will allow wrapping from first->last or last->first object.
- Parameters:
group -- pointer to group
en -- true: wrapping enabled; false: wrapping disabled
-
uint32_t lv_group_get_obj_count(lv_group_t *group)
Get the number of object in the group
- Parameters:
group -- pointer to a group
- Returns:
number of objects in the group
-
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
- Returns:
pointer to the group
-
struct _lv_group_t
- #include <lv_group.h>
Groups can be used to logically hold objects so that they can be individually focused. They are NOT for laying out objects on a screen (try layouts for that).
Public Members
-
lv_group_focus_cb_t focus_cb
A function to call when a new object is focused (optional)
-
lv_group_edge_cb_t edge_cb
A function to call when an edge is reached, no more focus targets are available in this direction (to allow edge feedback like a sound or a scroll bounce)
-
void *user_data
-
uint8_t frozen
1: can't focus to new object
-
uint8_t editing
1: Edit mode, 0: Navigate mode
-
uint8_t refocus_policy
1: Focus prev if focused on deletion. 0: Focus next if focused on deletion.
-
uint8_t wrap
1: Focus next/prev can wrap at end of list. 0: Focus next/prev stops at end of list.
-
lv_group_focus_cb_t focus_cb