/**
 *******************************************************************************
 * @file  menu_page.h
 * @brief This file contains all the functions prototypes of the menu page.
 @verbatim
   Change Logs:
   Date             Author          Notes
   2022-06-30       CDT             First version
 @endverbatim
 *******************************************************************************
 * Copyright (C) 2022-2023, Xiaohua Semiconductor Co., Ltd. All rights reserved.
 *
 * This software component is licensed by XHSC under BSD 3-Clause license
 * (the "License"); You may not use this file except in compliance with the
 * License. You may obtain a copy of the License at:
 *                    opensource.org/licenses/BSD-3-Clause
 *
 *******************************************************************************
 */

#ifndef __MENU_PAGE_H__
#define __MENU_PAGE_H__

/* C binding of definitions if building with C++ compiler */
#ifdef __cplusplus
extern "C"
{
#endif

/*******************************************************************************
 * Include files
 ******************************************************************************/
#include "console_common.h"
#include "menu_list.h"

/**
 * @addtogroup Menu_Page
 * @{
 */

/*******************************************************************************
 * Global type definitions ('typedef')
 ******************************************************************************/
/**
 * @defgroup Menu_Page_Global_Types Menu Page Global Types
 * @{
 */

/**
 * @brief Menu page information structure definition
 */
typedef struct {
    const char  *pcTitle;
    const char  *pcBorderTop;
    const char  *pcBorderBottom;
    const char  *pcListSeparatorLine;

    const char  *pcDisplayFormatTitle;
    const char  *pcDisplayFormatBorderTop;
    const char  *pcDisplayFormatBorderBottom;
    const char  *pcDisplayFormatListSeparatorLine;
} stc_menu_page_attr_t;

/**
 * @brief Menu page structure definition
 */
typedef struct {
    stc_slist_t                 stcPageNode;
    stc_slist_t                 stcListRoot;
    const stc_menu_page_attr_t  *pstcPageAttr;
} stc_menu_page_t;

/**
 * @}
 */

/*******************************************************************************
 * Global pre-processor symbols/macros ('#define')
 ******************************************************************************/

/*******************************************************************************
 * Global variable definitions ('extern')
 ******************************************************************************/

/*******************************************************************************
  Global function prototypes (definition in C source)
 ******************************************************************************/

/**
 * @addtogroup Menu_Page_Global_Functions
 * @{
 */
stc_menu_page_t *Menu_Page_Create(const stc_menu_page_attr_t *pstcPageAttr);
void Menu_Page_Destroy(stc_menu_page_t *pstcPage);
stc_menu_page_t *Menu_Page_FindPage(const char *pcPageTitle);
stc_menu_list_t *Menu_Page_FindList(stc_menu_page_t *pstcPage, const char *pcListName);
int32_t Menu_Page_InsertList(stc_menu_page_t *pstcPage, stc_menu_list_t *pstcList);
void Menu_Page_ShowAttr(stc_menu_page_t *pstcPage, int32_t (*pfnItemShow)(stc_menu_item_t *));
/**
 * @}
 */

/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#endif /* __MENU_PAGE_H__ */

/*******************************************************************************
 * EOF (not truncated)
 ******************************************************************************/
