lv_menu.h

Typedefs

typedef _lv_menu_mode_header_t lv_menu_mode_header_t
typedef _lv_menu_mode_root_back_button_t lv_menu_mode_root_back_button_t

Enums

enum _lv_menu_mode_header_t

Values:

enumerator LV_MENU_HEADER_TOP_FIXED
enumerator LV_MENU_HEADER_TOP_UNFIXED
enumerator LV_MENU_HEADER_BOTTOM_FIXED
enum _lv_menu_mode_root_back_button_t

Values:

enumerator LV_MENU_ROOT_BACK_BUTTON_DISABLED
enumerator LV_MENU_ROOT_BACK_BUTTON_ENABLED

Functions

lv_obj_t *lv_menu_create(lv_obj_t *parent)

Create a menu object

Parameters:

parent -- pointer to an object, it will be the parent of the new menu

Returns:

pointer to the created menu

lv_obj_t *lv_menu_page_create(lv_obj_t *parent, char const *const title)

Create a menu page object

Parameters:
  • parent -- pointer to menu object

  • title -- pointer to text for title in header (NULL to not display title)

Returns:

pointer to the created menu page

lv_obj_t *lv_menu_cont_create(lv_obj_t *parent)

Create a menu cont object

Parameters:

parent -- pointer to an object, it will be the parent of the new menu cont object

Returns:

pointer to the created menu cont

lv_obj_t *lv_menu_section_create(lv_obj_t *parent)

Create a menu section object

Parameters:

parent -- pointer to an object, it will be the parent of the new menu section object

Returns:

pointer to the created menu section

lv_obj_t *lv_menu_separator_create(lv_obj_t *parent)

Create a menu separator object

Parameters:

parent -- pointer to an object, it will be the parent of the new menu separator object

Returns:

pointer to the created menu separator

void lv_menu_set_page(lv_obj_t *obj, lv_obj_t *page)

Set menu page to display in main

Parameters:
  • obj -- pointer to the menu

  • page -- pointer to the menu page to set (NULL to clear main and clear menu history)

void lv_menu_set_page_title(lv_obj_t *page, char const *const title)

Set menu page title

Parameters:
  • page -- pointer to the menu page

  • title -- pointer to text for title in header (NULL to not display title)

void lv_menu_set_page_title_static(lv_obj_t *page, char const *const title)

Set menu page title with a static text. It will not be saved by the label so the 'text' variable has to be 'alive' while the page exists.

Parameters:
  • page -- pointer to the menu page

  • title -- pointer to text for title in header (NULL to not display title)

void lv_menu_set_sidebar_page(lv_obj_t *obj, lv_obj_t *page)

Set menu page to display in sidebar

Parameters:
  • obj -- pointer to the menu

  • page -- pointer to the menu page to set (NULL to clear sidebar)

void lv_menu_set_mode_header(lv_obj_t *obj, lv_menu_mode_header_t mode)

Set the how the header should behave and its position

Parameters:
  • obj -- pointer to a menu

  • mode -- LV_MENU_HEADER_TOP_FIXED/TOP_UNFIXED/BOTTOM_FIXED

void lv_menu_set_mode_root_back_button(lv_obj_t *obj, lv_menu_mode_root_back_button_t mode)

Set whether back button should appear at root

Parameters:
  • obj -- pointer to a menu

  • mode -- LV_MENU_ROOT_BACK_BUTTON_DISABLED/ENABLED

void lv_menu_set_load_page_event(lv_obj_t *menu, lv_obj_t *obj, lv_obj_t *page)

Add menu to the menu item

Parameters:
  • menu -- pointer to the menu

  • obj -- pointer to the obj

  • page -- pointer to the page to load when obj is clicked

lv_obj_t *lv_menu_get_cur_main_page(lv_obj_t *obj)

Get a pointer to menu page that is currently displayed in main

Parameters:

obj -- pointer to the menu

Returns:

pointer to current page

lv_obj_t *lv_menu_get_cur_sidebar_page(lv_obj_t *obj)

Get a pointer to menu page that is currently displayed in sidebar

Parameters:

obj -- pointer to the menu

Returns:

pointer to current page

lv_obj_t *lv_menu_get_main_header(lv_obj_t *obj)

Get a pointer to main header obj

Parameters:

obj -- pointer to the menu

Returns:

pointer to main header obj

lv_obj_t *lv_menu_get_main_header_back_button(lv_obj_t *obj)

Get a pointer to main header back btn obj

Parameters:

obj -- pointer to the menu

Returns:

pointer to main header back btn obj

lv_obj_t *lv_menu_get_sidebar_header(lv_obj_t *obj)

Get a pointer to sidebar header obj

Parameters:

obj -- pointer to the menu

Returns:

pointer to sidebar header obj

lv_obj_t *lv_menu_get_sidebar_header_back_button(lv_obj_t *obj)

Get a pointer to sidebar header obj

Parameters:

obj -- pointer to the menu

Returns:

pointer to sidebar header back btn obj

bool lv_menu_back_button_is_root(lv_obj_t *menu, lv_obj_t *obj)

Check if an obj is a root back btn

Parameters:
  • menu -- pointer to the menu

  • obj -- pointer to the back button

Returns:

true if it is a root back btn

void lv_menu_clear_history(lv_obj_t *obj)

Clear menu history

Parameters:

obj -- pointer to the menu

Variables

const lv_obj_class_t lv_menu_class
const lv_obj_class_t lv_menu_page_class
const lv_obj_class_t lv_menu_cont_class
const lv_obj_class_t lv_menu_section_class
const lv_obj_class_t lv_menu_separator_class
const lv_obj_class_t lv_menu_sidebar_cont_class
const lv_obj_class_t lv_menu_main_cont_class
const lv_obj_class_t lv_menu_sidebar_header_cont_class
const lv_obj_class_t lv_menu_main_header_cont_class
struct lv_menu_load_page_event_data_t

Public Members

lv_obj_t *menu
lv_obj_t *page
struct lv_menu_history_t

Public Members

lv_obj_t *page
struct lv_menu_t

Public Members

lv_obj_t obj
lv_obj_t *storage
lv_obj_t *main
lv_obj_t *main_page
lv_obj_t *main_header
lv_obj_t *main_header_back_btn
lv_obj_t *main_header_title
lv_obj_t *sidebar
lv_obj_t *sidebar_page
lv_obj_t *sidebar_header
lv_obj_t *sidebar_header_back_btn
lv_obj_t *sidebar_header_title
lv_obj_t *selected_tab
lv_ll_t history_ll
uint8_t cur_depth
uint8_t prev_depth
uint8_t sidebar_generated
lv_menu_mode_header_t mode_header
lv_menu_mode_root_back_button_t mode_root_back_btn
struct lv_menu_page_t

Public Members

lv_obj_t obj
char *title
bool static_title