?? widgettest.c
字號:
/*===========================================================================
FILE: WidgetTest.c
===========================================================================*/
/*===============================================================================
INCLUDES AND VARIABLE DEFINITIONS
=============================================================================== */
#include "AEEModGen.h" // Module interface definitions
#include "AEEAppGen.h" // Applet interface definitions
#include "AEEShell.h" // Shell interface definitions
#include "AEEForm.h"
#include "AEERootForm.h"
#include "AppForm.h"
//define applet structure
typedef struct _WidgetTestApp {
AEEApplet a;
IRootForm* rootForm;
IForm* mainForm;
IDisplay* piDisplay;
} WidgetTestApp;
/*-------------------------------------------------------------------
Function Prototypes
-------------------------------------------------------------------*/
static boolean WidgetTest_HandleEvent(IApplet * pi, AEEEvent eCode,
uint16 wParam, uint32 dwParam);
static int WidgetTest_InitAppData(WidgetTestApp* pMe);
static void WidgetTest_FreeAppData(WidgetTestApp* pMe);
/*===============================================================================
FUNCTION DEFINITIONS
=============================================================================== */
int AEEClsCreateInstance(AEECLSID ClsId,IShell * pIShell,IModule * po,void ** ppObj)
{
WidgetTestApp* pMe=NULL;
*ppObj = NULL;
if(!AEEApplet_New(sizeof(WidgetTestApp), ClsId, pIShell,po,(IApplet**)ppObj,
(AEEHANDLER)WidgetTest_HandleEvent, (PFNFREEAPPDATA) WidgetTest_FreeAppData))
return ENOMEMORY;
pMe = (WidgetTestApp*) *ppObj;
if(WidgetTest_InitAppData(pMe) != 0)
return EFAILED;
return AEE_SUCCESS;
}
/* Initialize applet data*/
int WidgetTest_InitAppData(WidgetTestApp* pMe) {
int result = 0;
pMe->mainForm = NULL;
//create rootForm
result = ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_ROOTFORM, (void**) &pMe->rootForm);
//set the theme
// if(result == 0)
// result = IROOTFORM_SetThemeFileName(pMe->rootForm, "theme.bar");
if(result==0)
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_DISPLAY, (void**) &pMe->piDisplay);
return result;
}
// Free app data
static void WidgetTest_FreeAppData(WidgetTestApp* pMe) {
if(pMe->rootForm) {
IROOTFORM_Release(pMe->rootForm);
pMe->rootForm = NULL;
}
if(pMe->mainForm) {
IFORM_Release(pMe->mainForm);
pMe->mainForm = NULL;
}
if(pMe->piDisplay) {
IDISPLAY_Release(pMe->piDisplay);
pMe->piDisplay = NULL;
}
}
// App handle event
static boolean WidgetTest_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
int result=0;
WidgetTestApp* pMe = (WidgetTestApp*) pi;
// Allow rootform to handle event first
if(IROOTFORM_HandleEvent(pMe->rootForm, eCode, wParam, dwParam)) {
return TRUE;
}
switch(eCode) {
case EVT_APP_START:
// create main app form and push it onto the stack
if(AppForm_New(&pMe->mainForm, pMe->a.m_pIShell, pMe->rootForm, pMe->piDisplay) == 0) {
IROOTFORM_PushForm(pMe->rootForm, pMe->mainForm);
return TRUE;
}
break;
case EVT_APP_STOP:
return TRUE;
default:
break;
}
return FALSE;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -