?? application.c
字號:
/*
* Application layer
*
*
* COPYRIGHT (c) 2001 - 2010.
* emTech System Corporation.
*
* The license and distribution terms for this file may be
* found in found in the file LICENSE.
*/
/* Huangf emcore@263.net
*/
#include "emGUI.h"
#include <stdlib.h>
#include <string.h>
static Chain_Control _ApplicationList;
void AppInitialization()
{
_Chain_Initialize_empty(
&_ApplicationList
);
}
Application *FirstApplication()
{
Application *first;
/* ApplicationEnter(); */
if (_Chain_Is_empty(&_ApplicationList)){
/* ApplicationLeave(); */
return NULL;
}
first = (Application *)_ApplicationList.first;
/* ApplicationLeave(); */
return first;
}
Application *CreateApplication(
void *appMain,
void *appProc,
unsigned32 *phCount
)
{
unsigned long msgQ = 0;
Application *app = 0;
unsigned long task = 0;
return NULL;
}
app = (struct Application *)malloc(sizeof(Application));
if (app == NULL){
return NULL;
}
memset(app, 0, sizeof(*app));
app->phCount = phCount;
app->appProc = appProc;
_Chain_Initialize_empty(
&app->WinList
);
msgQ = CreateMsgQ();
if (msgQ == 0){
goto failed;
}
app->msgQ = msgQ;
task = CreateAppTask(
app,
appMain
);
if (task == 0){
goto failed;
}
/* ApplicationEnter(); */
_Chain_Prepend_unprotected(
&_ApplicationList,
&app->node
);
/* ApplicationLeave(); */
PostAppMessage(
app,
APPCREATE,
0,
0
);
return app;
failed:
if (task){
SysDeleteTask(task);
}
if (app){
free(app);
}
if (msgQ){
SysDeleteMsgQ(msgQ);
}
return NULL;
}
void DestroyApplication(
Application *app
)
{
/* ApplicationEnter(); */
_Chain_Extract_unprotected(
&app->node
);
/* ApplicationLeave(); */
/* task is deleted automatically,
* we only delete messageQ for current application
*/
/* destroy message */
SysDeleteMsgQ(app->msgQ);
}
boolean SwitchApplication(
Application *newapp
)
{
/* ApplicationEnter(); */
if (_Chain_Is_empty(&_ApplicationList)){
/* ApplicationLeave(); */
return FALSE;
}
if ((Application *)_ApplicationList.first == newapp){
/* ApplicationLeave(); */
return TRUE;
}
_Chain_Extract_unprotected(
&newapp->node
);
_Chain_Prepend_unprotected(
&_ApplicationList,
&newapp->node
);
/* ApplicationLeave(); */
return TRUE;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -