lv_menu.h

Enums

enum lv_menu_mode_header_t

Values:

enumerator LV_MENU_HEADER_TOP_FIXED

Header is positioned at the top

enumerator LV_MENU_HEADER_TOP_UNFIXED

Header is positioned at the top and can be scrolled out of view

enumerator LV_MENU_HEADER_BOTTOM_FIXED

Header is positioned at the bottom

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

参数:

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

返回:

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

参数:
  • parent -- pointer to menu object

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

返回:

pointer to the created menu page

lv_obj_t *lv_menu_cont_create(lv_obj_t *parent)

Create a menu cont object

参数:

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

返回:

pointer to the created menu cont

lv_obj_t *lv_menu_section_create(lv_obj_t *parent)

Create a menu section object

参数:

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

返回:

pointer to the created menu section

lv_obj_t *lv_menu_separator_create(lv_obj_t *parent)

Create a menu separator object

参数:

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

返回:

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

参数:
  • 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

参数:
  • 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.

参数:
  • 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

参数:
  • 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

参数:
  • 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

参数:
  • 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

参数:
  • 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

参数:

obj -- pointer to the menu

返回:

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

参数:

obj -- pointer to the menu

返回:

pointer to current page

lv_obj_t *lv_menu_get_main_header(lv_obj_t *obj)

Get a pointer to main header obj

参数:

obj -- pointer to the menu

返回:

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

参数:

obj -- pointer to the menu

返回:

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

参数:

obj -- pointer to the menu

返回:

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

参数:

obj -- pointer to the menu

返回:

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

参数:
  • menu -- pointer to the menu

  • obj -- pointer to the back button

返回:

true if it is a root back btn

void lv_menu_clear_history(lv_obj_t *obj)

Clear menu history

参数:

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