⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 app.c

📁 this puzzle game using BREW this puzzle game using BREW this puzzle game using BREW this puzzle g
💻 C
字号:
//======================================================
//颇老:  App.c
//
//林力: 览侩橇肺弊伐 备炼眉 积己 窃荐 棺 荤侩磊 裹困 捞亥飘
//      贸府 窃荐 备泅  
//
//汲疙:
//   局敲复 备炼眉 积己矫 傈开 按眉甫 葛胆傅窍扁 困茄
//   览侩橇肺弊伐 备炼眉 积己 窃荐 棺 荤侩磊 裹困 捞亥飘
//   贸府 窃荐 备泅 
//
//累己磊:
//   2006.02. 冠蛮刮(eacs@paran.com)
//=======================================================

#include "std.h"
#include "App.h"
#include "menu_app.h"
#include "menu_sub.h"

#include "menu_app.bid"
#include "menu_sub.bid"

static boolean AppHandleEvent(menu_app *pMe, AEEEvent eCode,uint16 wParam, uint32 dwParam);
static boolean AppKeyHandleEvent(menu_app *pMe, uint16 vKey, uint32 bitFlags);

static boolean menu_sub_AppHandleEvent(menu_sub *pMe, AEEEvent eCode,uint16 wParam, uint32 dwParam);
static boolean menu_sub_AppKeyHandleEvent(menu_sub *pMe, uint16 vKey, uint32 bitFlags);

int AEEClsCreateInstance(AEECLSID ClsId, IShell *pIShell, IModule *po, void **ppObj)
{
	*ppObj = NULL;

	if(AEECLSID_MENU_APP == ClsId)
	{
		if(AEEApplet_New(sizeof(menu_app),ClsId,pIShell,po,(IApplet **)ppObj,
			(AEEHANDLER)AppHandleEvent,(PFNFREEAPPDATA)menu_app_Free))
		{
			if(menu_app_Init((menu_app *)*ppObj))
			{
				return(AEE_SUCCESS);
			}
			else
			{
				IAPPLET_Release((IApplet *)*ppObj);
				return(EFAILED);
			}
        }
    }
	else if(AEECLSID_MENU_SUB == ClsId)
	{
		if(AEEApplet_New(sizeof(menu_sub),ClsId,pIShell,po,(IApplet **)ppObj,
			(AEEHANDLER)menu_sub_AppHandleEvent,(PFNFREEAPPDATA)menu_sub_Free))
		{
			if(menu_sub_Init((menu_sub *)*ppObj))
			{
				return(AEE_SUCCESS);
			}
			else
			{
				IAPPLET_Release((IApplet *)*ppObj);
				return(EFAILED);
			}
        }
    }

	return(EFAILED);
}

static boolean AppHandleEvent(menu_app *pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{  
	int i = pMe->eventSize;

	if(eCode == EVT_KEY)
		return AppKeyHandleEvent(pMe, wParam, dwParam);

	do
	{
		--i;
		if(pMe->pEventEntry[i].eCode == eCode)
			return pMe->pEventEntry[i].pfnEventHandler((AEEApplet *)pMe, wParam, dwParam);
	}while(i);
	
   return FALSE;
}

static boolean AppKeyHandleEvent(menu_app *pMe, uint16 vKey, uint32 bitFlags)
{
	int i = pMe->keyEventSize;

	do
	{
		--i;
		if(pMe->pKeyEventEntry[i].vKey == vKey)
		{
			int ret;
			if(ret = menu_app_PreTranslateKey(&vKey, &bitFlags) == -1)
				return pMe->pKeyEventEntry[i].pfnKeyEventHandler((AEEApplet *)pMe);
			else
				return ret;
			
		}
	}while(i);

	return(FALSE);
}

static boolean menu_sub_AppHandleEvent(menu_sub *pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{  
	int i = pMe->eventSize;

	if(eCode == EVT_KEY)
		return menu_sub_AppKeyHandleEvent(pMe, wParam, dwParam);

	do
	{
		--i;
		if(pMe->pEventEntry[i].eCode == eCode)
			return pMe->pEventEntry[i].pfnEventHandler((AEEApplet *)pMe, wParam, dwParam);
	}while(i);
	
   return FALSE;
}

static boolean menu_sub_AppKeyHandleEvent(menu_sub *pMe, uint16 vKey, uint32 bitFlags)
{
	int i = pMe->keyEventSize;

	do
	{
		--i;
		if(pMe->pKeyEventEntry[i].vKey == vKey)
		{
			int ret;
			if(ret = menu_sub_PreTranslateKey(&vKey, &bitFlags) == -1)
				return pMe->pKeyEventEntry[i].pfnKeyEventHandler((AEEApplet *)pMe);
			else
				return ret;
			
		}
	}while(i);

	return(FALSE);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -