📄 addrbookruim.c
字号:
IMENUCTL_Redraw(pMe->m_pSK);
ITEXTCTL_SetActive(pMe->m_pText2, TRUE);
ITEXTCTL_Redraw(pMe->m_pText2);
return TRUE;
}
// the focus switch from TEXT2 to TEXT1
if (ITEXTCTL_IsActive(pMe->m_pText2))
{
ITEXTCTL_SetActive(pMe->m_pText2, FALSE);
ITEXTCTL_Redraw(pMe->m_pText2);
ITEXTCTL_SetActive(pMe->m_pText1, TRUE);
ITEXTCTL_Redraw(pMe->m_pText1);
return TRUE;
}
}
break;
case AVK_DOWN: // Handle 'DOwN' button presses if the text control has focus.
case AVK_SELECT: // Handle 'SELECT' button presses if the text control has focus.
if(pMe->m_eAppState == APP_STATE_ADD ||pMe->m_eAppState == APP_STATE_EDIT)
{
// the focus switch from TEXT1 to TEXT2
if (ITEXTCTL_IsActive(pMe->m_pText1))
{
ITEXTCTL_SetActive(pMe->m_pText1, FALSE);
ITEXTCTL_Redraw(pMe->m_pText1);
ITEXTCTL_SetActive(pMe->m_pText2, TRUE);
ITEXTCTL_Redraw(pMe->m_pText2);
return TRUE;
}
// the focus switch from TEXT2 to soft key
if (ITEXTCTL_IsActive(pMe->m_pText2))
{
ITEXTCTL_SetActive(pMe->m_pText2, FALSE);
ITEXTCTL_Redraw(pMe->m_pText2);
IMENUCTL_SetActive(pMe->m_pSK, TRUE);
IMENUCTL_Redraw(pMe->m_pSK);
return TRUE;
}
}
break;
case AVK_POUND: // Handle '#' button presses if the text control has focus.
if((pMe->m_eAppState == APP_STATE_ADD ||pMe->m_eAppState == APP_STATE_EDIT)
&& pMe->m_pText1 && pMe->m_pText2)
{
IKeysConfig KeysConfig;
ITextCtl* pTextActive;
if (ITEXTCTL_IsActive(pMe->m_pText1))
{
pTextActive = pMe->m_pText1;
}
else
{
pTextActive = pMe->m_pText2;
}
// 变换输入法
#if 0
switch(pMe->m_nInputMode)
{
case IMT_NUMBER: // 数字变小写
ITEXTCTL_SetInputMode( pTextActive, AEE_TM_LETTERS );
if(!ISHELL_CreateInstance(pMe->pIShell, AEEIID_KEYSCONFIG, (void **)(&pMe->KeysConfig)))
{
//IKEYSCONFIG_SetKeyState(&KeysConfig, KB_CAPSLOCK, FALSE);
//IKEYSCONFIG_Release(&KeysConfig);
}
pMe->m_nInputMode = IMT_LITTLE_CASE_LETTER;
break;
case IMT_LITTLE_CASE_LETTER: // 小写变大写
if(!ISHELL_CreateInstance(pMe->pIShell, AEEIID_KEYSCONFIG, (void **)&KeysConfig))
{
IKEYSCONFIG_SetKeyState(&KeysConfig, KB_CAPSLOCK, TRUE);
IKEYSCONFIG_Release(&KeysConfig);
}
pMe->m_nInputMode = IMT_BIG_CASE_LETTER;
break;
case IMT_BIG_CASE_LETTER: // 大写变汉字
if(!ISHELL_CreateInstance(pMe->pIShell, AEEIID_KEYSCONFIG, (void **)&KeysConfig))
{
IKEYSCONFIG_SetKeyState(&KeysConfig, KB_CAPSLOCK, FALSE);
IKEYSCONFIG_Release(&KeysConfig);
}
ITEXTCTL_SetInputMode( pTextActive, AEE_TM_RAPID);
pMe->m_nInputMode = IMT_RAPID;
break;
case IMT_RAPID: // 汉字 变数字
if(!ISHELL_CreateInstance(pMe->pIShell, AEEIID_KEYSCONFIG, (void **)&KeysConfig))
{
IKEYSCONFIG_SetKeyState(&KeysConfig, KB_CAPSLOCK, FALSE);
IKEYSCONFIG_Release(&KeysConfig);
}
ITEXTCTL_SetInputMode(pTextActive, AEE_TM_NUMBERS);
pMe->m_nInputMode = IMT_NUMBER;
break;
default:
ITEXTCTL_SetInputMode( pTextActive, AEE_TM_LETTERS );
if(!ISHELL_CreateInstance(pMe->pIShell, AEEIID_KEYSCONFIG, (void **)&KeysConfig))
{
IKEYSCONFIG_SetKeyState(&KeysConfig, KB_CAPSLOCK, FALSE);
IKEYSCONFIG_Release(&KeysConfig);
}
pMe->m_nInputMode = IMT_LITTLE_CASE_LETTER;
break;
}
#endif
return TRUE;
}
break;
default:
break;
}
}
return(FALSE);
}
/*===========================================================================
FUNCTION: ET_DisplayMainMenu
DESCRIPTION:
This function displays the application Main Menu.
PARAMETERS:
pMe [in] - Pointer to the CAddrBookRuim structure. This structure contains
information specific to this applet.
DEPENDENCIES:
None
RETURN VALUE:
None
SIDE EFFECTS:
Causes the phone display to be updated.
Set application state to APP_STATE_MAIN.
===========================================================================*/
static void ABR_DisplayMainMenu( CAddrBookRuim* pMe )
{
// Make sure the pointers we'll be using are valid
if (pMe == NULL || pMe->pIShell == NULL || pMe->m_pMenu == NULL)
return;
ABR_Reset(pMe);
IMENUCTL_SetRect( pMe->m_pMenu, &pMe->m_rScreenRect );
// Set Title
IMENUCTL_SetTitle( pMe->m_pMenu, ADDRBOOKRUIM_RES_FILE, IDS_MAIN_MENU, NULL);
IMENUCTL_AddItem(pMe->m_pMenu, ADDRBOOKRUIM_RES_FILE, IDC_ADD, IDC_ADD, NULL, NULL);
IMENUCTL_AddItem(pMe->m_pMenu, ADDRBOOKRUIM_RES_FILE, IDC_VIEW, IDC_VIEW, NULL, NULL);
IMENUCTL_AddItem(pMe->m_pMenu, ADDRBOOKRUIM_RES_FILE, IDC_TOTAL_REC, IDC_TOTAL_REC, NULL, NULL);
IMENUCTL_AddItem(pMe->m_pMenu, ADDRBOOKRUIM_RES_FILE, IDC_SWITCH_STORE_DEV, IDC_SWITCH_STORE_DEV, NULL, NULL);
IMENUCTL_SetActive( pMe->m_pMenu, TRUE );
pMe->m_eAppState = APP_STATE_MAIN;
}
/*===========================================================================
FUNCTION: ABR_DisplayAddScreen
DESCRIPTION:
This function displays the application Add Screen.
PARAMETERS:
pMe [in] - Pointer to the CAddrBookRuim structure. This structure contains
information specific to this applet.
DEPENDENCIES:
None
RETURN VALUE:
None
SIDE EFFECTS:
Causes the phone display to be updated.
Set application state to APP_STATE_MAIN.
===========================================================================*/
static void ABR_DisplayAddScreen( CAddrBookRuim* pMe )
{
uint16 nControlYLoc = 2;
AECHAR* psTextBuf;
AEERect rRect;
// Make sure the pointers we'll be using are valid
if (pMe == NULL || pMe->pIShell == NULL || pMe->pIDisplay==NULL || pMe->m_pSK == NULL || pMe->m_pText1 == NULL || pMe->m_pText2 == NULL)
return;
ABR_Reset(pMe);
psTextBuf = (AECHAR*) MALLOC( MAX_RES_STRING_BUF_SIZE * sizeof( AECHAR ) );
// display add menu title
if( psTextBuf )
{
ISHELL_LoadResString( pMe->pIShell, ADDRBOOKRUIM_RES_FILE, IDS_ADD_MENU, psTextBuf, MAX_RES_STRING_BUF_SIZE * sizeof( AECHAR ) );
// Set the position of the label's daring rectangle
SETAEERECT( &rRect, 2, nControlYLoc, IDISPLAY_MeasureText( pMe->pIDisplay, AEE_FONT_BOLD, psTextBuf ), pMe->m_nFontHeight );
IDISPLAY_DrawText( pMe->pIDisplay, AEE_FONT_BOLD, psTextBuf, -1, 0, 0, &rRect, IDF_ALIGN_BOTTOM | IDF_ALIGN_LEFT);
IDISPLAY_Update( pMe->pIDisplay);
FREEIF( psTextBuf );
}
nControlYLoc += pMe->m_nFontHeight + 3;
psTextBuf = (AECHAR*) MALLOC( MAX_RES_STRING_BUF_SIZE * sizeof( AECHAR ) );
// display add name head
if( psTextBuf )
{
ISHELL_LoadResString( pMe->pIShell, ADDRBOOKRUIM_RES_FILE, IDC_ADD_NAME, psTextBuf, MAX_RES_STRING_BUF_SIZE * sizeof( AECHAR ) );
// Set the position of the label's daring rectangle
SETAEERECT( &rRect, 2, nControlYLoc, IDISPLAY_MeasureText( pMe->pIDisplay, AEE_FONT_NORMAL, psTextBuf ), pMe->m_nFontHeight );
IDISPLAY_DrawText( pMe->pIDisplay, AEE_FONT_NORMAL, psTextBuf, -1, rRect.x, rRect.y, &rRect, IDF_ALIGN_BOTTOM | IDF_ALIGN_LEFT );
IDISPLAY_Update( pMe->pIDisplay);
FREEIF( psTextBuf );
}
// Display add name input text
ITEXTCTL_Reset( pMe->m_pText1 );
ITEXTCTL_SetProperties( pMe->m_pText1, TP_FRAME );
// Set the starting X coordinate position of the control and its width (screen width
// minus the width of the label string).
rRect.x = 2 + rRect.dx;
rRect.dx = pMe->m_rScreenRect.dx - rRect.x -2;
ITEXTCTL_SetRect(pMe->m_pText1, &rRect );
ITEXTCTL_SetInputMode( pMe->m_pText1, AEE_TM_LETTERS );
pMe->m_nInputMode = IMT_LITTLE_CASE_LETTER;
ITEXTCTL_SetMaxSize( pMe->m_pText1, MAX_CONTACT_NAME_SIZE+1 );
ITEXTCTL_SetActive( pMe->m_pText1, TRUE );
ITEXTCTL_Redraw( pMe->m_pText1);
nControlYLoc += pMe->m_nFontHeight + 3;
psTextBuf = (AECHAR*) MALLOC( MAX_RES_STRING_BUF_SIZE * sizeof( AECHAR ) );
// display add num head
if( psTextBuf )
{
ISHELL_LoadResString( pMe->pIShell, ADDRBOOKRUIM_RES_FILE, IDC_ADD_NUM, psTextBuf, MAX_RES_STRING_BUF_SIZE * sizeof( AECHAR ) );
// Set the position of the label's daring rectangle
SETAEERECT( &rRect, 2, nControlYLoc, IDISPLAY_MeasureText( pMe->pIDisplay, AEE_FONT_NORMAL, psTextBuf ), pMe->m_nFontHeight );
IDISPLAY_DrawText( pMe->pIDisplay, AEE_FONT_NORMAL, psTextBuf, -1, rRect.x, rRect.y, &rRect, IDF_ALIGN_BOTTOM | IDF_ALIGN_LEFT );
IDISPLAY_Update( pMe->pIDisplay);
FREEIF( psTextBuf );
}
// Display add num input text
ITEXTCTL_Reset( pMe->m_pText2 );
ITEXTCTL_SetProperties( pMe->m_pText2, TP_FRAME );
// Set the starting X coordinate position of the control and its width (screen width
// minus the width of the label string).
rRect.x = 2 + rRect.dx;
rRect.dx = pMe->m_rScreenRect.dx - rRect.x -2;
ITEXTCTL_SetRect(pMe->m_pText2, &rRect );
ITEXTCTL_SetInputMode( pMe->m_pText2, AEE_TM_NUMBERS);
pMe->m_nInputMode = IMT_NUMBER;
ITEXTCTL_SetMaxSize( pMe->m_pText2, MAX_CONTACT_NUM_SIZE );
ITEXTCTL_SetActive( pMe->m_pText2, FALSE );
ITEXTCTL_Redraw( pMe->m_pText2);
// soft key
IMENUCTL_AddItem( pMe->m_pSK, ADDRBOOKRUIM_RES_FILE, IDC_ADD_SK, IDC_ADD_SK, NULL, 0 );
IMENUCTL_Redraw( pMe->m_pSK);
pMe->m_eAppState = APP_STATE_ADD;
}
/*===========================================================================
FUNCTION: ABR_DisplayEditScreen
DESCRIPTION:
This function displays the application Edit Menu.
PARAMETERS:
pMe [in] - Pointer to the CAddrBookRuim structure. This structure contains
information specific to this applet.
wItemID[in] - record ID of address book
DEPENDENCIES:
None
RETURN VALUE:
None
SIDE EFFECTS:
Causes the phone display to be updated.
Set application state to APP_STATE_MAIN.
===========================================================================*/
static void ABR_DisplayEditScreen( CAddrBookRuim* pMe, uint16 wItemID )
{
uint16 nControlYLoc = 2;
AECHAR* psTextBuf;
AEERect rRect;
AECHAR psNameForItemID[MAX_CONTACT_NAME_SIZE+1];
AECHAR psNumForItemID[MAX_CONTACT_NUM_SIZE+1];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -