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

📄 cxlcdnew.c

📁 多级菜单实现
💻 C
📖 第 1 页 / 共 2 页
字号:
		if(iMenuNextID==Menu_RootID[cMenuTemp1])
			{
			DispTextLine(cMenuTemp1+1,&Menu_Root[cMenuTemp1][0],0);
			}
		else
			{
			DispTextLine(cMenuTemp1+1,&Menu_Root[cMenuTemp1][0],1);
			}
		}
	else
		{
		DispTextLine(cMenuTemp1+1,&MenuNULL[0],1);
		}
	}
}
//
void DispMenu_View()
{
for(cMenuTemp1=0;cMenuTemp1<7;cMenuTemp1++)
	{
	if(cMenuTemp1<2)
		{
		if(iMenuNextID==Menu_ViewID[cMenuTemp1])
			{
			DispTextLine(cMenuTemp1+1,&Menu_View[cMenuTemp1][0],0);
			}
		else
			{
			DispTextLine(cMenuTemp1+1,&Menu_View[cMenuTemp1][0],1);
			}
		}
	else
		{
		DispTextLine(cMenuTemp1+1,&MenuNULL[0],1);
		}
	}

}
void DispMenu_Operation()
{
for(cMenuTemp1=0;cMenuTemp1<7;cMenuTemp1++)
	{
	if(cMenuTemp1<5)
		{
		if(iMenuNextID==Menu_OperationID[cMenuTemp1])
			{
			DispTextLine(cMenuTemp1+1,&Menu_Operation[cMenuTemp1][0],0);
			}
		else
			{
			DispTextLine(cMenuTemp1+1,&Menu_Operation[cMenuTemp1][0],1);
			}
		}
	else
		{
		DispTextLine(cMenuTemp1+1,&MenuNULL[0],1);
		}
	}


}
void DispMenu_Test()
{
for(cMenuTemp1=0;cMenuTemp1<7;cMenuTemp1++)
	{
	if(cMenuTemp1<2)
		{
		if(iMenuNextID==Menu_TestID[cMenuTemp1])
			{
			DispTextLine(cMenuTemp1+1,&Menu_Test[cMenuTemp1][0],0);
			}
		else
			{
			DispTextLine(cMenuTemp1+1,&Menu_Test[cMenuTemp1][0],1);
			}
		}
	else
		{
		DispTextLine(cMenuTemp1+1,&MenuNULL[0],1);
		}
	}

}
void DispMenu_SystemSet()
{
for(cMenuTemp1=0;cMenuTemp1<7;cMenuTemp1++)
	{
	if(cMenuTemp1<2)
		{
		if(iMenuNextID==Menu_SystemSetID[cMenuTemp1])
			{
			DispTextLine(cMenuTemp1+1,&Menu_SystemSet[cMenuTemp1][0],0);
			}
		else
			{
			DispTextLine(cMenuTemp1+1,&Menu_SystemSet[cMenuTemp1][0],1);
			}
		}
	else
		{
		DispTextLine(cMenuTemp1+1,&MenuNULL[0],1);
		}
	}

}
void DispMenu_Debug()
{
for(cMenuTemp1=0;cMenuTemp1<7;cMenuTemp1++)
	{
	if(cMenuTemp1<2)
		{
		if(iMenuNextID==Menu_DebugID[cMenuTemp1])
			{
			DispTextLine(cMenuTemp1+1,&Menu_Debug[cMenuTemp1][0],0);
			}
		else
			{
			DispTextLine(cMenuTemp1+1,&Menu_Debug[cMenuTemp1][0],1);
			}
		}
	else
		{
		DispTextLine(cMenuTemp1+1,&MenuNULL[0],1);
		}
	}

}

void MenuFunctionNull()
{
	_nop_();
}
//
void MenuFunctionDemo1()//
{
DispOneBoxTextChar(8,1,'W',0);//
DispOneBoxTextChar(8,2,'e',0);
DispOneBoxTextChar(8,3,'l',0);
DispOneBoxTextChar(8,4,'c',0);
DispOneBoxTextChar(8,5,'o',0);
DispOneBoxTextChar(8,6,'m',0);
DispOneBoxTextChar(8,7,'e',0);
DispOneBoxTextChar(8,8,' ',0);//
DispOneBoxTextChar(8,9,'Y',0);
DispOneBoxTextChar(8,10,'o',0);
DispOneBoxTextChar(8,11,'u',0);
DispOneBoxTextChar(8,12,' ',0);
DispOneBoxTextChar(8,13,'!',0);
DispOneBoxTextChar(8,14,' ',0);
}
//
void MenuFunctionDemo2()//
{
DispOneBoxTextChar(8,1,'>',0);
DispOneBoxTextChar(8,2,'>',0);
DispOneBoxTextChar(8,3,'>',0);
DispOneBoxTextChar(8,4,' ',1);
DispOneBoxTextChar(8,5,' ',1);
DispOneBoxTextChar(8,6,' ',1);
DispOneBoxTextChar(8,7,' ',1);
DispOneBoxTextChar(8,8,' ',1);
DispOneBoxTextChar(8,9,' ',1);
DispOneBoxTextChar(8,10,' ',1);
DispOneBoxTextChar(8,11,' ',1);
DispOneBoxTextChar(8,12,' ',1);
DispOneBoxTextChar(8,13,' ',1);
DispOneBoxTextChar(8,14,' ',1);
}
//
void MenuFunctionDemo3()//
{
DispOneBoxTextChar(8,1,'>',0);
DispOneBoxTextChar(8,2,'>',0);
DispOneBoxTextChar(8,3,'>',0);
DispOneBoxTextChar(8,4,' ',1);
DispOneBoxTextChar(8,5,' ',1);
DispOneBoxTextChar(8,6,' ',1);
DispOneBoxTextChar(8,7,' ',1);
DispOneBoxTextChar(8,8,' ',1);
DispOneBoxTextChar(8,9,' ',1);
DispOneBoxTextChar(8,10,' ',1);
DispOneBoxTextChar(8,11,' ',1);
DispOneBoxTextChar(8,12,' ',1);
DispOneBoxTextChar(8,13,' ',1);
DispOneBoxTextChar(8,14,' ',1);
}
//
void MenuFunctionDemo4()
{
DispOneBoxTextChar(8,1,' ',1);
DispOneBoxTextChar(8,2,' ',1);
DispOneBoxTextChar(8,3,' ',1);
DispOneBoxTextChar(8,4,' ',1);
DispOneBoxTextChar(8,5,' ',1);
DispOneBoxTextChar(8,6,' ',1);
DispOneBoxTextChar(8,7,' ',1);
DispOneBoxTextChar(8,8,' ',1);
DispOneBoxTextChar(8,9,' ',1);
DispOneBoxTextChar(8,10,' ',1);
DispOneBoxTextChar(8,11,' ',1);
DispOneBoxTextChar(8,12,'<',0);
DispOneBoxTextChar(8,13,'<',0);
DispOneBoxTextChar(8,14,'<',0);
}
//
void MenuFunctionDemo5()//
{
DispOneBoxTextChar(8,1,' ',1);
DispOneBoxTextChar(8,2,' ',1);
DispOneBoxTextChar(8,3,' ',1);
DispOneBoxTextChar(8,4,' ',1);
DispOneBoxTextChar(8,5,' ',1);
DispOneBoxTextChar(8,6,' ',1);
DispOneBoxTextChar(8,7,' ',1);
DispOneBoxTextChar(8,8,' ',1);
DispOneBoxTextChar(8,9,' ',1);
DispOneBoxTextChar(8,10,' ',1);
DispOneBoxTextChar(8,11,' ',1);
DispOneBoxTextChar(8,12,'<',0);
DispOneBoxTextChar(8,13,'<',0);
DispOneBoxTextChar(8,14,'<',0);
}
//
void MenuFunctionDemo6()//
{
DispOneBoxTextChar(8,1,'>',0);
DispOneBoxTextChar(8,2,'>',0);
DispOneBoxTextChar(8,3,'>',0);
DispOneBoxTextChar(8,4,' ',1);
DispOneBoxTextChar(8,5,' ',1);
DispOneBoxTextChar(8,6,' ',1);
DispOneBoxTextChar(8,7,' ',1);
DispOneBoxTextChar(8,8,' ',1);
DispOneBoxTextChar(8,9,' ',1);
DispOneBoxTextChar(8,10,' ',1);
DispOneBoxTextChar(8,11,' ',1);
DispOneBoxTextChar(8,12,' ',1);
DispOneBoxTextChar(8,13,' ',1);
DispOneBoxTextChar(8,14,' ',1);
}
//
void MenuFunctionDemo7()//
{
DispOneBoxTextChar(8,1,' ',1);
DispOneBoxTextChar(8,2,' ',1);
DispOneBoxTextChar(8,3,' ',1);
DispOneBoxTextChar(8,4,' ',1);
DispOneBoxTextChar(8,5,' ',1);
DispOneBoxTextChar(8,6,' ',1);
DispOneBoxTextChar(8,7,' ',1);
DispOneBoxTextChar(8,8,' ',1);
DispOneBoxTextChar(8,9,' ',1);
DispOneBoxTextChar(8,10,' ',1);
DispOneBoxTextChar(8,11,' ',1);
DispOneBoxTextChar(8,12,'<',0);
DispOneBoxTextChar(8,13,'<',0);
DispOneBoxTextChar(8,14,'<',0);
}
//
void MenuFunctionDemo8()//
{
DispOneBoxTextChar(8,1,' ',1);
DispOneBoxTextChar(8,2,' ',1);
DispOneBoxTextChar(8,3,' ',1);
DispOneBoxTextChar(8,4,' ',1);
DispOneBoxTextChar(8,5,' ',1);
DispOneBoxTextChar(8,6,' ',1);
DispOneBoxTextChar(8,7,' ',1);
DispOneBoxTextChar(8,8,' ',1);
DispOneBoxTextChar(8,9,' ',1);
DispOneBoxTextChar(8,10,' ',1);
DispOneBoxTextChar(8,11,' ',1);
DispOneBoxTextChar(8,12,'<',0);
DispOneBoxTextChar(8,13,'<',0);
DispOneBoxTextChar(8,14,'<',0);
}
//
void JudgeHLight()
{
switch(iMenuNextID)
	{
	case	MENU_FACE:
			DispFaceBmp();
			break;
	case	MENU_ROOT:
			DispFaceBmp();
			break;
	case	MENU_VIEW:
			DispMenu_Root();
			break;
	case	MENU_VIEW_ABOUTRECORDE:
	case	MENU_VIEW_HANDSETCLOCK:
			DispMenu_View();
			break;
	case	MENU_OPERATION:
			DispMenu_Root();
			break;
	case	MENU_OPERATION_SETPOSITION:
	case	MENU_OPERATION_READZJTOFLASH:
	case	MENU_OPERATION_RDZJTORAM:
	case	MENU_OPERATION_DELGIVENZL:
	case	MENU_OPERATION_DELALLZJ:
			DispMenu_Operation();
			break;
	case	MENU_TEST:
			DispMenu_Root();
			break;
	case	MENU_TEST_RAMTEST:
	case	MENU_TEST_FLASHTEST:
			DispMenu_Test();
			break;
	case	MENU_SYSTEMSET:
			DispMenu_Root();
			break;
	case	MENU_SYSTEMSET_DEBUG:
			DispMenu_SystemSet();
			break;
	case	MENU_SYSTEMSET_DEBUG_PASSWORD:
	case	MENU_SYSTEMSET_DEBUG_SEEPICTURE:
			DispMenu_Debug();
			break;
	case	MENU_SYSTEMSET_SETHANDCLK:
			DispMenu_SystemSet();
			break;
	default:
			break;
	}

}
//
void ShowDesktopTime()
{
		DispTwoBoxHexChar(1,7,cClock_Year,S_ZS|1);
		DispOneBoxTextChar(1,9,'/',S_S+1);
		DispTwoBoxHexChar(1,10,cClock_Month,S_S|1);
		DispOneBoxTextChar(1,12,'/',S_S+1);
		DispTwoBoxHexChar(1,13,cClock_Day,S_YS|1);
		//
		DispTwoBoxHexChar(2,7,cClock_Hour,S_ZX|1);
		DispOneBoxTextChar(2,9,':',S_X+1);
		DispTwoBoxHexChar(2,10,cClock_Minute,S_X|1);
		DispOneBoxTextChar(2,12,':',S_X+1);
		DispTwoBoxHexChar(2,13,cClock_Second,S_YX|1);
}

void DispFaceBmp()
{
   
}

void ReadyForKey()
    {
        KEYROW1=0;
        KEYROW2=0;
        KEYROW3=0;
        //KEYINT=1;
    }
void DelayMs(unsigned int iMs)
{
  
}

//
//************************************************************************
//* Menu Struct:                                                         *
//************************************************************************
//* First Bmp--------------------->(MenuID=0)                            *
//*  ---+                                                                *
//*     |View--------------------->(MenuID=1)                            *
//*     +---+                                                            *
//*     |   |About Recorde-------->(MenuID=2)                            *
//*     |   +--------------                                              *
//*     |   |HandSet Clock-------->(MenuID=3)                            *
//*     |   +--------------                                              *
//*     |Operation---------------->(MenuID=4)                            *
//*     +---+                                                            *
//*     |   |Set Position--------->(MenuID=5)                            *
//*     |   +--------------                                              *
//*     |   |Rd Zj To Flash------->(MenuID=6)                            *
//*     |   +--------------                                              *
//*     |   |Rd Zl To Ram--------->(MenuID=7)                            *
//*     |   +--------------                                              *
//*     |   |Del Given Zl--------->(MenuID=8)                            *
//*     |   +--------------                                              *
//*     |   |Del All Zl----------->(MenuID=9)                            *
//*     |   +--------------                                              *
//*     |Test--------------------->(MenuID=10)                           *
//*     +---+                                                            *
//*     |   |Ram Test------------->(MenuID=11)                           *
//*     |   +--------------                                              *
//*     |   |Flash Test----------->(MenuID=12)                           *
//*     |   +--------------                                              *
//*     |System Set--------------->(MenuID=13)                           *
//*     +---+                                                            *
//*         |Debug---------------->(MenuID=14)                           *
//*         +---+                                                        *
//*         |   |PassWord--------->(MenuID=15)                           *
//*         |   +--------------                                          *
//*         |   |See Picture------>(MenuID=16)                           *
//*         |   +--------------                                          *
//*         |Set Hand Clk--------->(MenuID=17)                           *
//*         +--------------                                              *
//************************************************************************
//CurMenuID=本菜单ID
//MaxMenuItem=同级菜单最大项数
//OkMenuID=子菜单层所对应的菜单ID,ID=999为菜单已经到底了
//EscMenuID=父菜单层所对应的菜单ID,ID=999为菜单已经到顶了
//DownMenuID=弟菜单层所对应的菜单ID,ID=999为菜单是独生子
//UpMenuID=兄菜单层所对应的菜单ID,ID=999为菜单是独生子
//CurFunction=本菜单所对应的菜单函数指针
KeyTabStruct xdata KeyTab[MAX_KEYTABSTRUCT_NUM]=
	{
		//CurMenuID,			  MaxMenuItem,	OkMenuID,						EscMenuID,				DownMenuID,							UpMenuID,							CurFunction
		{MENU_FACE,							0,	MENU_ROOT,						999,					999,								999,								*MenuFunctionDemo1},
		{MENU_ROOT,							4,	MENU_VIEW,						MENU_FACE,			    MENU_OPERATION,						MENU_SYSTEMSET,						*MenuFunctionDemo2},
		{MENU_VIEW,							2,	MENU_VIEW_ABOUTRECORDE,			MENU_ROOT,				MENU_OPERATION,				        MENU_SYSTEMSET,						*MenuFunctionDemo3},
		{MENU_VIEW_ABOUTRECORDE,			0,	999,							MENU_VIEW,				MENU_VIEW_HANDSETCLOCK,				MENU_VIEW_HANDSETCLOCK,				*MenuFunctionDemo4},
		{MENU_VIEW_HANDSETCLOCK,			0,	999,							MENU_VIEW,				MENU_VIEW_ABOUTRECORDE,				MENU_VIEW_ABOUTRECORDE,				*MenuFunctionDemo5},
		{MENU_OPERATION,					5,	MENU_OPERATION_SETPOSITION,		MENU_ROOT,				MENU_TEST,                  		MENU_VIEW,							*MenuFunctionDemo6},
		{MENU_OPERATION_SETPOSITION,		0,	999,							MENU_OPERATION,			MENU_OPERATION_READZJTOFLASH,		MENU_OPERATION_DELALLZJ,			*MenuFunctionDemo7},
		{MENU_OPERATION_READZJTOFLASH,		0,	999,							MENU_OPERATION,			MENU_OPERATION_RDZJTORAM,			MENU_OPERATION_SETPOSITION,			*MenuFunctionDemo8},
		{MENU_OPERATION_RDZJTORAM,			0,	999,							MENU_OPERATION,			MENU_OPERATION_DELGIVENZL,			MENU_OPERATION_READZJTOFLASH,		*MenuFunctionDemo9},
		{MENU_OPERATION_DELGIVENZL,			0,	999,							MENU_OPERATION,			MENU_OPERATION_DELALLZJ,			MENU_OPERATION_RDZJTORAM,			*MenuFunctionDemo10},
		{MENU_OPERATION_DELALLZJ,			0,	999,							MENU_OPERATION,			MENU_OPERATION_SETPOSITION,			MENU_OPERATION_DELGIVENZL,			*MenuFunctionDemo11},
		{MENU_TEST,							2,	MENU_TEST_RAMTEST,				MENU_ROOT,				MENU_SYSTEMSET,     				MENU_OPERATION,						*MenuFunctionDemo12},
		{MENU_TEST_RAMTEST,					0,	999,							MENU_TEST,				MENU_TEST_FLASHTEST,				MENU_TEST_FLASHTEST,				*MenuFunctionDemo13},
		{MENU_TEST_FLASHTEST,				0,	999,							MENU_TEST,				MENU_TEST_RAMTEST,					MENU_TEST_RAMTEST,					*MenuFunctionDemo14},
		{MENU_SYSTEMSET,					2,	MENU_SYSTEMSET_DEBUG,			MENU_ROOT,				MENU_VIEW,              			MENU_TEST,							*MenuFunctionDemo15},
		{MENU_SYSTEMSET_DEBUG,				2,	MENU_SYSTEMSET_DEBUG_PASSWORD,	MENU_SYSTEMSET,			MENU_SYSTEMSET_SETHANDCLK,			MENU_SYSTEMSET_SETHANDCLK,			*MenuFunctionDemo16},
		{MENU_SYSTEMSET_DEBUG_PASSWORD,		0,	999,							MENU_SYSTEMSET_DEBUG,	MENU_SYSTEMSET_DEBUG_SEEPICTURE,	MENU_SYSTEMSET_DEBUG_SEEPICTURE,	*MenuFunctionDemo17},
		{MENU_SYSTEMSET_DEBUG_SEEPICTURE,	0,	999,							MENU_SYSTEMSET_DEBUG,	MENU_SYSTEMSET_DEBUG_PASSWORD,		MENU_SYSTEMSET_DEBUG_PASSWORD,		*MenuFunctionDemo18},
		{MENU_SYSTEMSET_SETHANDCLK,			0,	999,							MENU_SYSTEMSET,			MENU_SYSTEMSET_DEBUG,				MENU_SYSTEMSET_DEBUG,				*MenuFunctionDemo19}
	};

⌨️ 快捷键说明

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