
#include "apitest.h"

extern GUI_CONST_STORAGE GUI_BITMAP bm01 ;//BMP图片的数组

static const GUI_WIDGET_CREATE_INFO aDialogCreate[] = 
{   //从资源列表创建一个框架标题栏信息，父窗口，坐标X,Y,尺寸X,Y,
	{ FRAMEWIN_CreateIndirect,"biaotilan", 0, 10,10,200,300},   
	{ BUTTON_CreateIndirect,  "OK",    0,    100,5,60,20},  
	{ BUTTON_CreateIndirect,  "Cancel",0    ,100,30,60,20},  

	{ TEXT_CreateIndirect,    "LText", 0,10,60,80,25} , 	//创建文本
	{ TEXT_CreateIndirect,    "RText", 0,10,90,80,25} ,

	{ EDIT_CreateIndirect,    "a",0,50,55,80,25} , 	
	{ EDIT_CreateIndirect,    "b",0,50,85,80,25} ,  //创建文本编辑框
/*
	{ TEXT_CreateIndirect,    "Hex", 0,10,100,48,15,0, GUI_TA_RIGHT} ,	

	{ EDIT_CreateIndirect,    NULL,GUI_ID_EDIT2,60,100,48,15,0} , 	

	{ TEXT_CreateIndirect,    "Bin", 0,10,120,48,15,0, GUI_TA_RIGHT} ,	

	{ EDIT_CreateIndirect,    NULL,GUI_ID_EDIT3,60,100,48,15,0} , 
*/	

	{ LISTBOX_CreateIndirect,"listbox",GUI_ID_LISTBOX0,10,20,48,20} , 	
	
	{ CHECKBOX_CreateIndirect,"fuxuankuang",GUI_ID_CHECK0,10,200,100,40} , 	
			
};

/*static void cbCallback (WM_MESSAGE * pMsg)//利用回调函数创建窗口
{
	switch (pMsg->MsgId)
	{
		default: WM_DefaultProc(pMsg) ;
	}
}*/


static const GUI_POINT aPoints[]=
{
	{-50,0},{-10,10},{0,50},{10,10},{50,0},{10,-10},{0,-50},{-10,-10}
};

typedef struct
{
	int XPos_Poly,YPos_Poly ;
	int XPos_Text,YPos_Text ;	
	GUI_POINT aPointsDest[8];
}tDrawItContext;

const GUI_ConstString ListBox[]=
{
	"guangzhou","yikang","someone","forever",NULL
};

void Dispaly_string(void)
{
	GUI_SetFont(&GUI_Font24B_ASCII);//设置字体
	GUI_SetBkColor(GUI_YELLOW);//背景色
	GUI_Clear();//清屏，这样的话上面设置的背景色就会全部覆盖屏幕，没有清屏的话背景色只能覆盖所显示的字体

	GUI_SetPenSize(10);//设置点的尺寸
//		GUI_GotoXY(50,50);//移动指针

	GUI_SetColor(GUI_RED);//前景色	
	GUI_DrawLine(0,0,200,200);//画直线点的厚度
	GUI_DrawLine(0,200,200,0);//画直线点的厚度

	GUI_SetPenSize(5);//设置点的尺寸	
	GUI_SetColor(GUI_BLACK);//前景色	
	GUI_DrawLine(0,20,320,20);//画直线点的厚度
	GUI_DrawHLine(40,0,320);//画水平线像素的厚度

	GUI_SetBkColor(GUI_WHITE);//背景色	
	GUI_SetColor(GUI_BLUE);//前景色	

	GUI_SetTextMode(GUI_TEXTMODE_NORMAL);	//设置字体显示模式
	GUI_DispStringAt("AT-GUI_TEXTMODE_NORMAL",0,80);//在指定位置显示字符串
	GUI_DispStringHCenterAt("HC-GUI_TEXTMODE_NORMAL",0,100);

	GUI_SetTextMode(GUI_TEXTMODE_REV);	//设置字体显示模式
	GUI_DispStringAt("AT-GUI_TEXTMODE_REV",0,120);//在指定位置显示字符串,背景色与前景色反转
	GUI_DispStringHCenterAt("HC-GUI_TEXTMODE_REV",0,140);//不是从开头显示的

	GUI_SetTextMode(GUI_TEXTMODE_NORMAL);	//设置字体显示模式
	GUI_SetTextAlign(GUI_TA_LEFT);
	GUI_SetBkColor(GUI_BLUE);//背景色	
	GUI_SetColor(GUI_RED);//前景色		
	GUI_DispStringAt("AT-guangzhouyikangyiliaoshe\nbeishiyeyouxiangongsi-yanfayingjian-\nzengan-2014-12-01",0,240);//在指定位置显示字符串		
//	GUI_SetLBorder(0);//当前视窗换行后左边界
}

void Dispaly_Num(void)
{
	U16 Min=12345 ;
	U8 Sec=12 ;
	U16 test=14785 ;
	float f=123.456 ;
	U8 er=7 ;
	U16 hex=0x1389 ;

	GUI_SetFont(&GUI_Font24B_ASCII);//设置字体
	GUI_SetBkColor(GUI_YELLOW);//背景色
	GUI_Clear();
	GUI_SetColor(GUI_RED);//前景色	

	GUI_DispString("Min:");
	GUI_DispDec(Min,5);//显示一个十进制数
	GUI_DispDecMin(test);//显示一个十进制数
//		GUI_DispDecSpace();//禁止首位空格代换

	GUI_DispString("Sec:");
	GUI_DispDec(Sec,2);//显示一个十进制数

	GUI_DispDecAt(Sec,30,100,2);//显示一个十进制数	

	GUI_DispStringAt("float-test\n",30,120);	
	
	GUI_DispFloatMin(f,4);
	
	GUI_DispBinAt(er,30,200,8);
	
	GUI_DispHexAt(hex,30,240,8);
}

void Draw_pic(void)
{	
	const GUI_RECT pRect[]={{0,180,30,230},{60,180,90,230},{120,180,150,230},{180,180,210,230}};

	GUI_SetBkColor(GUI_WHITE);//背景色	
	GUI_Clear();	
	GUI_SetColor(GUI_RED);//前景色	

	GUI_SetDrawMode(GUI_DRAWMODE_NORMAL);//设置画圆的模式
	GUI_FillCircle(60,64,40);
	GUI_SetDrawMode(GUI_DRAWMODE_XOR);//设置画圆的模式
	GUI_FillCircle(80,84,40);	

	GUI_FillRect(0,110,50,160);//在指定区域填充颜色
	GUI_InvertRect(80,110,130,160);////在指定区域填充反相色

	GUI_FillRectEx(pRect);//填充区域

	GUI_DrawBitmap(&bm01,250,250);//显示BMP图片

	GUI_DrawBitmapMag(&bm01,200,250,2,2);//放大图片

/*
	GUI_DrawCircle(100,100,60);//画圆	
	GUI_FillCircle(200,200,50);//填充圆		
	GUI_DrawEllipse(100,100,50,60);//指定的坐标，以指定的尺寸画椭圆
	GUI_FillEllipse(200,200,50,70);	//按指定的尺寸填充一个椭圆	
	GUI_FillPolygon(aPoints,countof(aPoints),0,0);//多边形填充区域
*/
}
void Draw_polygon(void)
{
	static const GUI_POINT aPointArrow[]=
	{
		{50,50},{100,50},{150,100},{150,150},{100,200},{50,200}
	};
	
//	GUI_SetBkColor(GUI_WHITE);//背景色	
	GUI_Clear();	
	GUI_SetColor(GUI_RED);//前景色	
	
//	GUI_DrawPolygon(aPointArrow,6,0,150);
	GUI_FillPolygon(aPointArrow,6,0,150);
}

void Config_men(void)
{
	GUI_MEMDEV_Handle hMem	;
	
	hMem = GUI_MEMDEV_Create(0,0,60,32); 
	GUI_MEMDEV_Select(hMem); 
	
	GUI_SetFont(&GUI_Font32B_ASCII);//设置字体
	GUI_DispStringAt("Text",0,0);	

	GUI_MEMDEV_CopyToLCD(hMem); 
	
//	GUI_MEMDEV_CopyToLCDAA(hMem); //从储存设备拷贝到储存设备的内容（反锯齿)  到LCD	
	GUI_MEMDEV_Select(0); 	
	GUI_MEMDEV_Delete(hMem); 

	GUI_Delay(1000);
	GUI_Clear();
	GUI_Delay(500);		
}

void Config_men1(void *pData)
{
	tDrawItContext *pDrawItContext=(tDrawItContext*)pData;
	
	GUI_Clear();
	GUI_SetFont(&GUI_Font8x8);//设置字体
	GUI_SetTextMode(GUI_TM_TRANS);	//设置字体显示模式	
	
	GUI_SetColor(GUI_GREEN);//前景色	
	GUI_FillRect(pDrawItContext->XPos_Text,
							 pDrawItContext->YPos_Text-25,
							 pDrawItContext->XPos_Text+100,
							 pDrawItContext->YPos_Text-5 );

	GUI_SetColor(GUI_BLUE);//前景色	
	GUI_FillPolygon(pDrawItContext->aPointsDest,countof(aPoints),160,120);
	
	GUI_SetColor(GUI_RED);//前景色	

	GUI_FillRect(220-pDrawItContext->XPos_Text,
							 pDrawItContext->YPos_Text+5,
							 220-pDrawItContext->XPos_Text+100,
							 pDrawItContext->YPos_Text+25 );	
}
void DemoBandingMemdev(void)
{
	int i ;
	float  angle;
	
	int XSize=LCD_GET_XSIZE();
	int YSize=LCD_GET_YSIZE();	
	
	tDrawItContext DrawItContext;
	
	GUI_SetFont(&GUI_Font8x9);//设置字体	
	GUI_SetColor(GUI_WHITE);//前景色		
	GUI_DispStringHCenterAt("Banding memory device\nwithout flickering",XSize/40,YSize/40);
	
	DrawItContext.XPos_Poly=XSize/2 ;
	DrawItContext.YPos_Poly=YSize/2 ;	
	
	DrawItContext.YPos_Text=YSize/2-4 ;		
	
	for(i=0;i<(XSize-100);i++)
	angle=i*3.1415926/60 ;
	DrawItContext.XPos_Text=i ;		

	GUI_RotatePolygon(DrawItContext.aPointsDest,aPoints,countof(aPoints),angle);
	
	#if  USE_BANDING_MEMDEV
	{
			GUI_RECT Rect={0,70,320,170};
			GUI_MEMDEV_Draw(&Rect,&Config_men1,&DrawItContext,0,0);
	}
	
	#else
	{
			Config_men1((void *)&DrawItContext);
	}
	#endif
}

void WinHandler (WM_MESSAGE * pMsg)//利用回调函数创建窗口
{
	switch (pMsg->MsgId)
	{
		case WM_PAINT ://重绘窗口
		GUI_SetColor(GUI_BLUE);//前景色
		GUI_SetFont(&GUI_Font24_ASCII);//设置字体		
		GUI_SetBkColor(GUI_GRAY);//设置边框背景颜色
		
		GUI_Clear();//少了这个清屏的时候 不能显示窗口的全部尺寸
		GUI_DispStringAt("AUCGUI WINDOW1!",0,30);		
		break ;   
	}
}

void WinHandler2 (WM_MESSAGE * pMsg)//利用回调函数创建窗口
{
	switch (pMsg->MsgId)
	{
		case WM_PAINT ://重绘窗口
		GUI_SetColor(GUI_RED);//前景色
		GUI_SetFont(&GUI_Font16_ASCII);//设置字体			
		GUI_SetBkColor(GUI_YELLOW);//设置边框背景颜色
		GUI_Clear();//少了这个清屏的时候 不能显示窗口的全部尺寸
		GUI_DispStringAt(" UCGUI WINDOW2 !",0,0);
		
		break ;   
	}
}

void WinHandler3 (WM_MESSAGE * pMsg)//利用回调函数创建窗口
{
	switch (pMsg->MsgId)
	{
		case WM_PAINT ://重绘窗口		
		GUI_SetColor(GUI_BLACK);//前景色
		GUI_SetFont(&GUI_Font16_ASCII);//设置字体				
		GUI_SetBkColor(GUI_BROWN);//设置边框背景颜色
		GUI_Clear();//少了这个清屏的时候 不能显示窗口的全部尺寸
		GUI_DispStringAt(" UCGUI WINDOW3 !",0,0);
		
		break ;   
	}
}

void Display_Win(void)//窗口
{
	U32 wind_x ;
	U32 wind_y ;	
	
	GUI_HWIN hwin1[3] ;
	
	GUI_SetBkColor(GUI_WHITE);//背景色
	GUI_Clear();	
	
	GUI_SetColor(GUI_BLUE);//前景色
	GUI_SetFont(&GUI_Font24_ASCII);//设置字体				
	GUI_DispStringAt("chuang kou han shu !!",20,50);	
															//窗口识别标志，回调指针，分配额外的字节数
	hwin1[0]=WM_CreateWindow(50, 50, 300, 300, WM_CF_SHOW, WinHandler, 0);	//创建窗口
	
//	hwin1[1]=	WM_CreateWindowAsChild(50, 50, 300, 300,hwin1[0], WM_CF_SHOW, WinHandler2, 0);	//创建子窗口
//	hwin1[2]=WM_CreateWindowAsChild(100, 100, 300, 300,hwin1[0], WM_CF_SHOW, WinHandler3, 0);	//创建子窗口	
//	WM_SelectWindow(hwin1[1]);	//选择一个活动窗口
//	GUI_SetBkColor(GUI_GRAY);//设置边框背景颜色
//	GUI_Clear();	
	
//	WM_DeleteWindow(hwin1[1]);	//删除窗口
//	WM_HideWindow(hwin1[1]);	//隐藏窗口	
	
	wind_x=WM_GetWindowSizeX(hwin1[0]);
	wind_y=WM_GetWindowSizeY(hwin1[0]);	//读取窗口尺寸
	
	printf("\r\n windows_x=%d \r\n",wind_x);
	printf("\r\n windows_y=%d \r\n",wind_y);

	GUI_Delay(500);//这个延迟很重要	(对建立窗口函数)
}

void Display_button(void)//按键
{
	U16 ySize ;

	BUTTON_Handle Bparent[5];	
	
	GUI_SetBkColor(GUI_LIGHTGRAY);//背景色
	GUI_Clear();	
	GUI_SetColor(GUI_BLACK);//前景色	
	
	ySize=GUI_GetYSizeOfFont(&GUI_Font24_ASCII)	;
	
													//位置X,Y,大小X,Y,返回ID，窗口创建标志
//	Bparent[0]=BUTTON_Create(100,100,80,ySize,1,WM_CF_SHOW);//创建按钮
//	Bparent[1]=BUTTON_CreateAsChild(0,0,80,80,Bparent[0],2,WM_CF_SHOW);//创建子按钮

	Bparent[0]=BUTTON_Create(100,100,80,ySize,7,WM_CF_SHOW);//创建按钮
	Bparent[1]=BUTTON_Create(100,140,80,ySize,5,WM_CF_SHOW);//创建按钮
	Bparent[2]=BUTTON_Create(100,180,80,ySize,9,WM_CF_SHOW);//创建按钮
//无论怎么设置返回ID，打印出来的Bparent[0,1,2]都是2，3，4
	
	printf("\r\n 	Bparent[0]=%d \r\n",Bparent[0]);
	printf("\r\n 	Bparent[1]=%d \r\n",Bparent[1]);
	printf("\r\n 	Bparent[2]=%d \r\n",Bparent[2]);
	printf("\r\n 	ySize%d \r\n",ySize);	
	
															//按键状态，有无按下
	BUTTON_SetBkColor(Bparent[0],0,GUI_GRAY);//设置按键底色
	BUTTON_SetBkColor(Bparent[1],0,GUI_GRAY);//设置按键底色	
	BUTTON_SetBkColor(Bparent[2],1,GUI_GRAY);//设置按键底色		
	
	BUTTON_SetFont(Bparent[0],&GUI_Font24_ASCII);			//设置按键字体 大小 
	BUTTON_SetFont(Bparent[1],&GUI_Font24_ASCII);			//设置按键字体 大小 	
	BUTTON_SetFont(Bparent[2],&GUI_Font24_ASCII);			//设置按键字体 大小 		
														////按键状态，有无按下
	BUTTON_SetTextColor(Bparent[0],0,GUI_BLACK);	//设置按键字体颜色
	BUTTON_SetTextColor(Bparent[1],0,GUI_BLACK);	//设置按键字体颜色	
	BUTTON_SetTextColor(Bparent[2],1,GUI_BLACK);	//设置按键字体颜色	
	
	BUTTON_SetText(Bparent[0],"Abutton");	//设置按键字体
	BUTTON_SetText(Bparent[1],"Bbutton");	//设置按键字体
	BUTTON_SetText(Bparent[2],"Cbutton");	//设置按键字体

//	BUTTON_SetBitmap(Bparent[0],0,&bm1);	//位图显示按钮  不能够显示
	
//	GUI_DrawStreamedBitmap();//不能够显示
	
//	GUI_DrawBitmap(&bm1,50,50);//显示BMP图片 能够显示
	
	GUI_Delay(500);
}

void Display_checkbox(void)//复选框
{
	BUTTON_Handle Bparent[5];	
	
	GUI_SetBkColor(GUI_LIGHTGRAY);//背景色
	GUI_Clear();	
	GUI_SetColor(GUI_BLACK);//前景色	
	
	Bparent[0]=BUTTON_Create(100,100,120,120,0,WM_CF_SHOW);//创建按钮
	
	CHECKBOX_Create(0,0,40,40,Bparent[0],1,WM_CF_SHOW);//创建复选框

	GUI_Delay(500);	//这个函数很重要					
}
void Display_edit(void)//文本框
{
	EDIT_Handle Eparent[2];	

	GUI_HWIN hwin1[3] ;
	
	GUI_SetBkColor(GUI_WHITE);//背景色
	GUI_Clear();		
	
	GUI_SetColor(GUI_BLACK);//前景色
	GUI_SetFont(&GUI_Font24_ASCII);//设置字体				
	GUI_DispStringAt("chuang kou han shu !!",0,0);	
	
															//窗口识别标志，回调指针，分配额外的字节数
	hwin1[0]=WM_CreateWindow(20, 20, 250, 250, WM_CF_SHOW, WinHandler, 0);	//创建窗口	
	
	Eparent[0]=EDIT_CreateAsChild (20, 20,200,200,hwin1[0] , 0, WM_CF_SHOW, 300);

//EDIT_SetCursorAtChar  (Eparent[0], 50);

	//void EDIT_SetCursorAtPixel (EDIT_Handle hObj, int xPos);
	
//	EDIT_AddKey(Eparent[0],101);	
//	GUI_EditString("editstring",30,100);

	EDIT_SetBkColor(Eparent[0],0,GUI_BROWN);	//设置编辑框的颜色
	
	EDIT_SetDefaultTextAlign(GUI_TA_LEFT);//设置文本框对齐模式	
	
	EDIT_SetFont(Eparent[0],&GUI_Font24_ASCII);//设置文被字体大小
	
	EDIT_SetTextColor(Eparent[0],0,GUI_RED);//设置文本颜色		
	
	//文本编辑框中的汉字为何设置不了它的地址
	EDIT_SetText(Eparent[0],"ABfasfdsafsdsafafs\nafsafsafsafsafasfdsa\nfdsfsafsafsafsafsafasfsaC");//设置文本

	GUI_Delay(500);	//这个函数很重要		
}

void Display_framewin(void)//标题栏
{
	FRAMEWIN_Handle	Wparent[5] ;
//	GUI_HWIN hwin1[3] ;
	
	GUI_SetBkColor(GUI_LIGHTGRAY);//背景色
	GUI_Clear();			
	GUI_SetColor(GUI_BLACK);//前景色

															//窗口识别标志，回调指针，分配额外的字节数
WM_CreateWindow(20, 20, 250, 250, WM_CF_SHOW, WinHandler, 0);	//创建窗口	
	
	Wparent[0]=FRAMEWIN_Create("ZA",0,WM_CF_SHOW,50,50,200,200);//创建窗口边框	
//	Wparent[0]=FRAMEWIN_CreateAsChild(20,20,150,150,hwin1[0],"ZB",0,WM_CF_SHOW);//创建子窗口
	
	FRAMEWIN_SetBarColor(Wparent[0],0,GUI_BLUE);//设置标题栏背景颜色	
	FRAMEWIN_SetDefaultCaptionSize(2*GUI_GetYSizeOfFont(&GUI_Font24_ASCII));//设置标题栏Y轴尺寸	Y轴尺寸
	FRAMEWIN_SetFont(Wparent[0],&GUI_Font24_ASCII);	//设置标题栏字体	
	FRAMEWIN_SetTextAlign(Wparent[0],GUI_TA_HCENTER);//设置标题栏文本对齐方式
	FRAMEWIN_SetTextColor(Wparent[0],GUI_RED);//设置标题栏文本颜色
	FRAMEWIN_SetText(Wparent[0],"biao1");//设置标题栏文本信息		
	
	FRAMEWIN_SetClientColor(Wparent[0],GUI_WHITE);//设置客户区颜色
	
	GUI_Delay(500);	//这个函数很重要		
}

void Display_listbox(void)//列表框
{	
	LISTBOX_Handle Lparent[2];
	int ySize ;	
	int Entries ;
	Entries=countof(ListBox)-1;
	
	ySize=GUI_GetYSizeOfFont(&GUI_Font24_ASCII);//计算字体的尺寸	
	
	GUI_SetBkColor(GUI_LIGHTGRAY);//背景色
	GUI_Clear();			
	GUI_SetColor(GUI_BLACK);//前景色
		
	Lparent[0]=LISTBOX_Create(ListBox,100,100,120,ySize*Entries,WM_CF_SHOW);	
	
	LISTBOX_SetBackColor(Lparent[0],0,GUI_YELLOW);//设置列表框背景颜色
	LISTBOX_SetTextColor(Lparent[0],0,GUI_RED);//设置文本颜色	
	LISTBOX_SetFont(Lparent[0],&GUI_Font24_ASCII);//设置文本字体大小
	LISTBOX_IncSel(Lparent[0]);	//增加列表框选择范围，把指定列表框的选择条向下移动一个元素		
//	Lparent[1]=LISTBOX_CreateAsChild(ListBox,Lparent[0],0,0,50,50,WM_CF_SHOW);	
//	LISTBOX_DecSel(Lparent[0]);	//增加列表框选择范围，把指定列表框的选择条向下移动一个元素
	GUI_Delay(500);	//这个函数很重要	
}
void Display_progbar(void)//进度条
{
	PROGBAR_Handle  hProgBar	;		
	
	GUI_SetBkColor(GUI_LIGHTGRAY);//设置边框背景颜色	
	GUI_Clear();	
	GUI_SetColor(GUI_BLACK);//前景色
	GUI_SetFont(&GUI_Font24_ASCII);//设置字体			
	
	GUI_DispStringAt("Progbar",50,40);		
	
	hProgBar=PROGBAR_Create(50,60,100,30,WM_CF_SHOW);
	
	PROGBAR_SetBarColor(hProgBar,0,GUI_GRAY);	//0表示进度条左侧部分，1表示进度条右侧部分
	PROGBAR_SetBarColor(hProgBar,1,GUI_WHITE);	
	PROGBAR_SetMinMax(hProgBar,0,100);//设置进度条最大、小值，
	
	PROGBAR_SetFont(hProgBar,&GUI_Font24_ASCII);//设置进度条字体大小
	PROGBAR_SetTextAlign(hProgBar,GUI_TA_HCENTER);//设置进度条显示的文本	
//	PROGBAR_SetText
	PROGBAR_SetTextColor(hProgBar,0,GUI_BLACK);
	PROGBAR_SetValue(hProgBar,20);
	printf("\r\n debug 1 ! \r\n");	
	GUI_Delay(500);	
	printf("\r\n debug 2 ! \r\n");
	PROGBAR_SetValue(hProgBar,40);
	printf("\r\n debug 3 ! \r\n");	
	GUI_Delay(500);	
	printf("\r\n debug 4 ! \r\n");
	PROGBAR_SetValue(hProgBar,60);
	printf("\r\n debug 5 ! \r\n");	
	GUI_Delay(500);	
	printf("\r\n debug 6 ! \r\n");
}

void Display_scrollbar(void)	//滚动条
{
	int ySize ;
	
	FRAMEWIN_Handle	Wparent[5] ;
//	GUI_HWIN hwin1[3] ;
	BUTTON_Handle Bparent[5];	

	ySize=GUI_GetYSizeOfFont(&GUI_Font24_ASCII);
	
	GUI_SetBkColor(GUI_LIGHTGRAY);//背景色
	GUI_Clear();			
	GUI_SetColor(GUI_BLACK);//前景色

	GUI_DispStringAt("AUCGUI WINDOW1!",0,30);		
	
															//窗口识别标志，回调指针，分配额外的字节数
	WM_CreateWindow(0, 50, 300, 300, WM_CF_SHOW, WinHandler, 0);	//创建窗口
	
	Wparent[0]=FRAMEWIN_Create("ZA",0,WM_CF_SHOW,50,50,200,200);//创建窗口边框	
	
	FRAMEWIN_SetBarColor(Wparent[0],0,GUI_BLUE);//设置标题栏背景颜色	
	FRAMEWIN_SetDefaultCaptionSize(ySize);//设置标题栏Y轴尺寸	Y轴尺寸
	FRAMEWIN_SetFont(Wparent[0],&GUI_Font24_ASCII);	//设置标题栏字体	
	FRAMEWIN_SetTextAlign(Wparent[0],GUI_TA_HCENTER);//设置标题栏文本对齐方式
	FRAMEWIN_SetTextColor(Wparent[0],GUI_WHITE);//设置标题栏文本颜色
//	FRAMEWIN_SetText(Wparent[0],"biao1");//设置标题栏文本信息		

	FRAMEWIN_SetClientColor(Wparent[0],GUI_WHITE);//设置客户区颜色
	
	
	SCROLLBAR_Create(10,28,20,174,Wparent[0],0,WM_CF_SHOW,SCROLLBAR_CF_VERTICAL);//创建滚动条

	Bparent[0]=BUTTON_Create(160,200,80,ySize,7,WM_CF_SHOW);//创建按钮
															//按键状态，有无按下
	BUTTON_SetBkColor(Bparent[0],0,GUI_GRAY);//设置按键底色
	
	BUTTON_SetFont(Bparent[0],&GUI_Font24_ASCII);			//设置按键字体 大小 	
														////按键状态，有无按下
	BUTTON_SetTextColor(Bparent[0],0,GUI_BLACK);	//设置按键字体颜色
	
	BUTTON_SetText(Bparent[0],"Abutton");	//设置按键字体

	GUI_Delay(500);	
//	SCROLLBAR_CreateIndirect
}

void Display_text(void)//显示文本信息
{
	TEXT_Handle Tparent[2] ;
	
	GUI_SetBkColor(GUI_LIGHTGRAY);//背景色
	GUI_Clear();			
	GUI_SetColor(GUI_BLACK);//前景色	
	
	Tparent[0]=TEXT_Create(50,50,300,300,0,WM_CF_SHOW,"haluo",TEXT_CF_LEFT);
	TEXT_SetBkColor(Tparent[0],GUI_GRAY);//	设置文本框背景颜色
	TEXT_SetFont(Tparent[0],&GUI_Font24_ASCII);//设置文本字体大小
	GUI_GotoXY(50,50);//移动指针
	TEXT_SetText(Tparent[0],"\n\rguangzhouyikang\nyiliaoshebeishi\nyouxiangongsi\n");
	TEXT_SetTextAlign(Tparent[0],TEXT_CF_LEFT);
	TEXT_SetTextColor(Tparent[0],GUI_BLACK);
	GUI_Delay(100);
}
void Display_box(void)//显示消息框
{
WM_SetBkWindowColor(GUI_RED);
GUI_MessageBox("This text is shown\nin a message box","Caption/Title",GUI_MESSAGEBOX_CF_MOVEABLE);
GUI_Delay(100);	
}

void Display_Dbox(void)
{
	GUI_HWIN hwin1[3] ;
	
	GUI_SetBkColor(GUI_WHITE);//背景色
	GUI_Clear();	
	
	GUI_SetColor(GUI_BLUE);//前景色
	GUI_SetFont(&GUI_Font24_ASCII);//设置字体				
	GUI_DispStringAt("chuang kou han shu !!",20,50);	
															//窗口识别标志，回调指针，分配额外的字节数
	hwin1[0]=WM_CreateWindow(10, 10, 300, 300, WM_CF_SHOW, WinHandler, 0);	//创建窗口
	
						//所有控件资源表指针	，所有控件的数量，	回调指针，父框句柄，坐标X,Y																					
	GUI_ExecDialogBox(aDialogCreate,countof(aDialogCreate),&WinHandler,hwin1[0],20,20);
//	GUI_CreateDialogBox	(aDialogCreate,countof(aDialogCreate),&cbCallback,0,0,0);
	GUI_Delay(500);	
}
/*
void GUI_AA_DrawPolyOutline(const GUI_POINT* pSrc, int NumPoints, int Thickness, int x, int y);
void GUI_AA_FillCircle     (int x0, int y0, int r);
void GUI_AA_FillPolygon    (GUI_POINT* pPoints, int NumPoints, int x0, int y0);
*/
/*
static GUI_POINT bPoints[]=
{
	{0,0},{300,20},{250,50},{150,20}
};
static GUI_POINT cPoints[]=
{
	{0,280},{300,280},{300,320},{0,320}
};*/
void Display_AA(void)
{
	GUI_SetFont(&GUI_Font24B_ASCII);//设置字体
	
	GUI_SetBkColor(GUI_WHITE);//背景色
	GUI_Clear();	
	GUI_SetColor(GUI_BLACK);//前景色		
	GUI_SetPenSize(2);
	GUI_DrawLine(0,10,300,10);	
	
	GUI_AA_EnableHiRes();
	GUI_AA_SetFactor(2);	
	GUI_AA_DrawLine(0,20,300,20);//实现不了相应功能
	
/*	GUI_AA_DrawPolyOutline(bPoints,countof(bPoints),4,10,10);
	
	GUI_AA_FillPolygon(cPoints,countof(cPoints),0,0);
*/	
	
}

void Touch_Process(void)
{
	GUI_PID_STATE STATE;	
	
	GUI_TOUCH_GetState(&STATE);

	if (STATE.Pressed == 1)
	{
		GUI_CURSOR_SetPosition(STATE.x,STATE.y);//设置光标的位置
//		GUI_CURSOR_Show();
	}
}

	FRAMEWIN_Handle hFrame;	
	EDIT_Handle Eparent;	
		
	BUTTON_Handle hButton_1;
	BUTTON_Handle hButton_2;
	BUTTON_Handle hButton_3;
	BUTTON_Handle hButton_4;
	BUTTON_Handle hButton_5;
	BUTTON_Handle hButton_6;
	BUTTON_Handle hButton_7;
	BUTTON_Handle hButton_8;
	BUTTON_Handle hButton_9;
	BUTTON_Handle hButton_0;	 	  //  10	
	BUTTON_Handle hButton_Point;	//	11
	BUTTON_Handle hButton_Add;		//	12   +
	BUTTON_Handle hButton_Red;		//	13   -
	BUTTON_Handle hButton_Mul;		//	14   *
	BUTTON_Handle hButton_Div;		//	15   /
	BUTTON_Handle hButton_Bac;		//	16  返回
	BUTTON_Handle hButton_CE;		  //	17	清零
	BUTTON_Handle hButton_EQU;		//	18  等于
	
void Button_Process(void)
{

	switch(GUI_GetKey())
	{
			case 10 : 		EDIT_SetText(Eparent,"0");			break ;
		
			case 1 : 			EDIT_SetText(Eparent,"1");			break ;
		
			case 2 : 			EDIT_SetText(Eparent,"2");			break ;
			
			case 3 : 			EDIT_SetText(Eparent,"3");			break ;
		
			case 4 : 			EDIT_SetText(Eparent,"4");			break ;
		
			case 5 : 			EDIT_SetText(Eparent,"5");			break ;
		
			case 6 : 			EDIT_SetText(Eparent,"6");			break ;
		
			case 7 : 			EDIT_SetText(Eparent,"7");			break ;
			
			case 8 : 			EDIT_SetText(Eparent,"8");			break ;
		
			case 9 : 			EDIT_SetText(Eparent,"9");			break ;	
		
			default :																			break ;
	}
}

void Touch_button(void)
{		
	hFrame = FRAMEWIN_Create("00", 0, WM_CF_SHOW, 0, 0, 320, 450);//创建窗口边框	
	FRAMEWIN_SetActive(hFrame,1);
	
	Eparent=EDIT_CreateAsChild (10, 50,300,100,hFrame, 0, WM_CF_SHOW, 300);	
	EDIT_SetTextAlign(Eparent,GUI_TA_RIGHT|GUI_TA_VCENTER);
	EDIT_SetFont(Eparent,&GUI_Font32B_ASCII);	
	EDIT_SetText(Eparent,"0");

/*************************************************************************************/	

	FRAMEWIN_SetBarColor(hFrame,0,GUI_BLUE);//设置标题栏背景颜色	
	FRAMEWIN_SetDefaultCaptionSize(30);//设置标题栏Y轴尺寸	Y轴尺寸
	FRAMEWIN_SetFont(hFrame,&GUI_Font24_ASCII);	//设置标题栏字体	
	FRAMEWIN_SetTextAlign(hFrame,GUI_TA_HCENTER);//设置标题栏文本对齐方式
	FRAMEWIN_SetTextColor(hFrame,GUI_RED);//设置标题栏文本颜色
	FRAMEWIN_SetText(hFrame,"zeng an");//设置标题栏文本信息		
	FRAMEWIN_SetClientColor(hFrame,GUI_LIGHTGRAY);//设置客户区颜色
	
/*******************************************************************************/		
	hButton_7 = BUTTON_CreateAsChild(10, 190, 55, 55, hFrame, 7, WM_CF_SHOW);
	BUTTON_SetText(hButton_7, "7");
	BUTTON_SetFont(hButton_7,&GUI_Font32_ASCII);			//设置按键字体 大小 
	
	hButton_8 = BUTTON_CreateAsChild(70, 190, 55, 55, hFrame, 8, WM_CF_SHOW);
	BUTTON_SetText(hButton_8, "8");
	BUTTON_SetFont(hButton_8,&GUI_Font32_ASCII);			//设置按键字体 大小 
	
	hButton_9 = BUTTON_CreateAsChild(130, 190,55, 55, hFrame, 9, WM_CF_SHOW);
	BUTTON_SetText(hButton_9, "9");
	BUTTON_SetFont(hButton_9,&GUI_Font32_ASCII);			//设置按键字体 大小 
	
	hButton_Div = BUTTON_CreateAsChild(190, 190, 55, 55, hFrame, 15, WM_CF_SHOW);
	BUTTON_SetText(hButton_Div, "/");
	BUTTON_SetFont(hButton_Div,&GUI_Font32_ASCII);			//设置按键字体 大小 	
	
	hButton_CE = BUTTON_CreateAsChild(250, 190, 55, 55, hFrame, 17, WM_CF_SHOW);
	BUTTON_SetText(hButton_CE, "CE");
	BUTTON_SetFont(hButton_CE,&GUI_Font32_ASCII);			//设置按键字体 大小 		
/**********************************************************************************/	
	hButton_4 = BUTTON_CreateAsChild(10, 255, 55, 55, hFrame, 4, WM_CF_SHOW);
	BUTTON_SetText(hButton_4, "4");
	BUTTON_SetFont(hButton_4,&GUI_Font32_ASCII);			//设置按键字体 大小 	
	
	hButton_5 = BUTTON_CreateAsChild(70, 255, 55, 55, hFrame, 5, WM_CF_SHOW);
	BUTTON_SetText(hButton_5, "5");
	BUTTON_SetFont(hButton_5,&GUI_Font32_ASCII);			//设置按键字体 大小 	
	
	hButton_6 = BUTTON_CreateAsChild(130, 255,55, 55, hFrame, 6, WM_CF_SHOW);
	BUTTON_SetText(hButton_6, "6");
	BUTTON_SetFont(hButton_6,&GUI_Font32_ASCII);			//设置按键字体 大小 	
	
	hButton_Mul = BUTTON_CreateAsChild(190, 255, 55, 55, hFrame, 14, WM_CF_SHOW);
	BUTTON_SetText(hButton_Mul, "*");
	BUTTON_SetFont(hButton_Mul,&GUI_Font32_ASCII);			//设置按键字体 大小 	
	
	hButton_Bac = BUTTON_CreateAsChild(250, 255, 55, 55, hFrame, 16, WM_CF_SHOW);
	BUTTON_SetText(hButton_Bac, "BAC");
	BUTTON_SetFont(hButton_Bac,&GUI_Font24_ASCII);			//设置按键字体 大小 		
/**********************************************************************************/	
	hButton_1 = BUTTON_CreateAsChild(10, 320, 55, 55, hFrame, 1, WM_CF_SHOW);
	BUTTON_SetText(hButton_1, "1");
	BUTTON_SetFont(hButton_1,&GUI_Font32_ASCII);			//设置按键字体 大小 	
	
	hButton_2 = BUTTON_CreateAsChild(70, 320, 55, 55, hFrame, 2, WM_CF_SHOW);
	BUTTON_SetText(hButton_2, "2");
	BUTTON_SetFont(hButton_2,&GUI_Font32_ASCII);			//设置按键字体 大小 	
	
	hButton_3 = BUTTON_CreateAsChild(130, 320,55, 55, hFrame, 3, WM_CF_SHOW);
	BUTTON_SetText(hButton_3, "3");
	BUTTON_SetFont(hButton_3,&GUI_Font32_ASCII);			//设置按键字体 大小 	
	
	hButton_Red = BUTTON_CreateAsChild(190, 320, 55, 55, hFrame, 13, WM_CF_SHOW);
	BUTTON_SetText(hButton_Red, "-");
	BUTTON_SetFont(hButton_Red,&GUI_Font32_ASCII);			//设置按键字体 大小 		
/**********************************************************************************/	
	hButton_EQU = BUTTON_CreateAsChild(250, 320, 55, 120, hFrame, 18, WM_CF_SHOW);
	BUTTON_SetText(hButton_EQU, "=");
	BUTTON_SetBkColor(hButton_EQU,0,GUI_GREEN);//设置按键底色
	BUTTON_SetFont(hButton_EQU,&GUI_Font32_ASCII);			//设置按键字体 大小 		
	
	hButton_Add = BUTTON_CreateAsChild(190, 385, 55, 55, hFrame, 12, WM_CF_SHOW);
	BUTTON_SetText(hButton_Add, "+");
	BUTTON_SetFont(hButton_Add,&GUI_Font32_ASCII);			//设置按键字体 大小 	
	
	hButton_0 = BUTTON_CreateAsChild(10, 385, 110, 55, hFrame, 10, WM_CF_SHOW);
	BUTTON_SetText(hButton_0, "0");
	BUTTON_SetFont(hButton_0,&GUI_Font32_ASCII);			//设置按键字体 大小 		
	
	hButton_Point = BUTTON_CreateAsChild(130, 385,55, 55, hFrame, 11, WM_CF_SHOW);
	BUTTON_SetText(hButton_Point, ".");
	BUTTON_SetFont(hButton_Point,&GUI_Font32_ASCII);			//设置按键字体 大小 		
	
	GUI_Delay(1000);
	printf("\r\n 运行完毕！！ \r\n");
}

