Exemple #1
0
/****************************************************************************
* 名称:GUI_WindowsDraw()
* 功能:显示窗口。根据提供的窗口参数进行画窗口。
* 入口参数:win		窗口句柄
* 出口参数:返回0表示操作失败,返回1表示操作成功
****************************************************************************/
uint8  GUI_WindowsDraw(WINDOWS *win)
{  uint8  *str;
   int32  bak, bak1, bak2;
   
   /* 参数过滤,若窗口起出范围,则返回0 */
   if( ( (win->with)<20 ) || ( (win->hight)<20 ) ) return(0);		// 宽度、高度检查,限制最小窗口
   if( (win->x + win->with ) > GUI_LCM_XMAX ) return(0);			// 窗口宽度是否溢出
   if( (win->y + win->hight ) > GUI_LCM_YMAX ) return(0);			// 窗口高度是否溢出
    
   /* 开始画窗口 */
   GUI_RectangleFill(win->x, win->y, win->x + win->with - 1, win->y + win->hight - 1, back_color);
   GUI_Rectangle(win->x, win->y, win->x + win->with - 1, win->y + win->hight - 1, disp_color);	// 画窗口
   GUI_HLine(win->x, win->y + 12, win->x + win->with - 1, disp_color);							// 画标题目栏
   GUI_RLine(win->x + 12, win->y, win->y + 12, disp_color);										// 画关闭窗号按钮
   GUI_Line(win->x, win->y, win->x + 12, win->y + 12, disp_color);
   GUI_Line(win->x + 12, win->y, win->x, win->y + 12, disp_color);
   

   /* 写标题 */
   if( win->title != NULL ) 
   {  str = win->title;
      bak = win->x + 15;
      bak1 = win->y + 3;
      bak2 = win->x + win->with -1;
     
      while(1)						
      {  if( (bak+8) > bak2 ) break;								// 判断标题是否溢出
         if(*str=='\0') break;										// 判断字符串是否结束
         
         GUI_PutChar(bak, bak1, *str++);							// 显示标题
         bak += 6;
      }
   }


   /* 写状态栏 */
   if( win->state != NULL )
   {  if( win->hight < 60) return(0);								// 判断是否可以画状态栏
      /* 画状态栏 */
      GUI_HLine(win->x, win->y + win->hight - 11, win->x + win->with - 1, disp_color);
      
      str = win->state;
      bak = win->x + 3;
      bak1 = win->y + win->hight - 9;
      bak2 = win->x + win->with -1;
      
      while(1)						
      {  if( (bak+8) > bak2 ) break;								// 判断标题是否溢出
         if(*str=='\0') break;										// 判断字符串是否结束
         
         GUI_PutChar(bak, bak1, *str++);							// 显示标题
         bak += 6;
      }      
   }
   
   return(1);

}
Exemple #2
0
/****************************************************************************
* 名称:GUI_PutString()
* 功能:输出显示字符串(没有自动换行功能)。
* 入口参数: x		指定显示位置,x坐标
*           y		指定显示位置,y坐标
*           str		要显示的ASCII码字符串
* 出口参数:无
* 说明:操作失败原因是指定地址超出有效范围。
****************************************************************************/
void  GUI_PutString(uint32 x, uint32 y, char *str)
{  while(1)
   {  if( (*str)=='\0' ) break;
      if( GUI_PutChar(x, y, *str++)==0 ) break;
      x += 6;								// 下一个字符显示位置,y不变(即不换行)
   }
}
Exemple #3
0
/****************************************************************************
* 名称:GUI_PutNoStr()
* 功能:输出显示字符串(没有自动换行功能),若显示的字符个数大于指定个数,则直接退出。
* 入口参数: x		指定显示位置,x坐标
*           y		指定显示位置,y坐标
*           str		要显示的ASCII码字符串。
*           no      最大显示字符的个数
* 出口参数:无
* 说明:操作失败原因是指定地址超出有效范围。
****************************************************************************/
void  GUI_PutNoStr(uint32 x, uint32 y, char *str, uint8 no)
{  if(no==0) return;
   for(; no>0; no--)
   {  if( (*str)=='\0' ) break;
      if( GUI_PutChar(x, y, *str++)==0 ) break;
      x += 6;								// 下一个字符显示位置,y不变(即不换行)
   }
}