home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / UTILS / S / SGTOOL12.ARC / LIBC128.ARC / VDCWIN.C < prev    next >
C/C++ Source or Header  |  1993-08-10  |  1KB  |  55 lines

  1. /*
  2. SG C Tools 1.2
  3.  
  4. (C) 1993 Steve Goldsmith
  5. All Rights Reserved
  6.  
  7. Compiled with HI-TECH C 3.09 (CP/M-80).
  8. */
  9.  
  10. #include <string.h>
  11. #include <hitech.h>
  12. #include <vdc.h>
  13.  
  14. uchar vdcWinChars[] = {32,32,244,231,204,239,250};
  15. uchar vdcShadow = vdcAltChrSet+vdcDarkGray;
  16.  
  17. /* draw window given x1, y1, x2, y2 rectangle in current page */
  18.  
  19. void winvdc(uchar X1, uchar Y1, uchar X2, uchar Y2, uchar Attr, char *Title)
  20. {
  21.   char  ChSave;
  22.   uchar InsideLen, TitleLen;
  23.   register uchar Y;
  24.  
  25.   InsideLen = X2-X1-1;
  26.   clrwinvdc(X1,Y1,X2,Y2,vdcWinChars[0]);
  27.   clrwinattrvdc(X1,Y1,X2,Y2,Attr);
  28.   filldspvdc(X1,Y1,InsideLen+2,vdcWinChars[1]);
  29.   if (Title != "")
  30.   {
  31.     TitleLen = strlen(Title);
  32.     if (TitleLen > InsideLen)
  33.     {
  34.       ChSave = Title[InsideLen];
  35.       Title[InsideLen] = 0;
  36.       printstrvdc(X1+1,Y1,Attr,Title);
  37.       Title[InsideLen] = ChSave;
  38.     }
  39.     else
  40.       printstrvdc(((InsideLen-TitleLen) >> 1)+X1+1,Y1,Attr,Title);
  41.   }
  42.   fillattrvdc(X1,Y1,InsideLen+2,Attr | vdcRvsVid);
  43.   filldspvdc(X1,Y2,1,vdcWinChars[4]);
  44.   filldspvdc(X1+1,Y2,InsideLen,vdcWinChars[5]);
  45.   filldspvdc(X2,Y2,1,vdcWinChars[6]);
  46.   fillattrvdc(X1+1,Y2+1,InsideLen+2,vdcShadow);
  47.   fillattrvdc(X2+1,Y2,1,vdcShadow);
  48.   for(Y1++, Y2--, Y = Y1; Y <= Y2; Y++)
  49.   {
  50.     filldspvdc(X1,Y,1,vdcWinChars[2]);
  51.     filldspvdc(X2,Y,1,vdcWinChars[3]);
  52.     fillattrvdc(X2+1,Y,1,vdcShadow);
  53.   }
  54. }
  55.