📄 mmibookcalldetailswindow.c
字号:
/* show the editor and update the soft keys
*/
edtShow( data->edt );
}
#else
if (CphsPresent() == TRUE)
{
sprintf( (char *) data->edtBuf, "%s%s%s%s%d%s%s",
(char *) my->name, "\n",
(char *) my->number,"\n Line ", my->line,"\n",
TempBuffer );
}
else
sprintf( (char *) data->edtBuf, "%s%s%s%s%s",
(char *) my->name, "\n",
(char *) my->number,"\n",
TempBuffer );
/* show the editor and update the soft keys
*/
edtShow( data->edt );
#endif
displaySoftKeys( TxtNull, TxtSoftBack );
}
break;
default:
{
/* default processing, we return IGNORED here and let the
default handler pick up the ball
*/
return MFW_EVENT_PASSED;
}
}
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookCallDetailsKeyCB
$Description: normal keyboard handler
$Returns: MFW_EVENT_CONSUMED in all cases
$Arguments: e, event to be handled, k keyboard handle
*******************************************************************************/
static int bookCallDetailsKeyCB( MfwEvt e, MfwKbd *k )
{
T_MFW_HND win = mfwParent( mfw_header() );
T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data;
tBookStandard *data = (tBookStandard *) win_data->user;
/* make sure we handle null keyboards
*/
if ( k == NULL )
return MFW_EVENT_CONSUMED;
/* deal with the incoming key code
*/
switch( k->code )
{
case KCD_MNUUP:
{
/* scroll up event
*/
if ( data->phbk->current.index == data->phbk->current.status.used_entries )
data->phbk->current.index = 1;
else
data->phbk->current.index++;
}
break;
case KCD_MNUDOWN:
{
/* scroll down event
*/
if ( data->phbk->current.index == 1 )
data->phbk->current.index = data->phbk->current.status.used_entries;
else
data->phbk->current.index--;
}
break;
case KCD_CALL:
{
/* left, implies make call
*/
callNumber( data->phbk->current.entry[data->phbk->current.selectedName].number );
bookPhonebookDestroy( data->phbk->win );
}
break;
case KCD_RIGHT:
{
bookCallDetailsDestroy(data->win);
}
break;
case KCD_HUP:
{
/* clear, destroy the window
*/
bookCallDetailsDestroy( data->win );
}
break;
default:
{
/* no default behaviour required
*/
}
break;
}
/* if we have scrolled then the behaviour needs to be to perform another
search to get the window updated correctly
*/
if ( ( k->code == KCD_MNUUP ) || ( k->code == KCD_MNUDOWN ) )
{
bookFindName( MAX_SEARCH_NAME, &data->phbk->current );
winShow( win );
}
/* and always return consumed
*/
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookCallDetailsKbdLongCB
$Description: Keyboard Long Press event handler
$Returns: MFW_EVENT_CONSUMED always
$Arguments: e, event, k, keyboard handle
*******************************************************************************/
static int bookCallDetailsKeyLongCB( MfwEvt e, MfwKbd *k )
{
T_MFW_HND win = mfwParent( mfw_header() );
T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data;
tBookStandard *data = (tBookStandard *) win_data->user;
/* hand a long clear event only
*/
if ( ( e & KEY_CLEAR ) && ( e & KEY_LONG ) )
bookCallDetailsDestroy( data->win );
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookCallDetailsCreate
$Description: Creates the window and associates editors and keyboards
with it.
$Returns: handle of the newly created window, or NULL if failure
$Arguments: parent, handle of parent window
*******************************************************************************/
static T_MFW_HND bookCallDetailsCreate( MfwHnd parent )
{
T_MFW_WIN *win_data;
tBookStandard *data = (tBookStandard *) ALLOC_MEMORY( sizeof( tBookStandard ) );
T_MFW_WIN *parent_win_data = ((T_MFW_HDR *)parent)->data;
T_phbk *phbk = (T_phbk *)parent_win_data->user;
TRACE_FUNCTION ("phbk_call_details_create()");
/* Deal with allocation failure on the data block
*/
if ( ! data )
return NULL;
/* create the window
*/
if ( ( data->win = win_create( parent, 0, E_WIN_VISIBLE, (T_MFW_CB) bookCallDetailsWinCB ) ) == NULL )
return NULL;
/* Associate the dialog and user data areas
*/
data->mmi_control.dialog = (T_DIALOG_FUNC) bookCallDetails;
data->mmi_control.data = data;
win_data = ((T_MFW_HDR *)data->win)->data;
win_data->user = (void *) data;
data->parent_win = parent;
/* Create the keyboards and editor objects, and associate a phone book handler
*/
bookSetEditAttributes( 4, 0, 80, 32, 0, 0, edtCurBar1, 0,
(char*) data->edtBuf, STANDARD_EDITOR_SIZE, &data->attr );
data->kbd = kbdCreate( data->win, KEY_ALL, (MfwCb) bookCallDetailsKeyCB );
data->kbd_long = kbdCreate( data->win, KEY_ALL | KEY_LONG, (MfwCb) bookCallDetailsKeyLongCB );
data->edt = edtCreate( data->win, &data->attr, 0, 0 );
data->phbk = phbk;
/* return the handle to the newly created window
*/
return data->win;
}
/*******************************************************************************
Public methods
*******************************************************************************/
/*******************************************************************************
$Function: bookCallDetailsStart
$Description: entry point for the call details window
$Returns: handle of newly created window, or NULL
$Arguments: parent, handle of the parent window
*******************************************************************************/
T_MFW_HND bookCallDetailsStart( MfwHnd parent )
{
T_MFW_HND win;
TRACE_FUNCTION( "bookCallDetailsStart()" );
/* create and initialise the window
*/
if ( ( win = bookCallDetailsCreate( parent ) ) != NULL )
SEND_EVENT( win, CALL_DETAILS_INIT, 0, 0 );
/* return the handle, or NULL if it failed to be created correctly
*/
return win;
}
/*******************************************************************************
$Function: bookCallDetailsDestroy
$Description: destroys the call details window
$Returns: None.
$Arguments: window, hande of the window to be destroyed
*******************************************************************************/
void bookCallDetailsDestroy( MfwHnd window )
{
T_MFW_WIN *win = ((T_MFW_HDR *)window)->data;
tBookStandard *data = (tBookStandard *)win->user;
TRACE_FUNCTION ("bookCallDetailsDestroy()");
if ( data )
{
winDelete( data->win );
FREE_MEMORY( (unsigned char *) data, sizeof( tBookStandard ) );
}
}
/*******************************************************************************
End of File
*******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -