📄 guistyle_item_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_item_lut.h"
/* private declaration */
int08 guiStyle_item_FindIndex( int16 itemId, uint16 *index );
/***************************************************************
* Item Style function pointer Lookup Table
*
* Add entries here when creating new item styles
***************************************************************/
const GUI_STYLE_ITEM_FUNCTIONLUT itemStyleLut[] =
{
/* styleId, GuiMsg, SetSingleValue, SetListIndex, SetTextString, Highlight, GrayOut */
{ MIST_ITEM_GENERIC_DISPLAYONLY, guiStyle_item_Generic_GuiMsg, 0, 0, 0, 0, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_STRING_DISPLAYONLY, guiStyle_item_Generic_GuiMsg, guiStyle_item_String_SetSingleValue, 0, guiStyle_item_String_SetTextString, 0, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_LIST_DISPLAYONLY, guiStyle_item_Generic_GuiMsg, 0, guiStyle_item_List_SetListIndex, 0, 0, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_SLIDERWITHTEXT_DISPLAYONLY, guiStyle_item_Generic_GuiMsg, guiStyle_item_SliderWithText_SetSingleValue, 0, 0, 0, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_GENERIC_NAVIGABLE, 0, 0, 0, 0, guiStyle_item_Generic_MenuWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_SLIDERWITHTEXT, guiStyle_item_SliderWithText_GuiMsg, guiStyle_item_SliderWithText_SetSingleValue, 0, 0, guiStyle_item_Generic_MenuWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_LIST, guiStyle_item_List_GuiMsg, 0, guiStyle_item_List_SetListIndex, 0, guiStyle_item_Generic_MenuWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_CHECKBOX, guiStyle_item_Checkbox_GuiMsg, 0, guiStyle_item_Checkbox_SetListIndex, 0, guiStyle_item_Generic_MenuWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_BUTTON_LIST, guiStyle_item_ButtonList_GuiMsg, 0, guiStyle_item_ButtonList_SetListIndex, 0, guiStyle_item_Generic_MenuWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_BUTTON_WIN, guiStyle_item_ButtonList_GuiMsg, 0, guiStyle_item_ButtonWin_SetListIndex, 0, guiStyle_item_Generic_ItemWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_RADIOSTART, guiStyle_item_Radio_GuiMsg, 0, guiStyle_item_Radio_SetListIndex, 0, guiStyle_item_Generic_MenuWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_RADIOMIDDLE, guiStyle_item_Radio_GuiMsg, 0, guiStyle_item_Radio_SetListIndex, 0, guiStyle_item_Generic_MenuWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_RADIOEND, guiStyle_item_Radio_GuiMsg, 0, guiStyle_item_Radio_SetListIndex, 0, guiStyle_item_Generic_MenuWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_STRING, guiStyle_item_Generic_GuiMsg, guiStyle_item_String_SetSingleValue, 0, guiStyle_item_String_SetTextString, guiStyle_item_Generic_MenuWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_GENERIC_NAVIGABLE_BUTTON, 0, 0, 0, 0, guiStyle_item_Generic_ItemWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_SLIDERWITHTEXT_BUTTON, guiStyle_item_SliderWithText_GuiMsg, guiStyle_item_SliderWithText_SetSingleValue, 0, 0, guiStyle_item_Generic_ItemWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_LIST_BUTTON, guiStyle_item_List_GuiMsg, 0, guiStyle_item_List_SetListIndex, 0, guiStyle_item_Generic_ItemWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_CHECKBOX_BUTTON, guiStyle_item_Checkbox_GuiMsg, 0, guiStyle_item_Checkbox_SetListIndex, 0, guiStyle_item_Generic_ItemWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_BUTTON_LIST_BUTTON, guiStyle_item_ButtonList_GuiMsg, 0, guiStyle_item_ButtonList_SetListIndex, 0, guiStyle_item_Generic_ItemWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_BUTTON_WIN_BUTTON, guiStyle_item_ButtonList_GuiMsg, 0, guiStyle_item_ButtonWin_SetListIndex, 0, guiStyle_item_Generic_ItemWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_RADIOSTART_BUTTON, guiStyle_item_Radio_GuiMsg, 0, guiStyle_item_Radio_SetListIndex, 0, guiStyle_item_Generic_ItemWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_RADIOMIDDLE_BUTTON, guiStyle_item_Radio_GuiMsg, 0, guiStyle_item_Radio_SetListIndex, 0, guiStyle_item_Generic_ItemWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_RADIOEND_BUTTON, guiStyle_item_Radio_GuiMsg, 0, guiStyle_item_Radio_SetListIndex, 0, guiStyle_item_Generic_ItemWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_STRING_BUTTON, guiStyle_item_Generic_GuiMsg, guiStyle_item_String_SetSingleValue, 0, guiStyle_item_String_SetTextString, guiStyle_item_Generic_ItemWindowHighlight, guiStyle_item_Generic_GrayOut },
{ MIST_ITEM_LAST, 0, 0, 0, 0 }
};
/***************************************************************
* The following functions implement the interface
* of the GUI Item Styles. These functions search the lookup
* table for a specified item style's functions. This decouples
* the GUI Item Styles from the GUI Action ADL.
*
* If the item style specified by the "itemId" parameter
* has an entry in the LUT, the item style's function will be called
***************************************************************/
int08 guiStyle_item_GuiMsg( GUI_OPEN_MENU *menu, GUIMSG *msg )
{
uint16 index;
/* Search for an entry for the item style */
if( guiStyle_item_FindIndex( menu->itemId, &index ) != PASS )
return FAIL;
/* Check if the item style entry has a GuiMsg function */
if( itemStyleLut[index].GuiMsg == NULL )
return FAIL;
/* Call the item style's GuiMsg function */
return itemStyleLut[index].GuiMsg( menu, msg );
}
int08 guiStyle_item_SetSingleValue( int16 itemId, int32 value, int32 min, int32 max )
{
uint16 index;
/* Search for an entry for the item style */
if( guiStyle_item_FindIndex( itemId, &index ) != PASS )
return FAIL;
/* Check if the item style entry has a SetSingleValue function */
if( itemStyleLut[index].SetSingleValue == NULL )
return FAIL;
/* Call the item style's SetSingleValue function */
return itemStyleLut[index].SetSingleValue( itemId, value, min, max );
}
int08 guiStyle_item_SetListIndex( int16 itemId, uint08 listIndex )
{
uint16 index;
/* Search for an entry for the item style */
if( guiStyle_item_FindIndex( itemId, &index ) != PASS )
return FAIL;
/* Check if the item style entry has a SetListIndex function */
if( itemStyleLut[index].SetListIndex == NULL )
return FAIL;
/* Call the item style's SetListIndex function */
return itemStyleLut[index].SetListIndex( itemId, listIndex );
}
int08 guiStyle_item_SetTextString( int16 itemId, uint08 *string )
{
uint16 index;
/* Search for an entry for the item style */
if( guiStyle_item_FindIndex( itemId, &index ) != PASS )
return FAIL;
/* Check if the item style entry has a SetTextString function */
if( itemStyleLut[index].SetTextString == NULL )
return FAIL;
/* Call the item style's SetTextString function */
return itemStyleLut[index].SetTextString( itemId, string );
}
int08 guiStyle_item_Highlight( int16 itemId, uint08 winNum, BOOL highlight )
{
uint16 index;
/* Search for an entry for the item style */
if( guiStyle_item_FindIndex( itemId, &index ) != PASS )
return FAIL;
/* Check if the item style entry has a SetTextString function */
if( itemStyleLut[index].Highlight == NULL )
return FAIL;
/* Call the item style's SetTextString function */
return itemStyleLut[index].Highlight( itemId, winNum, highlight );
}
int08 guiStyle_item_GrayOut( int16 itemId, BOOL gray )
{
uint16 index;
/* Search for an entry for the item style */
if( guiStyle_item_FindIndex( itemId, &index ) != PASS )
return FAIL;
/* Check if the item style entry has a SetTextString function */
if( itemStyleLut[index].GrayOut == NULL )
return FAIL;
/* Call the item style's SetTextString function */
return itemStyleLut[index].GrayOut( itemId, gray );
}
/* guiStyle_item_FindIndex searches the function LUT for a style entry */
int08 guiStyle_item_FindIndex( int16 itemId, uint16 *index )
{
uint16 i;
uint16 styleId;
if( OSD_GetItemStyle( itemId, &styleId ) == PASS )
{
for( i=0; i<0xFFFF; i++ )
{
if( itemStyleLut[i].styleId == MIST_ITEM_LAST )
return FAIL;
if( itemStyleLut[i].styleId == styleId )
{
*index = i;
return PASS;
}
}
}
return FAIL;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -