📄 mmisatmenu.c
字号:
/*******************************************************************************
CONDAT (UK)
********************************************************************************
This software product is the property of Condat (UK) Ltd and may not be
disclosed to any third party without the express permission of the owner.
********************************************************************************
$Project name: Basic MMI
$Project code: BMI (6349)
$Module: MMI
$File: MmiSatMenu.c
$Revision: 1.0
$Author: Condat(UK)
$Date: 25/10/00
********************************************************************************
Description:
Implementation of MMI SIM Application Toolkit (SAT)
********************************************************************************
$History: MmiSatMenu.c
25/10/00 Original Condat(UK) BMI version.
$End
*******************************************************************************/
/*******************************************************************************
Include Files
*******************************************************************************/
#define ENTITY_MFW
/* includes */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#if defined (NEW_FRAME)
#include "typedefs.h"
#include "vsi.h"
#include "pei.h"
#include "custom.h"
#include "gsm.h"
#else
#include "stddefs.h"
#include "custom.h"
#include "gsm.h"
#include "vsi.h"
#endif
#include "mfw_sys.h"
#include "p_sim.h"
//#include <stdio.h>
//#include <string.h>
//#include <stdlib.h>
//#include "mfw_sys.h"
//#include "stddefs.h"
//#include "custom.h"
//#include "gsm.h"
//#include "vsi.h"
#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
#include "mfw_edt.h"
#include "mfw_lng.h"
#include "mfw_icn.h"
#include "mfw_phb.h"
#include "mfw_sim.h"
#include "mfw_nm.h"
#include "mfw_sms.h"
#include "mfw_mnu.h"
#include "mfw_sat.h"
#include "mfw_tim.h"
#include "ksd.h"
#include "psa.h"
#include "dspl.h"
#include "MmiMmi.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiMain.h"
#include "MmiStart.h"
#include "MmiPins.h"
#include "MmiMenu.h"
#include "MmiSoftKeys.h"
#include "MmiSounds.h"
#include "MmiCall.h"
#include "mmiSat_i.h"
#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
#include "MmiIcons.h"
#include "mmiiconresource.h"
BOOL g_SATsession_is_active = FALSE;
/*********************************************************************
**********************************************************************
setup_menu DYNAMIC MENU WINDOW. DECLARATION
*********************************************************************
**********************************************************************/
typedef struct
{
/* administrative data */
T_MMI_CONTROL mmi_control;
T_MFW_HND win;
T_MFW_HND kbd; /* sbh - keyboard handler, so window can be destroyed by user */
/* associated handlers */
/* internal data */
T_SAT_CMD *sat_command; /* pointer to sat_command in parent */
ListMenuData_t list_menu_data;
} T_sat_setup_menu;
static T_MFW_HND sat_setup_menu_create (T_MFW_HND parent);
static void sat_setup_menu_destroy (T_MFW_HND window);
static void sat_setup_menu_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command);
static void sat_setup_menu_listmnu_cb (T_MFW_HND win, ListMenuData_t * ListData);
static T_MFW sat_setup_menu_recreate(T_sat_setup_menu *data);
static MfwMnuAttr sat_setup_menuAttrib =
{
0,
&sat_setup_menuArea,
MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
-1, /* use default font */
NULL, /* with these items */
0 /* number of items */
};
static MfwMnuAttr sat_select_menuAttrib =
{
0,
&sat_select_menuArea,
MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
-1, /* use default font */
NULL, /* with these items */
0 /* number of items */
};
/*********************************************************************
**********************************************************************
setup_menu DYNAMIC MENU WINDOW. IMPLEMENTATION
*********************************************************************
**********************************************************************/
T_MFW_HND sat_setup_menu_start(T_SAT_CMD * sat_command)
{
T_MFW_HND win;
TRACE_FUNCTION ("sat_setup_menu_start()");
{
char temp[80];
sprintf(temp,"MFW Memory Left after starting SAT %d",mfwCheckMemoryLeft());
TRACE_EVENT(temp);
}
win = sat_setup_menu_create (NULL);
if (win NEQ NULL)
{
SEND_EVENT (win, SAT_SETUP_MENU, 0, sat_command);
}
return win;
}
static T_MFW_HND sat_setup_menu_create(MfwHnd parent_window)
{
T_sat_setup_menu * data = (T_sat_setup_menu *)ALLOC_MEMORY (sizeof (T_sat_setup_menu));
T_MFW_WIN * win;
TRACE_EVENT ("sat_setup_menu_create()");
/*
* Create window handler
*/
data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)sat_win_cb);
sat_set_setup_menu_win(data->win); // c030 rsa
if (data->win EQ NULL)
{
return NULL;
}
/*
* connect the dialog data to the MFW-window
*/
data->mmi_control.dialog = (T_DIALOG_FUNC)sat_setup_menu_exec;
data->mmi_control.data = data;
win = ((T_MFW_HDR *)data->win)->data;
win->user = (MfwUserDataPtr)data;
data->kbd = kbdCreate( data->win, KEY_ALL, (T_MFW_CB) sat_kbd_cb); /* sbh - add keyboard handler */
/*
* return window handle
*/
g_SATsession_is_active = TRUE;
win_show(data->win);
return data->win;
}
static void sat_setup_menu_destroy(MfwHnd own_window)
{
T_MFW_WIN * win_data;
T_sat_setup_menu * data;
int i;
TRACE_EVENT ("sat_setup_menu_destroy()");
g_SATsession_is_active = FALSE;
if (own_window)
{
win_data = ((T_MFW_HDR *)own_window)->data;
data = (T_sat_setup_menu *)win_data->user;
if (data)
{
/*
* Delete WIN handler
*/
win_delete (data->win);
/*
* Free Memory
*/
for (i=0; i < data->list_menu_data.ListLength; i++)
{
sat_destroy_ITEM_ASCIIZ (data->list_menu_data.List[i].str);
}
sat_destroy_ITEM_ASCIIZ (data->list_menu_data.ListMenuHeadStr); //zhaowm 2003.0318 for avoiding mem leak
FREE_MEMORY ((U8 *)data->list_menu_data.List,
(data->list_menu_data.ListLength * sizeof (MfwMnuItem)));
data->list_menu_data.List = NULL;
FREE_MEMORY ((U8 *)data, sizeof (T_sat_setup_menu));
sat_set_setup_menu_win(NULL); // c030 rsa
}
else
{
TRACE_EVENT ("sat_setup_menu_destroy() called twice");
}
}
}
static T_MFW sat_setup_menu_recreate(T_sat_setup_menu *data)
{
int i;
SatMenu * menu = &data->sat_command->c.menu;
#ifdef __COMPLETE_LIST_SUPPORT__ /* ??? rsa for future extension */
if ((&data->sat_command.qual & SAT_M_SETUP_HELP_AVAIL) NEQ 0)
{
data->list_menu_data.AlternateLeftSoftKey = TxtHelp; /* help available */
}
else
{
data->list_menu_data.AlternateLeftSoftKey = TxtNull; /* no help available */
}
#endif
if (data->list_menu_data.List EQ NULL)
{
/* c030 rsa first time creation */
/* allocate sufficient memory to hold the list of menu items */
data->list_menu_data.ListLength = menu->nItems; /* actual number of entries in list menu. */
data->list_menu_data.List = (MfwMnuItem *)ALLOC_MEMORY (data->list_menu_data.ListLength * sizeof (MfwMnuItem));
for (i=0; i < data->list_menu_data.ListLength; i++) /* Fill Menu List */
{
data->list_menu_data.List[i].icon = GET_ICONATTR(ICON_LISTCOMMON, 0);//&colist;/* 2004/06 sunsj modify for icon manage */
data->list_menu_data.List[i].exta = 0;
data->list_menu_data.List[i].edit = 0;
data->list_menu_data.List[i].menu = 0;
data->list_menu_data.List[i].func = 0;
/* get the correct entry in list of setup_menuList */
data->list_menu_data.List[i].str = sat_create_ITEM_ASCIIZ (&menu->items[i]);
data->list_menu_data.List[i].flagFunc = (FlagFunc)item_flag_none;
}
}
data->list_menu_data.autoDestroy = TRUE;
// zhaowm 2002/09/04 add head title in the stk menu.
data->list_menu_data.ListMenuFlag =1;
//if (strlen(sat_create_TEXT_ASCIIZ (&menu->header))!=0)
data->list_menu_data.ListMenuHeadStr=sat_create_TEXT_ASCIIZ (&menu->header);
//else
// data->list_menu_data.ListMenuHeadStr = MmiRsrcGetText(Txtnotitle);
return listDisplayListMenu(data->win, &data->list_menu_data, (ListCbFunc)sat_setup_menu_listmnu_cb,0);
}
static void sat_setup_menu_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command)
/* callback handler for events sent from parents or childs to to trigger some execution */
{
T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
T_sat_setup_menu * data = (T_sat_setup_menu *)win_data->user;
T_SAT_RES sat_res;
TRACE_FUNCTION ("sat_setup_menu_exec()");
switch (event)
{
case SAT_SETUP_MENU:
/* initialization of administrative data */
data->sat_command = sat_command; /* save a pointer to the parameter for later use in callbacks */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -