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

📄 eeb_linkwnd.cpp

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

#include "Glib.h"
#include "Wnd.h"
#include "ppButton.h"
#include "ppMenu.h"
#include "ppCalendar.h"
#include "ppMessageBox.h"
#include "ppListView.h"


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

const unsigned char left_edge[]={
	0x8,0x38,0x38,0x78,0x78,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8
};
const unsigned char right_edge[]={
	0x80,0xe0,0xe0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8
};
const unsigned char left_edge_hollow[]={
	0x8,0x10,0x20,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
};
const unsigned char right_edge_hollow[]={
	0x80,0x40,0x20,0x10,0x10,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,
};

void NANA_LinkedWnd::OnPaint()
{
	NANA_LinkedWnd	*pRootPageWnd;
	NANA_BITMAP	bmp;
	int x;
	int width;
	NANARect rc;
	GetWindowRect(&rc);
	DrawHorizontalLine(rc.w_nX1+2,25,rc.GetWidth()-4,3);
	

	bmp.biBitCount = 1;
	bmp.biHeight  = 25;
	bmp.biReverseColor = 0;
	bmp.biWidth = 5;
	
	pRootPageWnd = GetRootPage(this);
	
	x = rc.w_nX1+2;
	for(;;)
	{
		width = GetTextWidth(pRootPageWnd->w_Title.Get(),&NANA_FONT12,-1);
		if(pRootPageWnd->w_Icon>=0)
		{
			width += 20;
		}
		
		if(pRootPageWnd == this)
		{
			bmp.pData = (unsigned char *)left_edge;
			GHAL_put_bmp(x,0,&bmp);
			bmp.pData = (unsigned char *)right_edge;
			GHAL_put_bmp(x+bmp.biWidth+width,0,&bmp);
			RectFill(x+bmp.biWidth,0,x+bmp.biWidth+width,25,1);
			if(pRootPageWnd->w_Icon>=0)
			{
				DrawICON(pRootPageWnd->w_Icon,x+bmp.biWidth,6,1);
				TextPrint(pRootPageWnd->w_Title.Get(),x+bmp.biWidth+20,7,&NANA_FONT12,1);
			}else{
				TextPrint(pRootPageWnd->w_Title.Get(),x+bmp.biWidth,7,&NANA_FONT12,1);
			}
			break;
		}else{
			Rect(x+bmp.biWidth-1,0,x+bmp.biWidth+width,26,1,0);
			bmp.pData = (unsigned char *)left_edge_hollow;
			GHAL_put_bmp(x,0,&bmp);
			bmp.pData = (unsigned char *)right_edge_hollow;
			GHAL_put_bmp(x+bmp.biWidth+width,0,&bmp);
			if(pRootPageWnd->w_Icon>=0)
			{
				DrawICON(pRootPageWnd->w_Icon,x+bmp.biWidth,6,0);
				TextPrint(pRootPageWnd->w_Title.Get(),x+bmp.biWidth+20,7,&NANA_FONT12,0);
			}else{
				TextPrint(pRootPageWnd->w_Title.Get(),x+bmp.biWidth,7,&NANA_FONT12,0);
			}
		}
		pRootPageWnd = pRootPageWnd->GetNextPage(this);
		x += bmp.biWidth + width;
	}
}

void NANA_LinkedWnd::OnCreate ()
{
	NANARect rc;
	GetWindowRect(&rc);
	
	w_butClose.CreateWnd(this,rc.w_nX2 - 28,rc.w_nY1+1,26,23);
	w_butClose.SetCaption(NULL);
	w_butClose.SetIcon(ICON16_CLOSE);
	w_butClose.SetStyleEx(BUTTON_STYLE_FLAT);
}
NANA_LinkedWnd * NANA_LinkedWnd::GetRootPage(NANA_LinkedWnd * pEndPage)
{
	while(!pEndPage->w_bRoot)
	{
		pEndPage =(NANA_LinkedWnd *) pEndPage->w_pPrevPageWnd;
	}
	return pEndPage;
}
NANA_LinkedWnd * NANA_LinkedWnd::GetNextPage(NANA_LinkedWnd * pEndPage)
{
	if(pEndPage == this) return this;
	
	while(pEndPage->w_pPrevPageWnd != this && (!pEndPage->w_bRoot))
	{
		pEndPage = (NANA_LinkedWnd *)pEndPage->w_pPrevPageWnd;
	}
	if(pEndPage->w_pPrevPageWnd == this)
		return pEndPage;
	else
		return NULL;
}
void NANA_LinkedWnd::ShowFullScreen(NANAFrameWnd *pPrevWnd,int icon,int bRoot)
{
	CreateWnd(NULL,0,0,320,240);
	w_pPrevPageWnd = pPrevWnd;
	w_pPrevPageWnd->SetWindowVisible(FALSE);
	w_Icon = icon;
	w_bRoot = bRoot;
}
void NANA_LinkedWnd::OnNotify(NANAWnd *pSrcWnd,int nMessageCode,int nParam1,int nParam2)
{
	if(pSrcWnd == &w_butClose)
	{
		w_pPrevPageWnd->SetWindowVisible(TRUE);
		this->CloseWindow();
		delete this;
	}
}

⌨️ 快捷键说明

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