📄 guistyle_item_buttonlist.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 "rta_tsk.h"
#include "tmr.h"
#include "guiStyle.h"
#include "guiStyle_sub.h"
/* This item style requires a list field with two entries. List index 0 = undepressed.
* List index 1 = depressed */
int08 guiStyle_item_ButtonList_SetListIndex( int16 itemId, uint08 index )
{
int16 fieldId;
OSDFIELDTYPE fieldType;
uint08 listSize;
/* search thru the fields for all lists in the item */
fieldId = OSD_GetFirstFieldID( itemId );
if( fieldId == OSD_ERR_ID_INVALID )
return FAIL;
while( fieldId != OSD_ERR_ID_INVALID )
{
if( OSD_GetFieldType( fieldId, &fieldType ) != PASS )
return FAIL;
/* for all lists with 2 entries we find in the item, set 0 or 1 */
if( fieldType == LIST )
{
listSize = 0;
OSD_GetListSize( fieldId, &listSize );
if( listSize == 2 )
{
/* Set the index value */
if( index == 0 )
OSD_SetListIndex( fieldId, 0 ); /* undepressed */
else
OSD_SetListIndex( fieldId, 1 ); /* depressed */
}
}
fieldId = OSD_GetNextFieldID( fieldId );
}
return PASS;
}
int08 guiStyle_item_ButtonList_GuiMsg( GUI_OPEN_MENU *menu, GUIMSG *msg )
{
if( msg == NULL || menu == NULL )
return FAIL;
switch( msg->type )
{
case GUIMSG_LEFT:
case GUIMSG_DOWN:
case GUIMSG_RIGHT:
case GUIMSG_UP:
break;
case GUIMSG_SELECT:
guiStyle_item_SetListIndex( menu->itemId, 1 );
RTA_TaskDelay(TMR_ConvertMSToTicks( 500 ));
guiStyle_item_SetListIndex( menu->itemId, 0 );
msg->type = GUIMSG_ASSERT;
gui_AppAction_GuiMsg( menu->menuId, menu->itemId, msg );
break;
case GUIMSG_STRING:
case GUIMSG_VALUE:
// pass the message as is
gui_AppAction_GuiMsg( menu->menuId, menu->itemId, msg );
break;
default:
break;
}
return PASS;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -