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

📄 page.c

📁 一个minigui 工程框架,需要windows 下的minigui 开发环境
💻 C
📖 第 1 页 / 共 3 页
字号:
	}
	point_end_y1 = GetLongVal(objstring,&pos);

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

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

	// color middle.

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

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

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

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

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

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

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

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

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

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


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

	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=1)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	m_Styletheme1 = GetStringVal(objstring,index._Length,&pos,0);
	
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	png0 = GetLongVal(objstring,&pos);
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	png1 = GetLongVal(objstring,&pos);

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

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

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

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

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

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

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

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

	Misc_Initialize3(&g_miscii,style0,style1,alpha0,alpha1, color_start0,color_start1,\
					 color_end0,color_end1,point_start_x0,point_start_x1,point_start_y0,\
					 point_start_y1,point_end_x0,point_end_x1,point_end_y0,point_end_y1,color_margin0,\
					 color_margin1,color_middle0,color_middle1,point_marginone_x0,point_marginone_x1,\
					 point_marginone_y0,point_marginone_y1,point_margintwo_x0,point_margintwo_x1,\
					 point_margintwo_y0,point_margintwo_y1,m_Styletheme0,m_Styletheme1,png0,png1,\
					 image0,image1,image_active0,image_active1,switchtwo0,switchtwo1,switchthree0,switchthree1);

FAILED:
	if(m_Styletheme0)
		free(m_Styletheme0);
	if(m_Styletheme1)
		free(m_Styletheme1);

	if(nReturn)
	{
		if(debug_flag)
			printf("Success parseing Styletheme information!\n");			
	}
	else
	{
		if(debug_flag)
			printf("Error parseing Styletheme information!\n");
	}
	return nReturn;
}

int Page_Initialize(Page* page_p,
					LONG    Position_left,
					LONG    Position_top,
					LONG    Position_right,
					LONG    Position_bottom,
					BYTE bStyle,	
					LONG	Grid_width,
					LONG	Grid_height,
					COLORREF dwBackgroundColor,
					BYTE bStatus,
					STRING  ImageItem_ImageName,	
					COLORREF ImageItem_dwForeColor,	
					COLORREF ImageItem_dwBackColor,	
					BYTE	ImageItem_bStatus,	
					COLORREF  ImageItem_dwTransparenceColor,
					STRING szPageName,
					BOOL Comm_Type,		
					eFeedbackType  feedback_type,

					int nID,
					 int delay,
					STRING groupid	
					)
{
	Rect Position;
	ImageItem Image;
	if(!(Position_right-Position_left)%2) Position_right+=1;
	if(!(Position_bottom-Position_top)%2) Position_bottom+=1;
	
	Position = rect_struct_init(Position_bottom,Position_left,Position_right,Position_top);
	Image = imageitem_struct_init(ImageItem_ImageName,ImageItem_dwForeColor,ImageItem_dwBackColor,ImageItem_bStatus,ImageItem_dwTransparenceColor);
	
	
	page_struct_init(page_p,Position,bStyle,Grid_width,Grid_height,dwBackgroundColor,bStatus,Image,szPageName,Comm_Type,feedback_type,nID,delay,groupid);
	return 1;

}
Rect rect_struct_init(LONG bottom,LONG left,LONG right,LONG top)
{
	Rect rect;

	if (bottom <0)		bottom = 0;
	if (left <0)		left = 0;
	if (right <0)		right = 0;
	if (top <0)			top = 0;

	rect.bottom =bottom;
	rect.left = left;
	rect.right = right;
	rect.top = top;

	return rect;
}

ImageItem imageitem_struct_init( STRING  ImageName,	
							COLORREF dwForeColor,	
							COLORREF dwBackColor,	
							BYTE	 bStatus,
							COLORREF dwTransparenceColor	
							)
{

	ImageItem image;
	int slen;

	if(ImageName==NULL)
		slen=0;
	else
		slen = strlen(ImageName);

	if (slen ==0)
		image.szImageName  = NULL;
	else
	{
		image.szImageName = (STRING)malloc(slen +1);
		if(image.szImageName)
			strcpy(image.szImageName ,ImageName);
	}

	image.m_ulForeColor = dwForeColor;
	image.m_ulBackColor = dwBackColor;
	image.m_bStatus = bStatus;
	image.m_ulTransparenceColor = dwTransparenceColor;

	return image;
}void page_struct_init(Page* page_p,
			Rect Position,
			BYTE bStyle,	// main page or subpage
			LONG Grid_Width,
			LONG Grid_Height,
			COLORREF dwBackgroundColor,
			BYTE bStatus,
			ImageItem	imageitem,
			STRING szPageName,
			BOOL Comm_Type,
			eFeedbackType feedback_type,
			int nID,
			int delay,
			STRING groupid
			)
{
	int slen;

	if (page_p == NULL)
		return;	page_p->m_pagePid = 0;

	page_p->m_grPageID = 0;			
	page_p->m_grPageLocalizerID = 0;

	page_p->m_rPosition = Position;

	page_p->m_bStyle = bStyle;
	page_p->m_ulBackGroundColor = dwBackgroundColor;
	page_p->m_bStatus = bStatus;	


	page_p->m_itImageItem = imageitem;

	if(szPageName == NULL)
		slen=0;
	else
		slen = strlen(szPageName);


	if (slen !=0){

		page_p->m_szPageName = (STRING)malloc(slen+1);
		if( 0 == page_p->m_szPageName)
		{
			page_free_resource(page_p);
			page_p = 0;
			return ;
		}
		strcpy(page_p->m_szPageName,szPageName);
	}
	else
		page_p->m_szPageName = NULL;

	page_p->m_nID = nID;
	page_p->m_nDelay  = delay * 1000; 

	if(groupid == NULL)
		slen = 0;
	else
		slen = strlen (groupid);

	if(slen !=0)
	{
		page_p->m_szGroupID = (STRING) malloc(slen +1);
		if( 0 == page_p->m_szGroupID)
		{
			page_p = 0;
			return ;
		}
		strcpy( page_p->m_szGroupID ,groupid);
	}
	else
		page_p->m_szGroupID = NULL;	


	page_p->m_wlWidgetList = NULL;
	page_p->m_blButtonList = NULL;
	page_p->m_blBorderList = NULL;
	page_p->m_plPageList = NULL;

	page_p->m_eFeedbackType = feedback_type;
	page_p->m_pParentPage = 0;
	page_p->m_nShowFashion = 0;

	page_p->m_timer = 0;
	page_p->target_page = 0;

	return;
}
void page_struct_init2(Page* page_p,
			Rect Position,
			BYTE bStyle,	// main page or subpage
			LONG Grid_Width,
			LONG Grid_Height,
			COLORREF dwBackgroundColor,
			BYTE bStatus,
			ImageItem	imageitem,
			STRING szPageName,
			BOOL Comm_Type,
			eFeedbackType feedback_type,
			int nID,
			int delay,
			STRING groupid,
			int fashion
			)
{
	int slen;

	if (page_p == NULL)
		return;

	page_p->m_grPageID = 0;			
	page_p->m_grPageLocalizerID = 0;

	page_p->m_rPosition = Position;

	page_p->m_bStyle = bStyle;
	page_p->m_ulBackGroundColor = dwBackgroundColor;
	page_p->m_bStatus = bStatus;	


	page_p->m_itImageItem = imageitem;

	if(szPageName == NULL)
		slen=0;
	else
		slen = strlen(szPageName);


	if (slen !=0){

		page_p->m_szPageName = (STRING)malloc(slen+1);
		if( 0 == page_p->m_szPageName)
		{
			page_free_resource(page_p);
			page_p = 0;
			return ;
		}
		strcpy(page_p->m_szPageName,szPageName);
	}
	else
		page_p->m_szPageName = NULL;

	page_p->m_nID = nID;
	page_p->m_nDelay  = delay * 1000; 

	if(groupid == NULL)
		slen = 0;
	else
		slen = strlen (groupid);

	if(slen !=0)
	{
		page_p->m_szGroupID = (STRING) malloc(slen +1);
		if( 0 == page_p->m_szGroupID)
		{
			page_p = 0;
			return ;
		}
		strcpy( page_p->m_szGroupID ,groupid);
	}
	else
		page_p->m_szGroupID = NULL;	


	page_p->m_wlWidgetList = NULL;
	page_p->m_blButtonList = NULL;
	page_p->m_blBorderList = NULL;
	page_p->m_plPageList = NULL;

	page_p->m_eFeedbackType = feedback_type;
	page_p->m_pParentPage = 0;
	page_p->m_nShowFashion = fashion;
	page_p->m_timer = 0;
	page_p->target_page = 0;

	return;
}






int Page_Initialize2(Page* page_p,
					LONG    Position_left,
					LONG    Position_top,
					LONG    Position_right,
					LONG    Position_bottom,
					BYTE bStyle,		
					LONG	Grid_width,
					LONG	Grid_height,

					COLORREF dwBackgroundColor,

					BYTE bStatus,
					STRING  ImageItem_ImageName,	
					COLORREF ImageItem_dwForeColor,	
					COLORREF ImageItem_dwBackColor,	
					BYTE	ImageItem_bStatus,	
					COLORREF  ImageItem_dwTransparenceColor,

					STRING szPageName,
					BOOL Comm_Type,	
					eFeedbackType  feedback_type,

					int nID,
					int delay,
					STRING groupid,
					int fashion
					)
{
		Rect Position;
		ImageItem Image;
			if(!(Position_right-Position_left)%2) Position_right+=1;
			if(!(Position_bottom-Position_top)%2) Position_bottom+=1;

		Position = rect_struct_init(Position_bottom,Position_left,Position_right,Position_top);
		Image = imageitem_struct_init(ImageItem_ImageName,ImageItem_dwForeColor,ImageItem_dwBackColor,ImageItem_bStatus,ImageItem_dwTransparenceColor);

	
		 page_struct_init2(page_p,Position,bStyle,Grid_width,Grid_height,dwBackgroundColor,bStatus,Image,szPageName,Comm_Type,feedback_type,nID,delay,groupid,fashion);
		 return 1;
}

int page_add_subpage(Page* page_p,int pos,Page* sub)
{
	int i =0;
	PageList p;
	PageList prv;
	PageList* address;

	int subpage_pos = pos;
	g_list[pos].m_pParentPage = page_p;


	if (page_p == NULL)
		return -1;

	address = &page_p->m_plPageList;
	p = page_p->m_plPageList;	
	prv = p;
	
	while(p){

		i++;
		prv = p;
		address = &p->next;
		p = p->next;		
	}

	p = (PageList) malloc(sizeof(struct PAGELIST));
	if( 0 == p)
		return i;
	memset(p,0,sizeof(struct PAGELIST));
	sub->m_pParentPage = page_p;
	
	p->page_p = sub;
	
	*address = p;


	list_add_widget(page_p,SUBPAGE_X,&subpage_pos);

⌨️ 快捷键说明

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