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

📄 eeb_mainpage.cpp

📁 基于ARM平台的控制系统,自己带有MINIGUI,可以直接在VC下运行界面演示程序
💻 CPP
字号:
#include <stdio.h>

#include "eeb.h"

#include "eeb_LinkWnd.h"
#include "eeb_SoftKeyBoard.h"
#include "eeb_AppWnd.h"
#include "eeb_MainPage.h"

NANA_SoftKeyBoard *	pSOKB;
NANAMessageBox	  * pMSGBOX;	
SYSINFO			    g_SysInfo;
WarningList          *g_pWarningList;


void NANA_MainMenuWnd::OnCreate ()
{
	NANA_LinkedWnd::OnCreate();

	w_list.CreateWnd(this,0,30,320,209,UGWS_VISIBLE);
    w_list.w_style = LIST_STYLE_ICON;
    
    w_pliCompressorLT = new NANAListIconItem();
    w_pliCompressorLT->SetParentList((NANAListBase *)&w_list);
    w_list.AddItem((NANAListItemBase *)w_pliCompressorLT);
	w_pliCompressorLT->SetItemFont(&NANA_FONT12);
	w_pliCompressorLT->SetItemIcon(ICON32_COMPRESSOR);
	w_pliCompressorLT->SetItemData(LOWTEMP_COMPRESSOR);
    w_pliCompressorLT->SetItemTextID(strMenuLT);

    w_pliCompressorMT = new NANAListIconItem();
    w_pliCompressorMT->SetParentList((NANAListBase *)&w_list);
	w_list.AddItem((NANAListItemBase *)w_pliCompressorMT);
	w_pliCompressorMT->SetItemFont(&NANA_FONT12);
	w_pliCompressorMT->SetItemIcon(ICON32_COMPRESSOR);
	w_pliCompressorMT->SetItemData(MIDTEMP_COMPRESSOR);
    w_pliCompressorMT->SetItemTextID(strMenuMT);

    w_pliCooler = new NANAListIconItem();
    w_pliCooler->SetParentList((NANAListBase *)&w_list);
    w_list.AddItem((NANAListItemBase *)w_pliCooler);
	w_pliCooler->SetItemFont(&NANA_FONT12);
	w_pliCooler->SetItemIcon(ICON32_FAN);
	w_pliCooler->SetItemData(COOLER);
    w_pliCooler->SetItemTextID(strMenuCooler);
    
    w_pliColder = new NANAListIconItem();
    w_pliColder->SetParentList((NANAListBase *)&w_list);
    w_list.AddItem((NANAListItemBase *)w_pliColder);
	w_pliColder->SetItemFont(&NANA_FONT12);
	w_pliColder->SetItemIcon(ICON32_OVERCOLD);
	w_pliColder->SetItemData(OVER_COOLER);
    w_pliColder->SetItemTextID(strMenuColder);
    
    
    w_pliWarnning = new NANAListIconItem();
    w_pliWarnning->SetParentList((NANAListBase *)&w_list);
    w_list.AddItem((NANAListItemBase *)w_pliWarnning);
	w_pliWarnning->SetItemFont(&NANA_FONT12);
	w_pliWarnning->SetItemIcon(ICON32_WARNNING);
	w_pliWarnning->SetItemData(WARNING);
    w_pliWarnning->SetItemTextID(strMenuWaring);
    
    w_pliSensor = new NANAListIconItem();
    w_pliSensor->SetParentList((NANAListBase *)&w_list);
    w_list.AddItem((NANAListItemBase *)w_pliSensor);
	w_pliSensor->SetItemFont(&NANA_FONT12);
	w_pliSensor->SetItemIcon(ICON32_SENSOR);
	w_pliSensor->SetItemData(SENSOR);
    w_pliSensor->SetItemTextID(strMenuSensor);
    
    w_pliUserPass = new NANAListIconItem();
    w_pliUserPass->SetParentList((NANAListBase *)&w_list);
    w_list.AddItem((NANAListItemBase *)w_pliUserPass);
	w_pliUserPass->SetItemFont(&NANA_FONT12);
	w_pliUserPass->SetItemIcon(ICON32_USERPASS);
	w_pliUserPass->SetItemData(PASSWORD);
    w_pliUserPass->SetItemTextID(strMenuPassword);
    
    w_pliNetwork = new NANAListIconItem();
    w_pliNetwork->SetParentList((NANAListBase *)&w_list);
    w_list.AddItem((NANAListItemBase *)w_pliNetwork);
	w_pliNetwork->SetItemFont(&NANA_FONT12);
	w_pliNetwork->SetItemIcon(ICON32_NETWORK);
	w_pliNetwork->SetItemData(NET_CONNECT);
    w_pliNetwork->SetItemTextID(strMenuComm);
    
    w_pliHistory = new NANAListIconItem();
    w_pliHistory->SetParentList((NANAListBase *)&w_list);
    w_list.AddItem((NANAListItemBase *)w_pliHistory);
	w_pliHistory->SetItemFont(&NANA_FONT12);
	w_pliHistory->SetItemIcon(ICON32_HISLOG);
	w_pliHistory->SetItemData(HISTORY);
    w_pliHistory->SetItemTextID(strMenuHis);
    
    w_pliDispSet = new NANAListIconItem();
    w_pliDispSet->SetParentList((NANAListBase *)&w_list);
    w_list.AddItem((NANAListItemBase *)w_pliDispSet);
	w_pliDispSet->SetItemFont(&NANA_FONT12);
	w_pliDispSet->SetItemIcon(ICON32_DISPSET);
	w_pliDispSet->SetItemData(DISPLAY_SET);
    w_pliDispSet->SetItemTextID(strMenuDisplay);
    
    
    w_pliFixMode = new NANAListIconItem();
    w_pliFixMode->SetParentList((NANAListBase *)&w_list);
    w_list.AddItem((NANAListItemBase *)w_pliFixMode);
    w_pliFixMode->SetItemFont(&NANA_FONT12);
	w_pliFixMode->SetItemIcon(ICON32_FIXMODE);
	w_pliFixMode->SetItemData(FIX_MODE);
    w_pliFixMode->SetItemTextID(strMenuRepair);
}
void NANA_MainMenuWnd::OnPaint()
{
	
	NANA_LinkedWnd::OnPaint();
}
void NANA_MainMenuWnd::OnNotify(NANAWnd *pSrcWnd,int nMessageCode,int nParam1,int nParam2)
{
	NANA_LinkedWnd *pwnd;
	if(pSrcWnd == &w_list)
	{

		if(nMessageCode == UGNC_CLICK)
		{
			switch(((NANAListIconItem *)nParam1)->w_IconData.w_nData)
			{
				case LOWTEMP_COMPRESSOR:
					pwnd = (NANA_LinkedWnd *)new NANA_LowTempComp;
					pwnd->ShowFullScreen(this,ICON16_OPEN_FOLDER);
					break;

				case MIDTEMP_COMPRESSOR:
					pwnd = (NANA_LinkedWnd *)new NANA_MidTempComp;
					pwnd->ShowFullScreen(this,ICON16_OPEN_FOLDER);
					break;
                case COOLER:
					pwnd = (NANA_LinkedWnd *)new NANA_Cooler;
					pwnd->ShowFullScreen(this,ICON16_OPEN_FOLDER);
					break;
			
                case OVER_COOLER:
					pwnd = (NANA_LinkedWnd *)new NANA_OverCooler;
					pwnd->ShowFullScreen(this,ICON16_OPEN_FOLDER);
					break;
                case PASSWORD:
                    pwnd = (NANA_LinkedWnd *)new NANA_PassSet;
                    pwnd->ShowFullScreen(this,ICON16_OPEN_FOLDER);
                    break;
                case DISPLAY_SET:
                    pwnd = (NANA_LinkedWnd *)new NANA_DispSet;
                    pwnd->ShowFullScreen(this,ICON16_OPEN_FOLDER);
                    break;
                case HISTORY:
                    pwnd = (NANA_LinkedWnd *)new NANA_History;
                    pwnd->ShowFullScreen(this,ICON16_OPEN_FOLDER);
                    break;
#if 0		
                case WARNING:
					pwnd = (NANA_LinkedWnd *)new NANA_Warning;
					pwnd->ShowFullScreen(this,ICON16_OPEN_FOLDER);
					break;
				case SENSOR:
					pwnd = (NANA_LinkedWnd *)new NANA_Sensor;
					pwnd->ShowFullScreen(this,ICON16_OPEN_FOLDER);
					break;
				case NET_CONNECT:
					pwnd = (NANA_LinkedWnd *)new NANA_NetConn;
					pwnd->ShowFullScreen(this,ICON16_OPEN_FOLDER);
					break;
				case FIX_MODE:
					pwnd = (NANA_LinkedWnd *)new NANA_FixMode;
					pwnd->ShowFullScreen(this,ICON16_OPEN_FOLDER);
					break;
#endif
			}
		}
    }
	NANA_LinkedWnd::OnNotify(pSrcWnd,nMessageCode,nParam1,nParam2);
}

User * g_pUser;
DOPin * g_pDOPin[_MAX_DO_];
void NANA_StartWnd::OnCreate () 
{
    int i;
    for(i=0;i<_MAX_DO_;i++)
    {
        g_pDOPin[i] = new DOPin(i,(i&0x01)?1:0);
    }
    //创建全局报警信息,并读出原有的数据
    g_pWarningList = new WarningList;
    g_pWarningList->Initial();
	//创建全局软键盘
	pSOKB = new NANA_SoftKeyBoard;	
	//创建全局提示对话框
	pMSGBOX = new NANAMessageBox;
	//创建全局用户信息
	g_pUser = new User;
	w_butEnter.CreateWnd(this,250,170,60,25);
	w_butEnter.SetIcon(ICON16_SETTIING);

	w_editLowTempFullSuckTemp.CreateWnd(this,20,60,200,25);
	w_editLowTempFullSuckTemp.w_Label.Set(strStartWndLowSuckTemp);
	w_editLowTempFullSuckTemp.w_Name.Set(strStartWndLowSuckTemp);
	w_editLowTempFullSuckTemp.SetIcon(ICON16_OC);
	w_editLowTempFullSuckTemp.SetValue(0);
	w_editLowTempFullSuckTemp.SetLock(1);
	w_editLowTempFullSuckTemp.SetFont(&NANA_FONT16x);

	w_editMidTempFullSuckTemp.CreateWnd(this,20,90,200,25);
	w_editMidTempFullSuckTemp.w_Label.Set(strStartWndMidSuckTemp);
	w_editMidTempFullSuckTemp.w_Name.Set(strStartWndMidSuckTemp);
	w_editMidTempFullSuckTemp.SetIcon(ICON16_OC);
	w_editMidTempFullSuckTemp.SetValue(0);
	w_editMidTempFullSuckTemp.SetLock(1);
	w_editMidTempFullSuckTemp.SetFont(&NANA_FONT16x);

	w_editCoolerTemp.CreateWnd(this,20,120,200,25);
	w_editCoolerTemp.w_Label.Set(strStartWndCoolerTemp);
	w_editCoolerTemp.w_Name.Set(strStartWndCoolerTemp);
	w_editCoolerTemp.SetIcon(ICON16_OC);
	w_editCoolerTemp.SetValue(0);
	w_editCoolerTemp.SetLock(1);
	w_editCoolerTemp.SetFont(&NANA_FONT16x);
	
	w_editLowTempLiqTemp.CreateWnd(this,20,150,200,25);
	w_editLowTempLiqTemp.w_Label.Set(strStartWndLTLTemp);
	w_editLowTempLiqTemp.w_Name.Set(strStartWndLTLTemp);
	w_editLowTempLiqTemp.SetIcon(ICON16_OC);
	w_editLowTempLiqTemp.SetValue(0);
	w_editLowTempLiqTemp.SetLock(1);
	w_editLowTempLiqTemp.SetFont(&NANA_FONT16x);

	
}
void NANA_StartWnd::OnPaint()
{
	int width,height;
	NANARect rc;
	GetWindowRect(&rc);
	
	w_butEnter.SetCaption(GetStringResource(strStartWndEnter));
	
	//upper title
	RectFill(rc.w_nX1,rc.w_nY1,rc.w_nX2,50,COLOR_BKGROUND);
	width = rc.GetWidth();
	height = 25;
	TextBlockPrint(GetStringResource(strStartWndTitle),0,0,&width,&height,&NANA_FONT16,0,ALIGN_MIDDLE,0,0);
	height = 25;
	width = 130;
	TextBlockPrint(GetStringResource(strStartWndModel),0,25,&width,&height,&NANA_FONT12,0,ALIGN_LEFT,0,0);
	width = 170;
	TextBlockPrint(GetStringResource(strStartWndProjectUse),130,25,&width,&height,&NANA_FONT12,0,ALIGN_MIDDLE,0,0);
	DrawHorizontalLine(rc.w_nX1+2,50,rc.GetWidth()-4,1);
	//information
	
	//lower title
	RectFill(rc.w_nX1,200,rc.w_nX2,rc.w_nY2,COLOR_BORDER);
	height = 40;
	width = rc.GetWidth();
	TextBlockPrint(GetStringResource(strStartWndProducerInfo),0,200,&width,&height,&NANA_FONT12,1,ALIGN_MIDDLE,5,0);
	DrawICON(ICON_BOHNLOGO,5,205,0);
	g_pUser->w_nUser = emGuess;
	
}



void NANA_StartWnd::OnNotify(NANAWnd *pSrcWnd,int nMessageCode,int nParam1,int nParam2)
{
	if(pSrcWnd == &w_butEnter)
	{
		pSOKB->Show(this,GetStringResource(strSOKBPleaseInputPassword),1,ICON16_PASSKEY);
		pSOKB->SetDisplay_float(0);
	}
	if(pSrcWnd == pSOKB)
	{
		//校验密码
		g_pUser->w_nUser = g_pUser->CheckUser(pSOKB->w_Interger);
		if(emGuess != g_pUser->w_nUser)
		{
			NANA_MainMenuWnd	* pMainWnd;
			pMainWnd = new NANA_MainMenuWnd;
			pMainWnd->ShowFullScreen(this,ICON16_OPEN_FOLDER,1);//root linked window
		}else{
			pMSGBOX->Show(this,GetStringResource(strSOKBPasswrokErr),GetStringResource(strSOKBReinputPassword),UGMB_OK,ICON32_WARNING);
		}
	}
}





















⌨️ 快捷键说明

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