📄 sselectday.c
字号:
/**
* File Name : SselectDay.c
* Created : 07/04/18
* Author : ZhongNingLin@neusoft.com
* Model : 05YOP
* Description : [[CN]] 此文件的职责是: [[CN]]
**/
#include "SselectDay.h"
/**************************************************************************
* Function Name : CSelectDWin_New
* Description : This function constructs showEvent window.
* Input Parameters : Schedule*
* Output Parameters: None
* Return Value : IWindow *
* Date : 2007/04/18
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
IWindow * CSelectDWin_New(Schedule * pOwner)
{
SelectDWin * pme;
VTBL(IWindow) vtbl;
SH_IWINDOW_SETVTBL(
&vtbl, CSelectDWin_Enable, CSelectDWin_Redraw,
CSelectDWin_HandleEvent, CSelectDWin_Delete
);
pme = (SelectDWin *)CWindow_New(sizeof(SelectDWin), pOwner, &vtbl);
if(NULL == pme)
{
return FALSE;
}
/*初始时间控件*/
if((ISHELL_CreateInstance
(
pme->m_pIShell,
AEECLSID_DATECTL,
(void**)(&pme->m_pDateCtl)
) != SUCCESS)
)
return FALSE;
/*初始化矩形变量*/
SETAEERECT( &pme->rect, pOwner->m_width/4 - 5,
pOwner->m_height / 2 - 10,
pOwner->m_width, 30
);
/*初始化事件菜单状态*/
//pme->m_mState = APP_MENU_MAIN;
/*返回窗体接口*/
return (IWindow *)pme;
}
/**************************************************************************
* Function Name : CSelectDWin_Delete
* Description : 释放窗体资源.
* Input Parameters : Schedule*
* Output Parameters: None
* Return Value : None
* Date : 2007/04/18
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
void CSelectDWin_Delete(IWindow * po)
{
SelectDWin * pme = (SelectDWin *)po;
ReleaseObj((void**)&pme->m_pDateCtl);
FREEIF(pme);
}
/**************************************************************************
* Function Name : CSelectDWin_Enable
* Description : 释放窗体资源.
* Input Parameters : Schedule*
* Output Parameters: None
* Return Value : None
* Date : 2007/04/18
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
void CSelectDWin_Enable(IWindow * po, boolean bEnable)
{
SelectDWin * pme = (SelectDWin *)po;
if (!CWindow_ProcessEnable(po, bEnable))
return;
/*判断当前窗口是否为激活状态*/
if (!pme->m_bActive)
{
return;
}
}
/**************************************************************************
* Function Name : CExamineEventWin_Redraw
* Description : This function redraws the events window.
* Input Parameters : IWindow*
* Output Parameters: None
* Return Value : None
* Date : 2007/04/18
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
void CSelectDWin_Redraw(IWindow * po)
{
SelectDWin * pme = (SelectDWin *)po;
if (!pme->m_bActive)
return;
IDISPLAY_ClearScreen(pme->m_pIDisplay);
SH_DRAWHEADER(pme);
CSelectDWin_InitDateCtl(pme);
IDISPLAY_Update(pme->m_pIDisplay);
}
/**************************************************************************
* Function Name : CSelectDWin_HandleEvent
* Description : handle current window events
* Input Parameters : IWindow * , AEEEvent , uint16 , uint32
* Output Parameters: None
* Return Value : boolean
* Date : 2007/04/18
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
static void CSelectDWin_ChangDate(SelectDWin * pme)
{
unsigned int m_year = 0;
unsigned int m_month = 0;
unsigned int m_day = 0;
IDATECTL_GetDate(
pme->m_pDateCtl,
&m_year,
&m_month,
&m_day
);
pme->m_pOwner->m_year = m_year;
pme->m_pOwner->m_month = m_month;
pme->m_pOwner->m_day = m_day;
}
/**************************************************************************
* Function Name : CSelectDWin_HandleEvent
* Description : handle current window events
* Input Parameters : IWindow * , AEEEvent , uint16 , uint32
* Output Parameters: None
* Return Value : boolean
* Date : 2007/04/18
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
boolean CSelectDWin_HandleEvent(IWindow * po, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
SelectDWin * pme = (SelectDWin *)po;
if ( SH_ISCLR(eCode) )
{
/*返回目录窗口*/
Schedule_SetWindow(pme->m_pOwner, APP_STATE_MENUDISP, 0);
return TRUE;
}
IDATECTL_HandleEvent(pme->m_pDateCtl,eCode,wParam,dwParam);
if (SH_ISEVTKEY(eCode))
{
switch(wParam)
{
case AVK_UP:
pme->m_dayOfweek = IDATECTL_GetDayOfWeek(pme->m_pDateCtl);
CSelectDWin_DrawWeek(pme);
return TRUE;
case AVK_DOWN:
pme->m_dayOfweek = IDATECTL_GetDayOfWeek(pme->m_pDateCtl);
CSelectDWin_DrawWeek(pme);
return TRUE;
case AVK_SOFT1:/*选择*/
CSelectDWin_ChangDate(pme);
/*到一日的事件列表窗口*/
Schedule_SetWindow(pme->m_pOwner, APP_STATE_ONEDAYDISP, 0);
return TRUE;
case AVK_SOFT2:/*返回*/
/*返回主窗口*/
Schedule_SetWindow(pme->m_pOwner, APP_STATE_MENUDISP, 0);
return TRUE;
case AVK_SELECT:
CSelectDWin_ChangDate(pme);
/*到一日的事件列表窗口*/
Schedule_SetWindow(pme->m_pOwner, APP_STATE_ONEDAYDISP, 0);
return TRUE;
default:
break;
}
}
return FALSE;
}
/**************************************************************************
* Function Name : CSelectDWin_InitDateCtl
* Description : This function redraws the events window.
* Input Parameters : SelectDWin*
* Output Parameters: None
* Return Value : None
* Date : 2007/04/19
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
static void CSelectDWin_InitDateCtl(SelectDWin * pme)
{
IDATECTL_SetDate(pme->m_pDateCtl,pme->m_pOwner->m_year,pme->m_pOwner->m_month,pme->m_pOwner->m_day);
/*得到日期的星期值*/
pme->m_dayOfweek = IDATECTL_GetDayOfWeek(pme->m_pDateCtl);
IDATECTL_SetRect(pme->m_pDateCtl,&pme->rect);
IDATECTL_SetActive(pme->m_pDateCtl,TRUE);
CSelectDWin_DrawWeek(pme);
CSelectDWin_drawButton(pme);
}
/**************************************************************************
* Function Name : CSelectDwin_getWeekString
* Description : This function redraws the events window.
* Input Parameters : SelectDWin*
* Output Parameters: None
* Return Value : None
* Date : 2007/04/19
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
void CSelectDwin_getWeekString(SelectDWin* pme,uint16 weekDay, AECHAR *week)
{
uint16 itemID = weekDay + 1;
ISHELL_LoadResString(pme->m_pIShell,SCHEDULE_RES_FILE,itemID,week,30 );
}
/**************************************************************************
* Function Name : CSelectDWin_DrawWeek
* Description : This function redraws the events window.
* Input Parameters : SelectDWin*
* Output Parameters: None
* Return Value : None
* Date : 2007/04/19
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
void CSelectDWin_DrawWeek(SelectDWin* pme)
{
AECHAR sWeek[30] = {' ','\0'};
AEERect rect;
int fontHe = 0;
int fontWi = 0;
CSelectDwin_getWeekString(pme,pme->m_dayOfweek, sWeek);
//WWRITELONG(sWeek,pme->m_dayOfweek);
/*字体的高度*/
fontHe = IDISPLAY_GetFontMetrics( pme->m_pIDisplay,AEE_FONT_NORMAL,NULL,NULL );
fontWi = IDISPLAY_MeasureText( pme->m_pIDisplay, AEE_FONT_NORMAL, sWeek );
rect.x = 0;
rect.y = 20;
rect.dx = pme->m_pOwner->DeviceInfo.cxScreen;
rect.dy = fontHe;
/*填充矩形的颜色*/
IDISPLAY_FillRect(pme->m_pIDisplay,&rect,RECT_BACKGROUND);
//AEE_FONT_BOLD+1
IDISPLAY_DrawText(pme->m_pIDisplay,AEE_FONT_NORMAL,sWeek,-1,rect.dx/2 - fontWi/2,20,NULL,IDF_TEXT_TRANSPARENT);
}
/**************************************************************************
* Function Name : CSelectDWin_drawButton
* Description : This function redraws the events window.
* Input Parameters : SelectDWin*
* Output Parameters: None
* Return Value : None
* Date : 2007/04/19
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
void CSelectDWin_drawButton(SelectDWin* pMe)
{
AEERect rect;
const AECHAR back[] = { 0x8fd4, 0x56de, 0 }; //返回
const AECHAR select[] = { 0x9009, 0x62e9, 0 }; //选择
/*字符宽度*/
int fontWi = 0;
int fontHe = 0;
fontWi = IDISPLAY_MeasureText( pMe->m_pIDisplay, AEE_FONT_NORMAL, back );
/*文字的高度*/
fontHe = IDISPLAY_GetFontMetrics( pMe->m_pIDisplay,AEE_FONT_NORMAL,NULL,NULL );
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,select,-1,0,
pMe->m_pOwner->DeviceInfo.cyScreen-15,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-15,NULL,IDF_TEXT_TRANSPARENT);
}
/**************************************************************************
* Function Name : ReleaseObj
* Description : 释放资源
* Input Parameters : void ***
* Output Parameters: None
* Return Value : None
* Date : 2007/04/18
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
static void ReleaseObj(void ** ppObj)
{
if ( ppObj && *ppObj )
{
(void)IBASE_Release(((IBase *)*ppObj));
*ppObj = NULL;
}
}
//--------------------end of file-------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -