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

📄 mmibookmenuwindow.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 3 页
字号:
			}
			else
		#endif
		
				mnuEscape( data->menu );

			if (stopw_win)
			{
				SEND_EVENT(stopw_win, STOPW_EXIT, 0, 0);
			}

			// Return the menu scroll behavior to normal.
			if (getScrollSelectMenuItem() == TRUE)
			{
				clearScrollSelectMenuItem();
			}

			/*
				If user exits the volume settings menu from the Idle or Incoming call screen.
				clear the soundsReason.
			*/
			if (getSoundsReason() == SettingVolume)
				setSoundsReason(SoundsNone);

		}
		break;
	case KCD_1:
	case KCD_2:
	case KCD_3:
	case KCD_4:
	case KCD_5:
	case KCD_6:
	case KCD_7:
	case KCD_8:
	case KCD_9:
		mnuKeyAction(data->menu, k->code);
		break;
#if 0
	case KCD_STAR:
		{
			U8 uMode;           
			/*
			 * Keypadlock will lock only 
			 * within two seconds by press "*"
			 */         
			if (data->status_of_timer EQ FALSE)
			{
//				uMode = dspl_Enable(0);
				TRACE_FUNCTION ("activate KEYpadLOCK");
				mnuEscape( data->menu );
//				settingsKeyPadLockOn ();zy 01/23/2003 avoid begin keypad
//				dspl_Enable(uMode);
			}

		}
		break;

	case KCD_HASH:
		{
			U8 uMode;           
			/*
			 * Keypadlock will lock only 
			 * within two seconds by press "*"
			 */         
			if (data->status_of_timer EQ FALSE)
			{
//				uMode = dspl_Enable(0);
				TRACE_FUNCTION ("activate Silent mode");

				if (FFS_flashData.settings_status & SettingsSilentMode)
				{
					//settingsSilentModeOff();zy change 09/27 still not use
				}
				else
				{
					//settingsSilentModeOn();
				}
				mnuEscape( data->menu );
//				dspl_Enable(uMode);
			}

		}
		break;
#endif
	default:
#if 0
		{
			// SH - only allow dialling if we are in the main menu
			if (window == data->phbk->menu_main_win)
			{
				U8 keycode;
				U8 uMode;           
				uMode = dspl_Enable(0);
				/* no action required
				*/
				// keypadLock will not activate anymore
				data->status_of_timer = TRUE;       

				/* Number key presses in phonebook menu returns user to idle screen, 
				   add key press to Idle edit screen. */

				keycode = k->code;

				bookMenuDestroy(data->win);

				if (k->code>=KCD_0 && k->code<=KCD_9)
				{
					SEND_EVENT(idle_get_window(), IDLE_START_DIALLING_NUMBER, 0, &keycode);
				}


				dspl_Enable(uMode);
			}
		}
#endif
		break;
	}

	/* always consume the event
	*/
	return MFW_EVENT_CONSUMED;
}







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

 $Function:    	bookMenuKbdLongCB

 $Description:	keyboard long press event handler
 
 $Returns:		MFW_EVENT_CONSUMED always

 $Arguments:	e, event, k, key handle
 
*******************************************************************************/

static int bookMenuKbdLongCB( MfwEvt e, MfwKbd *k )
{
	T_MFW_HND       window      = mfwParent( mfw_header() );
	T_MFW_WIN       *win_data   = ((T_MFW_HDR *)window)->data;
	tBookStandard   *data       = (tBookStandard *) win_data->user;

	TRACE_EVENT( "bookMenuKbdLongCB()" );

	if (( e & KEY_CLEAR ) && ( e & KEY_LONG ))
	{
		mnuEscape( data->menu );
		return MFW_EVENT_CONSUMED;
	}
	/*if long press on END key*/
	if (( e & KEY_HUP) && ( e & KEY_LONG ))
	{
		U8 keycode;
		U8 uMode;           
//			uMode = dspl_Enable(0);

		// keypadLock will not activate anymore
		data->status_of_timer = TRUE;       

		//return to idle screen

		keycode = k->code;

		if (data->Callback)
			(data->Callback) (data->parent_win, NULL, NULL);

		bookMenuDestroy(data->win);
		stopRingerVolSettingInactivityTimer();

		SEND_EVENT(idle_get_window(), IDLE_UPDATE, 0, &keycode);

//			dspl_Enable(uMode);
	}

	return MFW_EVENT_CONSUMED;
}






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

 $Function:    	bookMenuCreate

 $Description:	Create the menu window
 
 $Returns:		handle of newly created window, or NULL if error

 $Arguments:	parent, handle of the parent window
 
*******************************************************************************/

static T_MFW_HND bookMenuCreate( MfwHnd parent )
{
	T_MFW_WIN       *parent_win_data = ( (T_MFW_HDR *) parent )->data;
	T_phbk          *phbk = (T_phbk *)parent_win_data->user;
	T_MFW_WIN       *win_data;
	tBookStandard   *data;

	TRACE_FUNCTION( "bookMenuCreate()" );

	/* allocate memory for our control block
	*/
	if (( data = (tBookStandard *) ALLOC_MEMORY( sizeof( tBookStandard ) ) ) == NULL)
		return NULL;

	/* Create the window if we can
	*/
	if (( data->win = win_create( parent, 0, E_WIN_VISIBLE, (T_MFW_CB) bookMenuWindowCB ) ) == NULL)
	{
		FREE_MEMORY( (void *)data, sizeof( tBookStandard ) );
		return NULL;
	}
#if(MAIN_LCD_SIZE==3)
    phonebook_search_flag=FALSE;
#endif
	/* Okay, we have created the control block and the window, so
	   we now need to configure the dialog and data pointers
	*/
	data->mmi_control.dialog    = (T_DIALOG_FUNC) bookMenuDialog;
	data->mmi_control.data      = data;
	win_data                    = ((T_MFW_HDR *)data->win)->data;
	win_data->user              = (void *) data;
	data->phbk                  = phbk;
	data->parent_win            = parent;

	/* create keyboards and menus for our window
	*/
	data->kbd       = kbdCreate  ( data->win, KEY_ALL,            (MfwCb) bookMenuKbdCB );
	data->kbd_long  = kbdCreate  ( data->win, KEY_ALL | KEY_LONG, (MfwCb) bookMenuKbdLongCB );
	data->menu_tim  = tim_create (data->win, THREE_SECS,          (MfwCb) bookMenuTimCB);

	data->Callback = NULL;						// Use standard menu callback (changed by sending event ADD_CALLBACK)

	/* And return the handle of the newly created window
	*/
	return data->win;
}





/*******************************************************************************
																			  
								Public Methods
																			  
*******************************************************************************/

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

 $Function:     bookMenuStart

 $Description:	tbd
 
 $Returns:		tbd

 $Arguments:	tbd
 
*******************************************************************************/

T_MFW_HND bookMenuStart( MfwHnd parent, MfwMnuAttr *menuAttr,SHORT reason )
{
	T_MFW_HND win;

	if (( win = bookMenuCreate( parent ) ) != NULL)
		SEND_EVENT( win, MENU_INIT, reason, (MfwMnuAttr *) menuAttr );
	return win;
}



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

 $Function:    	bookMenuDestroy

 $Description:	Destroy the menu window 
 
 $Returns:		none

 $Arguments:	window, handle of the window being destroyed
 
*******************************************************************************/

void bookMenuDestroy( MfwHnd window )
{
	T_MFW_WIN       *win_data   = ((T_MFW_HDR *)window)->data;
	tBookStandard   *data       = (tBookStandard *) win_data->user;
	char            test_string[40];

	TRACE_FUNCTION( "bookMenuDestroy()" );

	if (data)
	{

		/* If we have the root window here then we use the main phone
		   book destroy method
		*/
		if (data->phbk->root_win == window)
		{
			bookPhonebookDestroy( data->phbk->win );
			return;
		}

		/* Otherwise clear down our pointers and free the current
		   menu window structures
		*/
		if (data->phbk->search_win == window)
			data->phbk->search_win = 0;
		if (data->phbk->menu_main_win == window)
			data->phbk->menu_main_win = 0;
		if (data->phbk->menu_options_win == window)
			data->phbk->menu_options_win = 0;
		if (data->phbk->menu_options_win_2 == window)
			data->phbk->menu_options_win_2 = 0;
		if (data->phbk->menu_call_options_win == window)
			data->phbk->menu_call_options_win = 0;
		if (data->phbk->menu_call_options_win_2 == window)
			data->phbk->menu_call_options_win_2 = 0;

		winDelete( data->win );

		FREE_MEMORY( (void *)data, sizeof( tBookStandard ) );
		sprintf(test_string, "Bookmenudestroy: %d", mfwCheckMemoryLeft());
		TRACE_FUNCTION(test_string);
	}

}


/******************************************************************************
yq add for return to idle
******************************************************************************/
int  returntoidle(int halloff)
{
	/* 2004/07/09 sunsj add for forbidden hall off */
	T_SAT_RES sat_res;

#ifdef QQFUNC
	if (anim_real_complete&&!In_QQ)
#else
	if (anim_real_complete)
#endif
	{
		if (!call_data.win)
		{
			if (menutype == PhbkHostkeyList) 
			{
				menutype = 0; 
				//flash_hostread();
			}
			else if (menutype == PhbkHostkeyOnOffList)
			{
				menutype = 0; 
				flash_hostread();
			}

			if (winIsFocussed(idle_data.win))
				return 1;
		#ifdef MMI_WAP_ENABLED
			if (wap_main_window)
				return 0;
		#endif
			/* 2004/07/09 sunsj modify for exit simtoolkit through hall off */
			if (g_SATsession_is_active)
			{
				sat_destroy();
				//return 0;
			}

			show_timer=0;
			edt_timer=0;
			ClearWindowHandle();
			SetPhbkIN(0);
			//if(!halloff)					//2004.1.12 WYJ not hall off  
			//Stopplayingdevice();			//MI18800000126
			gPlayKeytoneFlag = 1;
			MC_StopVibra();		// 2004.4.16 WYJ add
			
			//2004.08.02 Added by Cathy for Camera
			#ifdef CAMERA_ENABLED
		        CamExit();
			#endif

			cm_force_disconnect();
			call_data.ignore_disconnect=TRUE;
			soundReasonSmsTone(NULL,NULL,NULL);
			AllowPredText = FALSE;
			g_norejectkeyflag=0;
			editDeactivate();
			ec_editDeactivate();
			winFocusShow(idle_data.win);

			return 1;
		}
	}
	return 0;
}


/*******************************************************************************
																			  
								End of File
																			  
*******************************************************************************/

⌨️ 快捷键说明

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