Esempio n. 1
0
int
clip_DISPBOXTERM(ClipMachine * ClipMachineMemory)
{
   int Top = _clip_parni(ClipMachineMemory, 1);

   int Left = _clip_parni(ClipMachineMemory, 2);

   int Bottom = _clip_parni(ClipMachineMemory, 3);

   int Right = _clip_parni(ClipMachineMemory, 4);

   int cl = 0;

   unsigned char *chars = (unsigned char *) _clip_parcl(ClipMachineMemory, 5, &cl);

   int chars_n = _clip_parni(ClipMachineMemory, 5);

   char *color = _clip_parc(ClipMachineMemory, 6);

   if (cl > 0 || !chars)
      disp_box(ClipMachineMemory, Top, Left, Bottom, Right, chars, cl, chars_n, color, 0);
   else
      disp_box(ClipMachineMemory, Top, Left, Bottom, Right, (unsigned char *) ("         "), 9, chars_n, color, 0);

   return 0;
}
Esempio n. 2
0
int popup( char* menu[], char* keys, int count, int x, int y, int border )
/*弹出式菜单的显示*/
{
	register int i, len;
	int endx, endy, choice;
	unsigned int *p;
	if((x>24)||(x<0)||(y>79)||(y<0))
	{
		printf("范围错");
		return -2;
	}
	len = 0;
	for( i = 0; i < count; i++ )
		if( strlen( menu[i]) > len ) len = strlen( menu[i] );
	endy = len + 2 + y;
	endx = count + 1 + x;
	if((endx+1>24)||(endy+1>79))
	{
		printf("菜单不匹配");
		return -2;
	}
	p = (unsigned int *) malloc((endx-x+1)*(endy-y+1));
	if( !p ) exit(1);
	save_video( x, endx + 1, y, endy+1, p );
	if( border ) disp_box( y, x, endy, endx, YELLOW );
	display_menu( menu, x + 1, y + 1, count );
	choice = get_resp( x + 1, y, count, menu, keys );
	restore_video( x, endx + 1, y, endy + 2, (unsigned char* ) p);
	free( p );
	return choice;
}