📄 menu.c
字号:
soundMenuClose(pMe);
IDISPLAY_Update(pMe->pIDisplay);
return TRUE;
break;
case Menu_Quit:
ISHELL_CloseApplet(pMe->pIShell,FALSE);
return TRUE;
case Menu_Opens:
if ( pMe->pIMenuCtl2 != NULL )
{
IMENUCTL_Release(pMe->pIMenuCtl2);
pMe->pIMenuCtl2 = NULL;
}
if (ISHELL_CreateInstance(pMe->pIShell,AEECLSID_MENUCTL,(void**)&pMe->pIMenuCtl2) != SUCCESS)
{
return FALSE;
}
IDISPLAY_ClearScreen(pMe->pIDisplay);
soundMenuOpen(pMe);
pMe->flag=TRUE;
IDISPLAY_Update(pMe->pIDisplay);
return TRUE;
case Menu_Open:
if ( pMe->pIMenuCtl2 != NULL )
{
IMENUCTL_Release(pMe->pIMenuCtl2);
pMe->pIMenuCtl2 = NULL;
}
if (ISHELL_CreateInstance(pMe->pIShell,AEECLSID_MENUCTL,(void**)&pMe->pIMenuCtl2) != SUCCESS)
{
return FALSE;
}
IDISPLAY_ClearScreen(pMe->pIDisplay);
soundMenuOpen(pMe);
pMe->flag=TRUE;
IDISPLAY_Update(pMe->pIDisplay);
return TRUE;
case Menu_Close:
if ( pMe->pIMenuCtl2 != NULL )
{
IMENUCTL_Release(pMe->pIMenuCtl2);
pMe->pIMenuCtl2 = NULL;
}
if (ISHELL_CreateInstance(pMe->pIShell,AEECLSID_MENUCTL,(void**)&pMe->pIMenuCtl2) != SUCCESS)
{
return FALSE;
}
IDISPLAY_ClearScreen(pMe->pIDisplay);
soundMenuClose(pMe);
pMe->flag=FALSE;
IDISPLAY_Update(pMe->pIDisplay);
return TRUE;
case Menu_Closes:
if ( pMe->pIMenuCtl2 != NULL )
{
IMENUCTL_Release(pMe->pIMenuCtl2);
pMe->pIMenuCtl2 = NULL;
}
if (ISHELL_CreateInstance(pMe->pIShell,AEECLSID_MENUCTL,(void**)&pMe->pIMenuCtl2) != SUCCESS)
{
return FALSE;
}
IDISPLAY_ClearScreen(pMe->pIDisplay);
soundMenuClose(pMe);
pMe->flag=FALSE;
IDISPLAY_Update(pMe->pIDisplay);
return TRUE;
case Menu_About:
IMENUCTL_SetActive(pMe->pIMenuCtl, FALSE);
IDISPLAY_ClearScreen(pMe->pIDisplay);
about(pMe);
IDISPLAY_Update(pMe->pIDisplay);
return TRUE;
break;
default:
break;
}
default:
break;
}
return FALSE;
}
// this function is called when your application is starting up
boolean menu_InitAppData(menu* pMe)
{
// Get the device information for this handset.
// Reference all the data by looking at the pMe->DeviceInfo structure
// Check the API reference guide for all the handy device info you can get
pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo);
ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&pMe->DeviceInfo);
// The display and shell interfaces are always created by
// default, so we'll asign them so that you can access
// them via the standard "pMe->" without the "a."
pMe->pIDisplay = pMe->a.m_pIDisplay;
pMe->pIShell = pMe->a.m_pIShell;
// Insert your code here for initializing or allocating resources...
pMe->rect.x=0;
pMe->rect.y=0;
pMe->rect.dx=pMe->DeviceInfo.cxScreen;
pMe->rect.dy=pMe->DeviceInfo.cyScreen;
pMe->rect2.x=0;
pMe->rect2.y=pMe->DeviceInfo.cyScreen-40;
pMe->rect2.dx=pMe->DeviceInfo.cxScreen;
pMe->rect2.dy=40;
pMe->flag=TRUE;
// if there have been no failures up to this point then return success
return TRUE;
}
// this function is called when your application is exiting
void menu_FreeAppData(menu* pMe)
{
// insert your code here for freeing any resources you have allocated...
// example to use for releasing each interface:
// if ( pMe->pIMenuCtl != NULL ) // check for NULL first
// {
// IMENUCTL_Release(pMe->pIMenuCtl) // release the interface
// pMe->pIMenuCtl = NULL; // set to NULL so no problems trying to free later
// }
//
if ( pMe->pIMenuCtl != NULL ) // check for NULL first
{
IMENUCTL_Release(pMe->pIMenuCtl); // release the interface
pMe->pIMenuCtl = NULL; // set to NULL so no problems trying to free later
}
if ( pMe->pIMenuCtl2 != NULL ) // check for NULL first
{
IMENUCTL_Release(pMe->pIMenuCtl2); // release the interface
pMe->pIMenuCtl2 = NULL; // set to NULL so no problems trying to free later
}
if ( pMe->pISoundPlayer!= NULL ) // check for NULL first
{
ISOUNDPLAYER_Stop(pMe->pISoundPlayer);
// ISOUNDPLAYER_RegisterNotify(pMe->pISoundPlayer,NULL,NULL);
ISOUNDPLAYER_Release(pMe->pISoundPlayer); // release the interface
pMe->pISoundPlayer = NULL; // set to NULL so no problems trying to free later
}
if ( pMe->pIMenuCtl3 != NULL ) // check for NULL first
{
IMENUCTL_Release(pMe->pIMenuCtl3); // release the interface
pMe->pIMenuCtl3 = NULL; // set to NULL so no problems trying to free later
}
}
void myMenu(menu* pMe)
{
AEEItemStyle ItemStyle1;
AEEItemStyle ItemStyle2;
ItemStyle1.ft=AEE_FT_3D_EMPTY;
ItemStyle1.xOffset=6;
ItemStyle1.yOffset=6;
ItemStyle1.roImage=AEE_RO_TRANSPARENT;
ItemStyle2.ft=AEE_FT_RAISED;
ItemStyle2.xOffset=6;
ItemStyle2.yOffset=6;
ItemStyle2.roImage=AEE_RO_TRANSPARENT;
IMENUCTL_SetStyle(pMe->pIMenuCtl,&ItemStyle1,&ItemStyle2);
pMe->ai.dwData=01;
pMe->ai.pszResImage=MENU_RES_FILE;
pMe->ai.pszResText=MENU_RES_FILE;
pMe->ai.wItemID=IMENU_START;
pMe->ai.wText=Menu_Start;
pMe->ai.wImage=Menu_1;
pMe->ai.pText=NULL;
pMe->ai.pImage=NULL;
IMENUCTL_AddItemEx(pMe->pIMenuCtl,&pMe->ai);
pMe->ai.dwData=02;
pMe->ai.pszResImage=MENU_RES_FILE;
pMe->ai.pszResText=MENU_RES_FILE;
pMe->ai.wItemID=IMENU_CONFIG;
pMe->ai.wText=Menu_Config;
pMe->ai.wImage=Menu_2;
pMe->ai.pText=NULL;
pMe->ai.pImage=NULL;
IMENUCTL_AddItemEx(pMe->pIMenuCtl,&pMe->ai);
/*
pMe->ai.dwData=03;
pMe->ai.pszResImage=MENU_RES_FILE;
pMe->ai.pszResText=MENU_RES_FILE;
pMe->ai.wItemID=IMENU_HELP;
pMe->ai.wText=Menu_Help;
pMe->ai.wImage=Menu_3;
pMe->ai.pText=NULL;
pMe->ai.pImage=NULL;
IMENUCTL_AddItemEx(pMe->pIMenuCtl,&pMe->ai);
*/
pMe->ai.dwData=04;
pMe->ai.pszResImage=MENU_RES_FILE;
pMe->ai.pszResText=MENU_RES_FILE;
pMe->ai.wItemID=IMENU_ABOUT;
pMe->ai.wText=Menu_About;
pMe->ai.wImage=Menu_3;
pMe->ai.pText=NULL;
pMe->ai.pImage=NULL;
IMENUCTL_AddItemEx(pMe->pIMenuCtl,&pMe->ai);
pMe->ai.dwData=05;
pMe->ai.pszResImage=MENU_RES_FILE;
pMe->ai.pszResText=MENU_RES_FILE;
pMe->ai.wItemID=IMENU_QUIT;
pMe->ai.wText=Menu_Quit;
pMe->ai.wImage=Menu_4;
pMe->ai.pText=NULL;
pMe->ai.pImage=NULL;
IMENUCTL_AddItemEx(pMe->pIMenuCtl,&pMe->ai);
IMENUCTL_SetTitle(pMe->pIMenuCtl, MENU_RES_FILE, IMENU_TITLE, NULL);
IMENUCTL_EnableCommand(pMe->pIMenuCtl,TRUE);
IMENUCTL_SetRect(pMe->pIMenuCtl, &pMe->rect);
// IMENUCTL_SetProperties(pMe->pIMenuCtl,MP_MAXSOFTKEYITEMS);
IMENUCTL_SetActive(pMe->pIMenuCtl, TRUE);
}
void soundMenuOpen(menu* pMe)
{
IMENUCTL_AddItem(pMe->pIMenuCtl2,MENU_RES_FILE,IMENU_OPENS,Menu_Opens,NULL,23);
IMENUCTL_AddItem(pMe->pIMenuCtl2,MENU_RES_FILE,IMENU_CLOSE,Menu_Close,NULL,22);
// IMENUCTL_SetTitle(pMe->pIMenuCtl, MENU_RES_FILE, IMENU_TITLE, NULL);
IMENUCTL_EnableCommand(pMe->pIMenuCtl2,TRUE);
IMENUCTL_SetRect(pMe->pIMenuCtl2, &pMe->rect);
IMENUCTL_SetActive(pMe->pIMenuCtl2, TRUE);
}
void soundMenuClose(menu* pMe)
{
IMENUCTL_AddItem(pMe->pIMenuCtl2,MENU_RES_FILE,IMENU_OPEN,Menu_Open,NULL,21);
IMENUCTL_AddItem(pMe->pIMenuCtl2,MENU_RES_FILE,IMENU_CLOSES,Menu_Closes,NULL,24);
// IMENUCTL_SetTitle(pMe->pIMenuCtl, MENU_RES_FILE, IMENU_TITLE, NULL);
IMENUCTL_EnableCommand(pMe->pIMenuCtl2,TRUE);
IMENUCTL_SetRect(pMe->pIMenuCtl2, &pMe->rect);
IMENUCTL_SetActive(pMe->pIMenuCtl2, TRUE);
}
void sound(menu *pMe)
{
ISHELL_CreateInstance(pMe->pIShell,AEECLSID_SOUNDPLAYER,(void **)&pMe->pISoundPlayer);
// ISOUNDPLAYER_RegisterNotify(pMe->pISoundPlayer,NULL,NULL);
pMe->SoundInfo.eInput=SDT_FILE;
pMe->SoundInfo.pData="yue.mp3";
if(ISOUNDPLAYER_SetInfo(pMe->pISoundPlayer,&pMe->SoundInfo)==SUCCESS)
{
ISOUNDPLAYER_Play(pMe->pISoundPlayer);
IDISPLAY_ClearScreen(pMe->pIDisplay);
IDISPLAY_Update(pMe->pIDisplay);
}
}
void about(menu *pMe)
{
ISHELL_GetResSize(pMe->pIShell,MENU_RES_FILE,IMENU_A,RESTYPE_STRING,&pMe->resSize);
pMe->pBuffer=(AECHAR*)MALLOC(pMe->resSize);
ISHELL_LoadResString(pMe->pIShell,MENU_RES_FILE,IMENU_A,pMe->pBuffer,pMe->resSize);
IDISPLAY_SetColor(pMe->pIDisplay,CLR_USER_TEXT,MAKE_RGB(0,0,0));
IDISPLAY_SetColor(pMe->pIDisplay,CLR_USER_BACKGROUND,MAKE_RGB(255,255,255));
IDISPLAY_DrawText(pMe->pIDisplay,AEE_FONT_NORMAL,pMe->pBuffer,-1,30,60,NULL,IDF_ALIGN_FILL|IDF_ALIGN_CENTER);
IDISPLAY_Update(pMe->pIDisplay);
FREE(pMe->pBuffer);
}
/*
void iconviewctl(menu *pMe)
{
pMe->ai2.dwData=61;
pMe->ai2.pszResImage=MENU_RES_FILE;
pMe->ai.pszResText=MENU_RES_FILE;
pMe->ai2.wItemID=IMENU_CHANGE;
pMe->ai2.wText=Menu_Change;
pMe->ai2.wImage=Menu_1;
pMe->ai2.pText=NULL;
pMe->ai2.pImage=NULL;
IMENUCTL_AddItemEx(pMe->pIMenuCtl3,&pMe->ai2);
pMe->ai2.dwData=62;
pMe->ai2.pszResImage=MENU_RES_FILE;
pMe->ai.pszResText=MENU_RES_FILE;
pMe->ai2.wItemID=IMENU_EXIT;
pMe->ai2.wText=Menu_Exit;
pMe->ai2.wImage=Menu_2;
pMe->ai2.pText=NULL;
pMe->ai2.pImage=NULL;
IMENUCTL_AddItemEx(pMe->pIMenuCtl3,&pMe->ai2);
// IMENUCTL_EnableCommand(pMe->pIMenuCtl3,TRUE);
IMENUCTL_SetRect(pMe->pIMenuCtl3, &pMe->rect2);
IMENUCTL_SetActive(pMe->pIMenuCtl3, TRUE);
}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -