📄 schcreateevent.c
字号:
* Input Parameters : CreateEventWin *pMe,int yLoc
* Output Parameters: None
* Return Value : boolean
* Date : 2007/04/13
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
static void SCEvent_InitMenuCtl(CreateEventWin* pMe,int yLoc)
{
CtlAddItem ai;
AECHAR State[20]={' ','\0'};
AECHAR StateON[20]={' ','\0'};
AECHAR StateOFF[20]={' ','\0'};
// set event types
STRTOWSTR("StatE :",State,20);
STRTOWSTR(" ON",StateON,20);
STRTOWSTR(" OFF ",StateOFF,20);
// Display List of Event Types
ai.pImage = NULL;
ai.pszResImage =NULL;
ai.pszResText =NULL;
ai.wFont = AEE_FONT_NORMAL;
ai.dwData = 0;
ai.wText =NULL;
ai.wImage = NULL;
ai.pText = StateOFF;
ai.wItemID=1;
IMENUCTL_AddItemEx(pMe->m_pStateList, &ai);
ai.pText = StateON;
ai.wItemID=2;
IMENUCTL_AddItemEx(pMe->m_pStateList, &ai);
IMENUCTL_EnableCommand( pMe->m_pStateList, FALSE);
IMENUCTL_SetRect( pMe->m_pStateList, &pMe->m_listRect);
IDISPLAY_DrawText(pMe->m_pIDisplay,AEE_FONT_BOLD,State,-1,0,yLoc,NULL,IDF_TEXT_TRANSPARENT);
}
/**************************************************************************
* Function Name : SCEvent_DispEvtType
* Description : disp event type on the screen
* Input Parameters : IWindow * , AEEEvent , uint16 , uint32
* Output Parameters: None
* Return Value : boolean
* Date : 2007/04/12
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
static void SCEvent_DispEvtType(CreateEventWin* pMe)
{
AECHAR EvtType[40]={' ','\0'};
AECHAR disp[20]={' ','\0'};
int stateValue=0;
// Display the operation tip
STRTOWSTR("disp",disp,20);
IDISPLAY_DrawText (pMe->m_pIDisplay,(AEE_FONT_BOLD+1),disp,-1,0,90,NULL,NULL);
IDISPLAY_DrawHLine(pMe->m_pIDisplay,0,108,pMe->m_pOwner->DeviceInfo.cxScreen);
IDISPLAY_DrawHLine(pMe->m_pIDisplay,0,pMe->m_pOwner->DeviceInfo.cyScreen-15,pMe->m_pOwner->DeviceInfo.cxScreen);
}
static boolean SC_ProcessTextEvent(AEEEvent eCode, uint16 wParam, uint32 dwParam,ITextCtl* m_pText)
{
uint16 wButtons[3];
int len;
int32 curPos;
curPos = ITEXTCTL_GetCursorPos(m_pText);
len = WSTRLEN(ITEXTCTL_GetTextPtr(m_pText));
if (ITEXTCTL_HandleEvent(m_pText, eCode, wParam, dwParam))
{
// If there is text, then make sure the cursor is at the start or end
if (len)
{
// If the cursor is anywhere between the start and end, let the control handle
// the event
if (curPos >= TC_CURSORSTART + 1 && // cursor beyond start
curPos <= len - 1) // cursor before end
return TRUE;
}
switch( wParam)
{
case AVK_RIGHT:
if (curPos == TC_CURSORSTART || curPos == (len - 1))
return TRUE;
break;
case AVK_LEFT:
if (curPos == (TC_CURSORSTART + 1) || curPos == len)
return TRUE;
break;
case AVK_CLR:
return TRUE;
}
}
return FALSE;
}
/**************************************************************************
* Function Name : CWeekWin_HandleEvent
* Description : handle current window events
* Input Parameters : IWindow * , AEEEvent , uint16 , uint32
* Output Parameters: None
* Return Value : boolean
* Date : 2007/04/12
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
boolean CCEventWin_HandleEvent(IWindow * po, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
CreateEventWin * pMe = (CreateEventWin *)po;
if( IMENUCTL_HandleEvent(pMe->m_pStateList, eCode, wParam, dwParam) )
return TRUE;
if( IDATECTL_HandleEvent(pMe->m_pStartDate, eCode, wParam, dwParam) );
//return TRUE;
if( ITIMECTL_HandleEvent(pMe->m_pStartTime, eCode, wParam, dwParam) );
//return TRUE;
if( SC_ProcessTextEvent(eCode, wParam, dwParam, pMe->m_pTitleText) )
return TRUE;
if( SC_ProcessTextEvent(eCode, wParam, dwParam, pMe->m_pDetailText) )
return TRUE;
//process the key events
if (SH_ISEVTKEY(eCode))
{
switch(eCode)
{
case EVT_KEY: //JulianType rJulianDate;
case EVT_CTL_TAB:
switch( wParam )
{
case CTL_TAB_RIGHT: // Handle tab-right events
if( IMENUCTL_IsActive( pMe->m_pStateList) )
{
IMENUCTL_SetActive( pMe->m_pStateList, FALSE );
IDATECTL_SetActive( pMe->m_pStartDate, TRUE );
return TRUE;
}
if( IDATECTL_IsActive( pMe->m_pStartDate ) )
{
IDATECTL_SetActive( pMe->m_pStartDate, FALSE );
ITIMECTL_SetActive( pMe->m_pStartTime, TRUE );
return TRUE;
}
if( ITIMECTL_IsActive( pMe->m_pStartTime ) )
{
ITIMECTL_SetActive( pMe->m_pStartTime, FALSE );
ITEXTCTL_SetActive( pMe->m_pTitleText, TRUE );
return TRUE;
}
if( ITEXTCTL_IsActive( pMe->m_pTitleText ) )
{
ITEXTCTL_SetActive( pMe->m_pTitleText, FALSE );
ITEXTCTL_SetActive( pMe->m_pDetailText, TRUE );
return TRUE;
}
if( ITEXTCTL_IsActive( pMe->m_pDetailText ) )
{
ITEXTCTL_SetActive( pMe->m_pDetailText, FALSE );
IMENUCTL_SetActive( pMe->m_pStateList, TRUE );
return TRUE;
}
break;
case CTL_TAB_LEFT: // Handle tab-left events
if( IMENUCTL_IsActive( pMe->m_pStateList ) )
{
IMENUCTL_SetActive( pMe->m_pStateList, FALSE );
ITEXTCTL_SetActive( pMe->m_pDetailText, TRUE );
return TRUE;
}
if( IDATECTL_IsActive( pMe->m_pStartDate ) )
{
IDATECTL_SetActive( pMe->m_pStartDate, FALSE );
IMENUCTL_SetActive( pMe->m_pStateList, TRUE );
return TRUE;
}
if( ITIMECTL_IsActive( pMe->m_pStartTime ) )
{
ITIMECTL_SetActive( pMe->m_pStartTime, FALSE );
IDATECTL_SetActive( pMe->m_pStartDate, TRUE );
return TRUE;
}
if( ITEXTCTL_IsActive( pMe->m_pTitleText ) )
{
ITEXTCTL_SetActive( pMe->m_pTitleText, FALSE );
ITIMECTL_SetActive( pMe->m_pStartTime, TRUE );
return TRUE;
}
if( ITEXTCTL_IsActive( pMe->m_pDetailText ) )
{
ITEXTCTL_SetActive( pMe->m_pDetailText, FALSE );
IMENUCTL_SetActive( pMe->m_pStateList, TRUE );
return TRUE;
}
break;
}//switch wParam ended
}//if ended
}// end of if SH_ISEVTKEY(eCode)
/*process the clr_key events*/
if (SH_ISCLR(eCode) )
{
/*back event type window*/
Schedule_SetWindow(pMe->m_pOwner, APP_STATE_EVTTYPE, 0);
return TRUE;
}
return FALSE;
}
/**************************************************************************
* Function Name : SCEvent_ReleaseMainControls
* Description : release all of controls
* Input Parameters : IWindow * , AEEEvent , uint16 , uint32
* Output Parameters: None
* Return Value : boolean
* Date : 2007/04/12
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
static void SCEvent_ReleaseMainControls(CreateEventWin* pMe)
{
// Release each of the controls
ReleaseObj((void**)&pMe->m_pStartDate);
ReleaseObj((void**)&pMe->m_pStateList);
ReleaseObj((void**)&pMe->m_pStartTime);
ReleaseObj((void**)&pMe->m_pTitleText);
ReleaseObj((void**)&pMe->m_pEventList);
ReleaseObj((void**)&pMe->m_pDetailText);
}
/**************************************************************************
* Function Name : ReleaseObj
* Description : release controls
* Input Parameters : void **
* Output Parameters: None
* Return Value : boolean
* Date : 2007/04/13
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
static void ReleaseObj(void ** ppObj)
{
if ( ppObj && *ppObj )
{
(void)IBASE_Release(((IBase *)*ppObj));
*ppObj = NULL;
}
}
/**************************************************************************
* Function Name : SCEvent_CreateMainControls
* Description : create all of component
* Input Parameters : CreateEventWin
* Output Parameters: None
* Return Value : boolean
* Date : 2007/04/12
* Author : ZhongNingLin@neusoft.com
***************************************************************************/
static boolean SCEvent_CreateMainControls( CreateEventWin* pMe )
{
//AEERect rc;
//AEEItemStyle rNormalStyle;
//AEEItemStyle rSelStyle;
// Create the main application controls.
if((ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_DATECTL, (void**)(&pMe->m_pStartDate)) != SUCCESS) ||
(ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_LISTCTL, (void**)(&pMe->m_pStateList)) != SUCCESS) ||
(ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_CLOCKCTL, (void**)(&pMe->m_pStartTime)) != SUCCESS) ||
(ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_TEXTCTL, (void**)(&pMe->m_pTitleText)) != SUCCESS) ||
(ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_MENUCTL, (void**)(&pMe->m_pEventList)) != SUCCESS) ||
(ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_TEXTCTL, (void**)(&pMe->m_pDetailText)) != SUCCESS ))
return FALSE;
SETAEERECT( &pMe->m_listRect, 40, 38, pMe->m_pOwner->DeviceInfo.cxScreen-45, 16);
SETAEERECT( &pMe->m_dateRect, 52, 55, pMe->m_pOwner->DeviceInfo.cxScreen-55, 16);
SETAEERECT( &pMe->m_timeRect, 29, 72, pMe->m_pOwner->DeviceInfo.cxScreen-55, 16);
SETAEERECT( &pMe->m_titleRect, 24, 90, pMe->m_pOwner->DeviceInfo.cxScreen-25, 16);
SETAEERECT( &pMe->m_detailRect, 12, 110, pMe->m_pOwner->DeviceInfo.cxScreen-15, 30);
//SETAEERECT( &pMe->m_pEvtRect, 3, 20, pme->m_pOwner->DeviceInfo.cxScreen-3,pAee->m_pScheWeekDateDisp->m_dy);
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -