⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmilists.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 2 页
字号:
/*******************************************************************************

					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:		    MmiLists.c
 $Revision:		1.0                                                       
																			  
 $Author:		Condat(UK)                                                         
 $Date:		    22/02/01                                                      
																			   
********************************************************************************
																			  
 Description:

  

********************************************************************************

 $History: MmiLists.c

*******************************************************************************/

#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 "pconst.cdg"
#include "mconst.cdg"
#include "message.h"
#include "ccdapi.h"
#include "prim.h"
#include "cus_aci.h"
#include "cnf_aci.h"
#include "mon_aci.h"

#include "tok.h"

#include "pcm.h"



#include "mfw_sys.h"

#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
#include "mfw_lng.h"
#include "mfw_edt.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_tim.h"

#include "mfw_sim.h"
#include "mfw_cm.h"
#include "mfw_nm.h"
#include "mfw_phb.h"
#include "mfw_mme.h"
#include "mfw_sat.h"
#include "mfw_sms.h"

#include "dspl.h"

#include "ksd.h"
#include "psa.h"

#include "MmiMain.h"
#include "MmiBookController.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiLists.h"



#include "MmiMenu.h"
#include "MmiCall.h"
#include "MmiIcons.h"
#include "MmiIdle.h"

#include "MmiSoftKeys.h"
#include "MmiSounds.h"
#include "MmiIdle.h"
#include "MmiNetwork.h"
#include "MmiSat_i.h"
#include "MmiAoc.h"

#include "gdi.h"
#include "audio.h"

#include "cus_aci.h"
#include "p_sim.h"
#include "mfw_ffs.h"
#include "MmiTimers.h"
#include "Mmisettings.h"

#include "pwr.h"   
#include "p_sim.h"
#include "mmibooksearchwindow.h"
#include "mmismsread.h"

#ifdef _MMS_ENABLE_
	#include "mmiMMSGlobalDef.h"
	#include "mmiMMSSetting.h"
#endif


#ifndef MFW_EVENT_PASSED
	#define MFW_EVENT_PASSED 0
#endif

extern MfwRect menuArea; /* menus display area */
extern driver_Parameter drvpara;
extern weeklyAlarm_win;
extern  uint8 CallListFlag;
extern MfwHnd cugwindows;
extern BOOL getMelodyListStatus(void);

typedef enum
{
	E_INIT,
	E_BACK,
	E_RETURN,
	E_ABORT,
	E_EXIT
} e_lists_events;


/*-----------------------------------------------------------------------------
*
* List menu handling functions:
*
*-----------------------------------------------------------------------------*/
#if 0
typedef struct
{
	T_MMI_CONTROL   mmi_control;
	T_MFW_HND winLists;
	SHORT           id;
	T_MFW_HND Parent;
	T_MFW_HND kbdLists;
	T_MFW_HND kbdLists_long;
	T_MFW_HND MenuLists;
	MfwMnuAttr MenuListsAttr;
	ListCbFunc Callback;
	UBYTE   ExitReason;
	ListMenuData MenuData;
} ListWinInfo;

#endif

static int listsKeyEvent(MfwEvt event, MfwKbd *keyboard);
static int listsWinEvent(MfwEvt e, MfwWin *w);
static int listsListCbMenu(MfwEvt EventCode, MfwMnu *MenuHandle);
static void lists_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);


/*******************************************************************************

 $Function:  listDisplayListMenu  

 $Description:	 Creates a list menu from data stored in NVRAM.

 $Returns:		none.

 $Arguments:	
 
*******************************************************************************/
T_MFW listDisplayListMenu (MfwHnd Parent, ListMenuData *Data, ListCbFunc cbFunc,int inUnicode)
{
	UBYTE i;
	MfwWin * win;
	MfwHnd winLists;
	T_MFW Status = LISTS_OK;

	TRACE_FUNCTION ("listDisplayListMenu()");

	winLists = winCreate(Parent, 0, E_WIN_VISIBLE, (MfwCb)listsWinEvent);

	if (winLists == NULL)
	{
		Status = LISTS_FAIL;				/* Inform caller of failure. */
		TRACE_FUNCTION ("win creation fails");
	}
	else
	{
		ListWinInfo * ListData = (ListWinInfo *)ALLOC_MEMORY (sizeof (ListWinInfo));

		if (!ListData)
			TRACE_FUNCTION ("(ListWinInfo *)ALLOC_MEMORY fails");

		ListData->mmi_control.dialog = (T_DIALOG_FUNC)lists_exec_cb;
		ListData->mmi_control.data   = ListData;
		win = ((MfwHdr *)winLists)->data;
		win->user = (void *) ListData;

		ListData->Parent = Parent;
		ListData->Callback = cbFunc;
		ListData->winLists = winLists;
		ListData->kbdLists =      kbdCreate(winLists,Data->KeyEvents|KEY_MAKE,         (MfwCb)listsKeyEvent);
		ListData->kbdLists_long = kbdCreate(winLists,Data->KeyEvents|KEY_LONG,(MfwCb)listsKeyEvent);

		if ((ListData->kbdLists == NULL) || (ListData->kbdLists_long == NULL))
		{
			Status = LISTS_FAIL;
			TRACE_FUNCTION ("ListData->kbdLists fails");
		}
		else
		{
			/* Create initial list menu for display. */

			/*
			 * set menu list from outside
			 */
			ListData->MenuListsAttr = *Data->Attr; /* copy contents */
			if (Data->List[0].icon!=0)
				ListData->MenuListsAttr.mode = MNU_LEFT | MNU_OVERLAPPED | MNU_CUR_LINE;
			else ListData->MenuListsAttr.mode =MNU_LEFT | MNU_LIST | MNU_CUR_LINE;
			ListData->MenuListsAttr.font = Data->Font; 
			ListData->MenuListsAttr.items = Data->List;
			ListData->MenuListsAttr.nItems = Data->ListLength;

			ListData->MenuData.ListMenuFlag=Data->ListMenuFlag;
			ListData->MenuData.ListMenuHeadStr=Data->ListMenuHeadStr;
	
			/*
			 * Intialize List Menu Data
			 */

			/* view listmenu with title */
			ListData->MenuData.Attr = &ListData->MenuListsAttr;	/* copy pointer*/   
			ListData->MenuData = *Data;	/* copy contents */
			if (ListData->MenuData.ListMenuFlag)
				ListData->MenuLists = mnuListCreate(winLists,&ListData->MenuListsAttr, /* copy pointer*/
													E_MNU_SELECT | E_MNU_ESCAPE, 
													(MfwCb)listsListCbMenu, ListData->MenuData.ListMenuHeadStr);//创建带头的动态菜单
			else
				ListData->MenuLists	= mnuCreate(winLists,&ListData->MenuListsAttr, /* copy pointer*/
												E_MNU_SELECT | E_MNU_ESCAPE, 
												(MfwCb)listsListCbMenu);//创建动态菜单
			ListData->MenuData.win = winLists;
			Data->win = winLists;
			mnuScrollMode(ListData->MenuLists,0);
			if (Data->Strings)
				mnuLang (ListData->MenuLists,0);
			else
				mnuLang	(ListData->MenuLists,mainMmiLng);

			//GW??? Set up whether menu uses strings or ID's
			if (inUnicode != 0)
				mnuStrType(ListData->MenuLists,mainMmiLng);	/* Unicode display */
			mnuChooseVisibleItem(ListData->MenuLists, Data->ListPosition-1);
			mnuUnhide(ListData->MenuLists);
			TRACE_FUNCTION ("mmiList winShow()");
			winShow(winLists);
			return(T_MFW)ListData->MenuLists;  
		}
	}

	return Status;
}


/*******************************************************************************

 $Function:  listsKeyEvent  

 $Description:	list keyboard event handler

 $Returns:		none.

 $Arguments:	
 
*******************************************************************************/
static int listsKeyEvent (MfwEvt e, MfwKbd *k) 
{
	T_MFW_HND    win  = mfwParent(mfw_header());
	T_MFW_WIN  * win_data = ((T_MFW_HDR *)win)->data;
	ListWinInfo      * data = (ListWinInfo *)win_data->user;
	MfwMnu *MenuHandle;

	TRACE_EVENT("listsKeyEvent()");

	if (!(e & KEY_MAKE))
	{
		return MFW_EVENT_CONSUMED;
	}


	if (e & KEY_LONG)
	{
		switch (k->code)
		{
		case KCD_HUP: /* back to previous menu */
			mnuEscape(data->MenuLists);
			break;
		case KCD_RIGHT:	/* Power Down */
			return MFW_EVENT_PASSED; /* handled by idle */
		default: /* no response to all other keys */
			return MFW_EVENT_CONSUMED;
		}
	}
	else
	{
		switch (k->code)
		{
		case KCD_MNUUP:	/* highlight previous entry */
			// Only required in melody list selection.
			if (data->Parent==GetWindowHandle()||data->Parent==GetCallWindowHandle())
			{
				data->ExitReason = LISTS_REASON_UP;
				data->MenuData.Reason = LISTS_REASON_UP;
				MenuHandle = mfwControl(data->MenuLists);
				data->MenuData.CursorPosition = MenuHandle->lCursor[MenuHandle->level];
				data->MenuData.ListPosition  = MenuHandle->lCursor[MenuHandle->level]; /* True cursor position in list menu. */
				data->Callback(data->Parent, &data->MenuData);              
			}
			else if (getMelodyListStatus()== TRUE)
			{
				mnuUp(data->MenuLists);
				MenuHandle = mfwControl(data->MenuLists);

				data->MenuData.Reason = LISTS_REASON_SCROLL;
				data->MenuData.CursorPosition = MenuHandle->lCursor[MenuHandle->level];
				data->MenuData.ListPosition  = MenuHandle->lCursor[MenuHandle->level];
				//currentring = data->MenuData.ListPosition;  
				SEND_EVENT(data->Parent,E_START_MELODY,0,(void*)data);          
			}
			else if (GetSMSLISTWINHandle())
			{
				mnuUp(data->MenuLists);
				MenuHandle = mfwControl(data->MenuLists);
				data->MenuData.Reason = LISTS_REASON_UP;
				data->MenuData.CursorPosition = MenuHandle->lCursor[MenuHandle->level];
				data->MenuData.ListPosition  = MenuHandle->lCursor[MenuHandle->level]; /* True cursor position in list menu. */
				data->Callback(data->Parent, &data->MenuData);              
			}
#ifdef _MMS_ENABLE_
			else if (data->Parent == MMS_Get_MMSImageMusic_WHnd()) //added by xie 04-07-15
			{
				mnuUp(data->MenuLists);
				MenuHandle = mfwControl(data->MenuLists);
				data->MenuData.Reason = LISTS_REASON_UP;
				data->MenuData.CursorPosition = MenuHandle->lCursor[MenuHandle->level];
				data->MenuData.ListPosition  = MenuHandle->lCursor[MenuHandle->level]; /* True cursor position in list menu. */
				data->Callback(data->Parent, &data->MenuData);    
			}
#endif
			else
			{
				mnuUp(data->MenuLists);
				//  winShow(win);
			}                       
			break;

		case KCD_MNUDOWN: /* highlight next entry */
			if (data->Parent==GetWindowHandle()||data->Parent==GetCallWindowHandle())
			{
				TRACE_EVENT("in phb");
				data->ExitReason = LISTS_REASON_DOWN;
				data->MenuData.Reason = LISTS_REASON_DOWN;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -