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

📄 page.c

📁 一个minigui 工程框架,需要windows 下的minigui 开发环境
💻 C
📖 第 1 页 / 共 3 页
字号:
#include "const.h"#include "resource.h"#include "project.h"#include "page.h"#include "button.h"
#include "border.h"
#include "label.h"
#include "image.h"#include "liaison.h"void	ExposurePage(Page* page)
{
	HDC hdc;
	unsigned long color;
	int r,g,b;
	int x,y,w,h;
	WidgetList wl;
	void* widget_p;
	HWND hWnd = page->m_grPageID;
	hdc = BeginPaint(hWnd);
	color = page->m_ulBackGroundColor;

	r = (int)(color & 0xFF);
	g = (int)((color >>8) & 0xFF);
	b = (int)((color >> 16) & 0xFF);
	
	x = 0;
	y = 0;
	w = page_pointer->m_rPosition.right -page_pointer->m_rPosition.left - x;
	h = page_pointer->m_rPosition.bottom -page_pointer->m_rPosition.top -y;
	
	
	SetBrushColor(hdc,(unsigned long)RGBA2Pixel(hdc,r,g,b,0xFF));
	
	FillBox(hdc,x,y,w,h);

	// wiget list / border obj.

	wl = page->m_wlWidgetList;

	while(wl)
	{
		widget_p = wl->widget_pointer;
		switch(wl->widget_type)
		{
		case BORDER_X:
			{
				Border* border = (Border*)widget_p;
				Page* ppage = (Page*)border->m_pParentPage;
				if(ppage->m_bStyle == page->m_bStyle)
					ExposureBorder((Border*)widget_p,hdc);
			}
			break;
		default:
			break;
		}
		wl = wl->next;
	}
	EndPaint(hWnd,hdc);

}BOOL CreatePageVersion(const char* objstring)
{
	_INDEX index;
	int version =0;
	STRING ver = 0;
	int pos =OBJECT_LEN;
	int nReturn = 1;
	if(!objstring)
		goto FAILED;
	
	index = GetIndexInformation(objstring,&pos);
	if(index._Type != 1 )
	{
		nReturn = 0;
		goto FAILED;
	}
	
	ver = GetStringVal(objstring,index._Length,&pos,0);
	version = (int)atoi(ver);

	Misc_Initialize2(&g_miscii,version);

FAILED:
	if(ver)
		free(ver);
	
	return nReturn ;	
}

BOOL CreatePageSize(const char* objstring)
{
	_INDEX index;
	int pos =OBJECT_LEN;
	
	index = GetIndexInformation(objstring,&pos);
	if(index._Type != 0 )
		return FALSE;
	
	g_list_number = GetLongVal(objstring,&pos);
	
	if(g_list_number<=0)
		return FALSE;
	
	g_page = (Page*)malloc(sizeof(Page)*g_list_number);
	if(g_page==NULL)
		return FALSE;

	memset(g_page,0,sizeof(Page)*g_list_number);	
	g_list = &(*g_page);

	return TRUE;	
}


BOOL CreatePageInfo(const char* objstring)
{	
	BOOL nReturn ;
	long  Position_left,Position_top,Position_right,Position_bottom;
	unsigned char bStyle;
	long  Grid_width,Grid_height;
	unsigned long dwBackgroundColor;
	unsigned char bStatus;
	char* ImageItem_ImageName;
	unsigned long ImageItem_dwForeColor,ImageItem_dwBackColor;
	unsigned char ImageItem_bStatus;
	unsigned long ImageItem_dwTransparenceColor;
	char* szPageName;
	unsigned int Comm_Type;
	int feedback_type; 
	int nID,delay;
	char* groupid;
	
	
	_INDEX index;
	int pos =OBJECT_LEN;
	
	nReturn = TRUE;
	
	ImageItem_ImageName=0;
	szPageName=0;
	groupid=0;
	
	// position left.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0) 
	{ 
		nReturn = FALSE;
		goto FAILED;
	}
	Position_left = GetLongVal(objstring,&pos);
	
	
	// position top.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0) 
	{ 
		nReturn = FALSE; 
		goto FAILED;
	}
	Position_top  = GetLongVal(objstring,&pos);
	
	
	//// position right.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0) 
	{ 
		nReturn = FALSE; 
		goto FAILED;
	}
	Position_right  = GetLongVal(objstring,&pos);
	
	
	//// position bottom
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0) 
	{ 
		nReturn = FALSE; 
		goto FAILED;
	}
	Position_bottom  = GetLongVal(objstring,&pos);
	


	// main page flag.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0) 
	{ 
		nReturn = FALSE;
		goto FAILED;
	}
	bStyle  =(unsigned char) GetLongVal(objstring,&pos);
	
	
	//// grid size.cx.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0) 
	{
		nReturn = FALSE; 
		goto FAILED;
	}
	Grid_width  = GetLongVal(objstring,&pos);
	
	
	//// grid size.cy.
	
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0) 
	{ 
		nReturn = FALSE;
		goto FAILED;
	}
	Grid_height  = GetLongVal(objstring,&pos);
	
	
	// backgroundcolor.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0) 
	{ 
		nReturn = FALSE; 
		goto FAILED;
	}
	dwBackgroundColor  = GetLongVal(objstring,&pos);
	
	
	// status.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0) 
	{ 
		nReturn = FALSE;
		goto FAILED;
	}
	bStatus  =(unsigned char) GetLongVal(objstring,&pos);
	
	
	// image name.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=1)  
	{
		nReturn = FALSE; 
		goto FAILED;
	}	 
	ImageItem_ImageName = GetStringVal(objstring,index._Length,&pos,0);
//	assert(ImageItem_ImageName);
	
	
	// image fore color.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0) 
	{ 
		nReturn = FALSE;
		goto FAILED;
	}
	ImageItem_dwForeColor  = GetLongVal(objstring,&pos);
	
	
	// image back color.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0) 
	{ 
		nReturn = FALSE; 
		goto FAILED;
	}
	ImageItem_dwBackColor  = GetLongVal(objstring,&pos);
	
	
	// image status.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0) 
	{ 
		nReturn = FALSE; 
		goto FAILED;
	}
	ImageItem_bStatus  =(unsigned char) GetLongVal(objstring,&pos);
	
	
	// image transp color
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0) 
	{ 
		nReturn = FALSE;
		goto FAILED;
	}
	ImageItem_dwTransparenceColor  = GetLongVal(objstring,&pos);
	
	
	// page name
	
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=1) 
	{ 
		nReturn = FALSE;
		goto FAILED;
	}	 
	szPageName = GetStringVal(objstring,index._Length,&pos,0);
//	assert(szPageName);
	
	
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  
	{ 
		nReturn = FALSE; 
		goto FAILED;
	}
	Comm_Type  =(unsigned int) GetLongVal(objstring,&pos);
	
	
	// feedback type
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0) 
	{
		nReturn = FALSE; 
		goto FAILED;
	}
	feedback_type = (int) GetLongVal(objstring,&pos);
	
	
	// page id.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0) 
	{ 
		nReturn = FALSE;
		goto FAILED;
	}
	nID = (int) GetLongVal(objstring,&pos);
	
	
	
	// delay.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0) 
	{ 
		nReturn = FALSE; 
		goto FAILED;
	}
	delay = (int) GetLongVal(objstring,&pos);
	
	
	// group id 
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=1) 
	{ 
		nReturn = FALSE;
		goto FAILED;
	}	 
	groupid = GetStringVal(objstring,index._Length,&pos,0);
//	assert(groupid);
	
	
	
	Page_Initialize(page_pointer,
		Position_left,
		Position_top,
		Position_right,
		Position_bottom,					
		bStyle,	
		Grid_width,
		Grid_height,
		dwBackgroundColor,
		bStatus,
		ImageItem_ImageName,	
		ImageItem_dwForeColor,	
		ImageItem_dwBackColor,	
		ImageItem_bStatus,	
		ImageItem_dwTransparenceColor,
		szPageName,
		Comm_Type,
		feedback_type,
		nID,
		delay,
		groupid	
		);
	
FAILED:
	if(ImageItem_ImageName)
		free (ImageItem_ImageName);
	if(szPageName)
		free (szPageName);
	if(groupid)
		free (groupid);

	return nReturn;
}

BOOL CreatePageThemestyle(const char* objstring)
{
	int nReturn;
	int style0;
	int style1;
	int alpha0,alpha1;
	unsigned long color_start0;
	unsigned long color_start1;
	unsigned long color_end0;
	unsigned long color_end1;
	int point_start_x0;
	int point_start_x1;
	int point_start_y0;
	int point_start_y1;
	int point_end_x0;
	int point_end_x1;
	int point_end_y0;
	int point_end_y1;
	unsigned long color_margin0;
	unsigned long color_margin1;
	unsigned long color_middle0;
	unsigned long color_middle1;
	int point_marginone_x0;
	int point_marginone_x1;
	int point_marginone_y0;
	int point_marginone_y1;
	int point_margintwo_x0;
	int point_margintwo_x1;
	int point_margintwo_y0;
	int point_margintwo_y1;
	STRING m_Styletheme0;
	STRING m_Styletheme1;
	int png0,png1;
	unsigned long image0;
	unsigned long image1;
	unsigned long image_active0;
	unsigned long image_active1;
	int switchtwo0;
	int switchtwo1;
	int switchthree0;
	int switchthree1;

	// start parse.
	_INDEX index;
	int pos =OBJECT_LEN;
	
	nReturn = TRUE;

	png0 = 0;
	png1 = 0;
	style0 = 0;
	style1 = 0;
	m_Styletheme0 = 0;
	m_Styletheme1 = 0;

	// start read datum.
	// style.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	style0 = GetLongVal(objstring,&pos);
	
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	style1 = GetLongVal(objstring,&pos);
	// alpha.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	alpha0 = GetLongVal(objstring,&pos);
	
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	alpha1 = GetLongVal(objstring,&pos);
	
	// color_start.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	color_start0 = GetLongVal(objstring,&pos);

	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	color_start1 = GetLongVal(objstring,&pos);

	// color_end.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	color_end0 = GetLongVal(objstring,&pos);

	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	color_end1 = GetLongVal(objstring,&pos);

	// point_start0
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	point_start_x0 = GetLongVal(objstring,&pos);

	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	point_start_y0 = GetLongVal(objstring,&pos);
	
	// point_start1
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	point_start_x1 = GetLongVal(objstring,&pos);

	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	point_start_y1 = GetLongVal(objstring,&pos);

	// point_end.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	point_end_x0 = GetLongVal(objstring,&pos);

	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	point_end_y0 = GetLongVal(objstring,&pos);


	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	point_end_x1 = GetLongVal(objstring,&pos);

	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;

⌨️ 快捷键说明

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