📄 guistyle_menu_lut.c
字号:
/*****************************************************************************
** TEXAS INSTRUMENTS PROPRIETARY INFORMATION
**
** (c) Copyright, Texas Instruments Incorporated, 2006.
** All Rights Reserved.
**
** Property of Texas Instruments Incorporated. Restricted Rights -
** Use, duplication, or disclosure is subject to restrictions set
** forth in TI's program license agreement and associated documentation.
******************************************************************************/
#include "common.h"
#include "osd.h"
#include "guiStyle.h"
#include "guiStyle_menu_lut.h"
/* private declaration */
int08 guiStyle_menu_FindIndex( GUI_OPEN_MENU *menu, uint16 *index );
/***************************************************************
* Menu Style function pointer Lookup Table
*
* Add entries here when creating new menu styles
***************************************************************/
const GUI_STYLE_MENU_FUNCTIONLUT menuStyleLut[] =
{
/* styleId, OnStart, OnClose, GuiMsg, Redraw, HideItem GrayOutItem */
{ MIST_MENU_GENERIC, guiStyle_menu_Generic_OnStart, guiStyle_menu_Generic_OnClose, guiStyle_menu_Generic_GuiMsg, guiStyle_menu_Generic_Redraw, 0,0 },
{ MIST_MENU_HORIZONTAL_MAIN, guiStyle_menu_HorizontalMain_OnStart, guiStyle_menu_HorizontalMain_OnClose, guiStyle_menu_HorizontalMain_GuiMsg, guiStyle_menu_HorizontalMain_Redraw, guiStyle_menu_HorizontalMain_HideItem, 0 },
{ MIST_MENU_HORIZONTAL_CHILD, guiStyle_menu_HorizontalChild_OnStart, guiStyle_menu_HorizontalChild_OnClose, guiStyle_menu_HorizontalChild_GuiMsg, guiStyle_menu_HorizontalChild_Redraw, guiStyle_menu_HorizontalChild_HideItem, 0 },
{ MIST_MENU_HORIZONTAL_CHILD_GRAYEDOUTITEMS, guiStyle_menu_HorizontalChild_OnStart, guiStyle_menu_HorizontalChild_OnClose, guiStyle_menu_HorizontalChild_GuiMsg, guiStyle_menu_HorizontalChild_Redraw, guiStyle_menu_HorizontalChild_HideItemGrayOut, 0 },
{ MIST_MENU_HORIZONTAL_GENERIC, guiStyle_menu_HorizontalGeneric_OnStart, guiStyle_menu_HorizontalGeneric_OnClose, guiStyle_menu_HorizontalGeneric_GuiMsg, guiStyle_menu_HorizontalGeneric_Redraw, guiStyle_menu_HorizontalGeneric_HideItem, 0 },
{ MIST_MENU_HORIZONTAL_GENERIC_GRAYEDOUTITEMS, guiStyle_menu_HorizontalGeneric_OnStart, guiStyle_menu_HorizontalGeneric_OnClose, guiStyle_menu_HorizontalGeneric_GuiMsg, guiStyle_menu_HorizontalGeneric_Redraw, guiStyle_menu_HorizontalGeneric_HideItemGrayOut, 0 },
{ MIST_MENU_VERTICAL_MAIN, guiStyle_menu_VerticalMain_OnStart, guiStyle_menu_Generic_OnClose, guiStyle_menu_VerticalMain_GuiMsg, guiStyle_menu_VerticalMain_Redraw, guiStyle_menu_VerticalMain_HideItem, 0 },
{ MIST_MENU_VERTICAL_CHILD, guiStyle_menu_VerticalChild_OnStart, guiStyle_menu_VerticalChild_OnClose, guiStyle_menu_VerticalChild_GuiMsg, guiStyle_menu_VerticalChild_Redraw, guiStyle_menu_VerticalChild_HideItem, guiStyle_menu_VerticalChild_GrayOutItem },
{ MIST_MENU_VERTICAL_CHILD_GRAYEDOUTITEMS, guiStyle_menu_VerticalChild_OnStart, guiStyle_menu_VerticalChild_OnClose, guiStyle_menu_VerticalChild_GuiMsg, guiStyle_menu_VerticalChild_Redraw, guiStyle_menu_VerticalChild_GrayOutItem, 0 },
{ MIST_MENU_VERTICAL_GENERIC, guiStyle_menu_VerticalGeneric_OnStart, guiStyle_menu_VerticalGeneric_OnClose, guiStyle_menu_VerticalGeneric_GuiMsg, guiStyle_menu_VerticalGeneric_Redraw, guiStyle_menu_VerticalGeneric_HideItem, 0 },
{ MIST_MENU_VERTICAL_GENERIC_GRAYEDOUTITEMS, guiStyle_menu_VerticalGeneric_OnStart, guiStyle_menu_VerticalGeneric_OnClose, guiStyle_menu_VerticalGeneric_GuiMsg, guiStyle_menu_VerticalGeneric_Redraw, guiStyle_menu_VerticalGeneric_HideItemGrayOut, 0 },
{ MIST_MENU_LAST, 0, 0, 0, 0, 0 }
};
/***************************************************************
* The following functions implement the interface
* for the GUI Menu Styles. These functions search the lookup
* table for a specified menu style's functions. This decouples
* the GUI Menu Styles from the GUI Action ADL and the
* GUI Message Pump.
*
* If the menu style specified by the "GUI_OPEN_MENU *menu" parameter
* has an entry in the LUT, the menu style's function will be called
***************************************************************/
int08 guiStyle_menu_OnStart( GUI_OPEN_MENU *menu, GUIMSG *msg )
{
uint16 index;
/* Search for an entry for the menu style */
if( guiStyle_menu_FindIndex( menu, &index ) != PASS )
return FAIL;
/* Check if the menu style entry has an OnStart function */
if( menuStyleLut[index].OnStart == NULL )
return FAIL;
/* Call the menu style's OnStart function */
return menuStyleLut[index].OnStart( menu, msg );
}
int08 guiStyle_menu_OnClose( GUI_OPEN_MENU *menu )
{
uint16 index;
/* Search for an entry for the menu style */
if( guiStyle_menu_FindIndex( menu, &index ) != PASS )
return FAIL;
/* Check if the menu style entry has an OnClose function */
if( menuStyleLut[index].OnClose == NULL )
return FAIL;
/* Call the menu style's OnClose function */
return menuStyleLut[index].OnClose( menu );
}
int08 guiStyle_menu_GuiMsg( GUI_OPEN_MENU *menu, GUIMSG *msg )
{
uint16 index;
/* Search for an entry for the menu style */
if( guiStyle_menu_FindIndex( menu, &index ) != PASS )
return FAIL;
/* Check if the menu style entry has a GuiMsg function */
if( menuStyleLut[index].GuiMsg == NULL )
return FAIL;
/* Call the menu style's GuiMsg function */
return menuStyleLut[index].GuiMsg( menu, msg );
}
int08 guiStyle_menu_Redraw( GUI_OPEN_MENU *menu )
{
uint16 index;
/* Search for an entry for the menu style */
if( guiStyle_menu_FindIndex( menu, &index ) != PASS )
return FAIL;
/* Check if the menu style entry has an Redraw function */
if( menuStyleLut[index].Redraw == NULL )
return FAIL;
/* Call the menu style's Redraw function */
return menuStyleLut[index].Redraw( menu );
}
int08 guiStyle_menu_HideItem( GUI_OPEN_MENU *menu, int16 itemId, BOOL hide )
{
uint16 index;
/* Search for an entry for the menu style */
if( guiStyle_menu_FindIndex( menu, &index ) != PASS )
return FAIL;
/* Check if the menu style entry has a HideItem function */
if( menuStyleLut[index].HideItem == NULL )
return FAIL;
/* Call the menu style's HideItem function */
return menuStyleLut[index].HideItem( menu, itemId, hide );
}
int08 guiStyle_menu_GrayOutItem( GUI_OPEN_MENU *menu, int16 itemId, BOOL disable )
{
uint16 index;
/* Search for an entry for the menu style */
if( guiStyle_menu_FindIndex( menu, &index ) != PASS )
return FAIL;
/* Check if the menu style entry has a GrayOutItem function */
if( menuStyleLut[index].GrayOutItem == NULL )
return FAIL;
/* Call the menu style's HideItem function */
return menuStyleLut[index].GrayOutItem( menu, itemId, disable );
}
/* guiStyle_menu_FindIndex searches the function LUT for a menu style entry */
int08 guiStyle_menu_FindIndex( GUI_OPEN_MENU *menu, uint16 *index )
{
uint16 i;
uint16 styleId;
if( OSD_GetMenuStyle( menu->menuId, &styleId ) == PASS )
{
for( i=0; i<0xFFFF; i++ )
{
if( menuStyleLut[i].styleId == MIST_MENU_LAST )
return FAIL;
if( menuStyleLut[i].styleId == styleId )
{
*index = i;
return PASS;
}
}
}
return FAIL;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -