📄 screateevent.c
字号:
/**
* File Name : SCreateEvent.c
* Created : 07/04/16
* Author : ZhongNingLin@neusoft.com
* Model : 05YOP
* Description : [[CN]] 此文件的职责是: [[CN]]
**/
#include "SCreateEvent.h"
#include "aeestdlib.h"
extern boolean SEventContent_Insert(EventData *data, Schedule* pme);
extern ScheDB_AddEventItem( Schedule* pMe,EventData *data);
extern boolean ScheDB_UpdateEventItem( Schedule* pMe,EventData *data );
static void SC_setBrthTime(CreateEventWin* pme);
static void SC_setBrthAge(CreateEventWin* pme);
static void SC_setBrthName(CreateEventWin* pme);
static void SC_SaveBrthDay(CreateEventWin* pme);
static void SC_SaveTleNo(CreateEventWin* pme);
/**************************************************************************
* Function Name : CWeekWin_New
* Description : This function constructs weekly window.
* Input Parameters : Schedule*
* Output Parameters: None
* Return Value : IWindow *
* Date : 2007/04/11
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
IWindow* CCEventWin_New(Schedule * pOwner)
{
CreateEventWin* pme;
VTBL(IWindow) vtbl;
int fontHe;
SH_IWINDOW_SETVTBL(&vtbl, CCEventWin_Enable, CCEventWin_Redraw, CCEventWin_HandleEvent, CCEventWin_Delete);
pme = (CreateEventWin *)CWindow_New(sizeof(CreateEventWin), pOwner, &vtbl);
/*分配空间失败*/
if(NULL == pme)
{
return FALSE;
}
fontHe = IDISPLAY_GetFontMetrics( pme->m_pIDisplay,AEE_FONT_BOLD,NULL,NULL );
SETAEERECT(
&pme->rect, 0, fontHe + 20, //x,y
pme->m_pOwner->DeviceInfo.cxScreen,
pme->m_pOwner->DeviceInfo.cyScreen - (fontHe + 35)
);
pme->m_Obj = NULL;
/*返回窗体接口*/
return (IWindow *)pme;
}
/**************************************************************************
* Function Name : CCEventWin_InitData
* Description : 释放资源
* Input Parameters : IWindow*
* Output Parameters: None
* Return Value : None
* Date : 2007/04/12
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
void CCEventWin_InitData(CreateEventWin* pme)
{
/*创建的事件类型*/
switch(pme->m_pOwner->eventType)
{
/*通话*/
case IDS_EVTY_ANNIVER:
SCEvent_CreateTelphoneScreen(pme);
break;
/*生日*/
case IDS_EVTY_CANLEN:
SCEvent_CreatBrithScreen(pme, APP_BRITHDATY);
break;
/*备忘录*/
case IDS_EVTY_MEMO:
SCEvent_CreateMemoScreen(pme);
break;
default://case IDS_EVTY_OTHER:
break;
}
/*display the bottom command*/
SCEvent_DrawBottomScreen(pme);
}
/**************************************************************************
* Function Name : CWeekWin_Delete
* Description : 释放资源
* Input Parameters : IWindow*
* Output Parameters: None
* Return Value : None
* Date : 2007/04/12
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
void CCEventWin_Delete(IWindow * po)
{
CreateEventWin * pme = (CreateEventWin *)po;
/*Realese of control*/
ReleaseObj( &pme->m_Obj );
FREEIF( pme );
}
/**************************************************************************
* Function Name : CWeekWin_Enable
* Description : enable current window
* Input Parameters : IWindow * po, boolean bEnable
* Output Parameters: None
* Return Value : None
* Date : 2007/04/12
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
void CCEventWin_Enable(IWindow * po, boolean bEnable)
{
CreateEventWin * pme = (CreateEventWin *)po;
if (!CWindow_ProcessEnable(po, bEnable))
return;
/*判断当前窗口是否为激活状态*/
if (!pme->m_bActive)
{
return;
}
}
/**************************************************************************
* Function Name : CWeekWin_Redraw
* Description : This function redraws the menu window.
* Input Parameters : IWindow*
* Output Parameters: None
* Return Value : None
* Date : 2007/04/12
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
void CCEventWin_Redraw(IWindow * po)
{
CreateEventWin * pme = (CreateEventWin *)po;
if (!pme->m_bActive)
return;
IDISPLAY_ClearScreen(pme->m_pIDisplay);
CCEventWin_InitData(pme);
IDISPLAY_Update(pme->m_pIDisplay);
}
/**************************************************************************
* Function Name : SCEvent_CreateMemoScreen
* Description : 备忘录视图
* Input Parameters : CreateEventWin*
* Output Parameters: None
* Return Value : None
* Date : 2007/04/16
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
static boolean SCEvent_CreateTelphoneScreen(CreateEventWin* pme)
{
const AECHAR telNumber[] = { 0x7535, 0x8bdd, 0x53f7, 0x7801, 0xff1a, 0 }; //电话号码:
int fontHe = 0;
if( pme->m_Obj != NULL)
ReleaseObj(&pme->m_Obj);
if( (ISHELL_CreateInstance(pme->m_pIShell, AEECLSID_TEXTCTL, (void**)(&pme->m_Obj)) != SUCCESS ) )
return FALSE;
/*文字的高度*/
fontHe = IDISPLAY_GetFontMetrics( pme->m_pIDisplay,AEE_FONT_BOLD,NULL,NULL );
SETAEERECT(
&pme->rect, 0, pme->m_pOwner->DeviceInfo.cyScreen/2 - 20, //x,y
pme->m_pOwner->DeviceInfo.cxScreen,
20
);
/*文本控件重置(释放或删除)其内容,并立即离开激活/焦点模式*/
ITEXTCTL_Reset( (ITextCtl*)pme->m_Obj );
ITEXTCTL_SetProperties( (ITextCtl*)pme->m_Obj, TP_FRAME );
ITEXTCTL_SetText((ITextCtl*)pme->m_Obj,pme->digitalNumber,MAX_DIGT_SIZE);
ITEXTCTL_SetInputMode( (ITextCtl*)pme->m_Obj, AEE_TM_LETTERS );
ITEXTCTL_SetMaxSize( (ITextCtl*)pme->m_Obj, 11 );
ITEXTCTL_SetRect( (ITextCtl*)pme->m_Obj, &pme->rect );
/*激活文本控件*/
ITEXTCTL_SetActive( (ITextCtl*)pme->m_Obj,TRUE );
/*显示电话号码:*/
IDISPLAY_DrawText(pme->m_pIDisplay,AEE_FONT_NORMAL,telNumber,-1,0,20,NULL,IDF_TEXT_TRANSPARENT);
/*清空数字数组*/
//pme->digitalNumber[0] = '\0';
/*状态设置 通话*/
pme->appState = APP_TELPHON;
SH_DRAWHEADER(pme);
/*display the bottom command*/
SCEvent_DrawBottomScreen(pme);
return TRUE;
}
/**************************************************************************
* Function Name : SCEvent_CreateMemoScreen
* Description : 备忘录视图
* Input Parameters : CreateEventWin*
* Output Parameters: None
* Return Value : None
* Date : 2007/04/16
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
static boolean SCEvent_CreateMemoScreen(CreateEventWin* pme)
{
const AECHAR memoContent[] = { 0x5907, 0x5fd8, 0x5f55, 0x5185, 0x5bb9, 0xff1a,'\0' }; //备忘录内容:
const AECHAR memo[] = { 0x5907, 0x5fd8, 0x5f55, 0 }; //备忘录
//int fontHe = 0;
if( pme->m_Obj != NULL)
ReleaseObj(&pme->m_Obj);
if( (ISHELL_CreateInstance(pme->m_pIShell, AEECLSID_TEXTCTL, (void**)(&pme->m_Obj)) != SUCCESS ) )
return FALSE;
/*文本控件重置(释放或删除)其内容,并立即离开激活/焦点模式*/
ITEXTCTL_Reset( (ITextCtl*)pme->m_Obj );
ITEXTCTL_SetRect( (ITextCtl*)pme->m_Obj, &pme->rect );
ITEXTCTL_SetText( (ITextCtl*)pme->m_Obj,pme->memoContent ,-1 );
ITEXTCTL_SetProperties( (ITextCtl*)pme->m_Obj,TP_MULTILINE );
ITEXTCTL_SetInputMode( (ITextCtl*)pme->m_Obj, AEE_TM_PINYIN );
ITEXTCTL_SetMaxSize( (ITextCtl*)pme->m_Obj, MAX_DESC_SIZE );
/*激活文本控件*/
ITEXTCTL_SetActive( (ITextCtl*)pme->m_Obj,TRUE );
/*显示备忘录内容*/
IDISPLAY_DrawText(pme->m_pIDisplay,AEE_FONT_NORMAL,memoContent,-1,0,20,NULL,IDF_TEXT_TRANSPARENT);
/*状态设置*/
pme->appState = APP_MEMO;
SH_DRAWHEADER(pme);
/*display the bottom command*/
SCEvent_DrawBottomScreen(pme);
return TRUE;
}
/**************************************************************************
* Function Name : SCEvent_CreatBrithScreen
* Description : 生日
* Input Parameters : CreateEventWin*
* Output Parameters: None
* Return Value : None
* Date : 2007/04/16
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
static boolean SCEvent_CreatBrithScreen(CreateEventWin* pme ,AppState appS)
{
const AECHAR name[] = { 0x59d3, 0x540d, 0x3a, 0 }; //姓名:
int fontHe = 0;
if( pme->m_Obj != NULL)
ReleaseObj(&pme->m_Obj);
if( (ISHELL_CreateInstance(pme->m_pIShell, AEECLSID_TEXTCTL, (void**)(&pme->m_Obj)) != SUCCESS ) )
return FALSE;
fontHe = IDISPLAY_GetFontMetrics( pme->m_pIDisplay,AEE_FONT_NORMAL,NULL,NULL );
SETAEERECT(
&pme->rect, 0, fontHe + 20, //x,y
pme->m_pOwner->DeviceInfo.cxScreen,
fontHe + 10
);
/*文本控件重置(释放或删除)其内容,并立即离开激活/焦点模式*/
ITEXTCTL_Reset( (ITextCtl*)pme->m_Obj );
ITEXTCTL_SetRect( (ITextCtl*)pme->m_Obj, &pme->rect );
ITEXTCTL_SetText((ITextCtl*)pme->m_Obj,pme->name,MAX_BRTH_SIZE);
ITEXTCTL_SetProperties( (ITextCtl*)pme->m_Obj,TP_FRAME );
ITEXTCTL_SetInputMode( (ITextCtl*)pme->m_Obj, AEE_TM_ARABIC_R );
ITEXTCTL_SetMaxSize( (ITextCtl*)pme->m_Obj, MAX_BRTH_SIZE );
/*激活文本控件*/
ITEXTCTL_SetActive( (ITextCtl*)pme->m_Obj,TRUE );
/*显示备忘录内容*/
IDISPLAY_DrawText(pme->m_pIDisplay,AEE_FONT_NORMAL,name,-1,0,20,NULL,IDF_TEXT_TRANSPARENT);
/*状态设置*/
pme->appState = appS;
SH_DRAWHEADER(pme);
/*display the bottom command*/
SCEvent_DrawBottomScreen(pme);
return TRUE;
}
/**************************************************************************
* Function Name : SCEvent_DrawBottomScreen
* Description : 控制键
* Input Parameters : CreateEventWin*
* Output Parameters: None
* Return Value : None
* Date : 2007/04/16
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
static void SCEvent_DrawBottomScreen(CreateEventWin* pme)
{
AEERect rect;
int fontHe = 0;
int fontWi = 0;
const AECHAR option[] = { 0x786e, 0x8ba4, 0 }; //确认
const AECHAR back[] = { 0x8fd4, 0x56de, 0 }; //返回
/*文字的高度*/
fontHe = IDISPLAY_GetFontMetrics( pme->m_pIDisplay,AEE_FONT_NORMAL,NULL,NULL );
fontWi = IDISPLAY_MeasureText( pme->m_pIDisplay, AEE_FONT_NORMAL, back );
SETAEERECT( &rect, 0, pme->m_pOwner->DeviceInfo.cyScreen - fontHe, pme->m_pOwner->DeviceInfo.cxScreen,fontHe );
/*填充矩形的颜色*/
IDISPLAY_FillRect(pme->m_pIDisplay,&rect,RECT_BACKGROUND);
IDISPLAY_DrawText(pme->m_pIDisplay,AEE_FONT_NORMAL,option,-1,0,pme->m_pOwner->DeviceInfo.cyScreen - fontHe,NULL,IDF_TEXT_TRANSPARENT);
IDISPLAY_DrawText(pme->m_pIDisplay,AEE_FONT_NORMAL,back, -1,pme->m_pOwner->DeviceInfo.cxScreen - fontWi,pme->m_pOwner->DeviceInfo.cyScreen - fontHe,NULL,IDF_TEXT_TRANSPARENT);
}
/**************************************************************************
* Function Name : SCEvent_CreatArlamScreen
* Description : 选择闹钟
* Input Parameters : CreateEventWin*
* Output Parameters: None
* Return Value : None
* Date : 2007/04/13
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
static boolean SCEvent_CreatArlamScreen(CreateEventWin* pme, AppState appS)
{
const AECHAR arlam[] = { 0x95f9, 0x949f, 0x63d0, 0x793a, 0 }; //闹钟提示
int fontHe = 0;
int fontWi = 0;
if( pme->m_Obj != NULL)
ReleaseObj(&pme->m_Obj);
if( (ISHELL_CreateInstance(pme->m_pIShell, AEECLSID_MENUCTL, (void**)(&pme->m_Obj)) != SUCCESS ) )
return FALSE; //alarm clock
/*字体宽度*/
fontWi = IDISPLAY_MeasureText( pme->m_pIDisplay, AEE_FONT_NORMAL, arlam );
/*文字的高度*/
fontHe = IDISPLAY_GetFontMetrics( pme->m_pIDisplay,AEE_FONT_BOLD,NULL,NULL );
IDISPLAY_DrawText(pme->m_pIDisplay,AEE_FONT_NORMAL,arlam,-1,pme->m_pOwner->DeviceInfo.cxScreen/2 - fontWi /2,20,NULL,IDF_TEXT_TRANSPARENT);
SETAEERECT( &pme->rect, 0, fontHe + 20, pme->m_pOwner->DeviceInfo.cxScreen,pme->m_pOwner->DeviceInfo.cyScreen - (fontHe + 35) );
/*设置菜单外观属性*/
SH_SetMenuAttr(
(IMenuCtl *)pme->m_Obj,
AEECLSID_MENUCTL,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -