home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 26 / CD_ASCQ_26_1295.iso / vrac / volume_3.zip / WIN_IT.CPP < prev    next >
C/C++ Source or Header  |  1995-11-02  |  3KB  |  121 lines

  1. #include <CONIO.H>
  2. #include <STDIO.H>
  3. #include <STDLIB.H>
  4. #include <ALLOC.H>
  5. #include <GRAPHICS.H>
  6. #include <DOS.H>
  7. #include <IOSTREAM.H>
  8.  
  9.  
  10. #ifndef __MOUSE_H
  11.     #include "C:\TC\mouse.h"
  12. #endif
  13.  
  14.  
  15. #ifndef __GRAPHVGA_H
  16.     #include "C:\TC\graphvga.h"
  17. #endif
  18.  
  19.  
  20.  
  21. //Constructor
  22. Windw::Windw(int U_X,int U_Y,int L_X,int H_Y,int bor,int buf)
  23. {
  24. Upper_Left_X = U_X;
  25. Upper_Left_Y = U_Y;
  26. Length_X = L_X;
  27. Height_Y = H_Y;
  28. border = bor;
  29. buffered = buf;
  30. buffer = NULL;
  31. }
  32.  
  33.  
  34.  
  35. int Windw::RemoveWindows(void)
  36. {
  37. if(buffer != NULL)
  38.     {
  39.     Hide_Mouse();
  40.     putimage(Upper_Left_X,Upper_Left_Y,buffer,COPY_PUT);
  41.     free(buffer);
  42.     Display_Mouse();
  43.     }
  44. return TRUE;
  45. }
  46.  
  47.  
  48.  
  49. int Windw::Store_BackGround(void)
  50. {
  51.    int size;
  52.    Hide_Mouse();
  53.    // Save Windows screen area, if requested.
  54.    if (buffered)
  55.    {
  56.       if ((size = imagesize(Upper_Left_X, Upper_Left_Y, Upper_Left_X + Length_X, Upper_Left_Y + Height_Y)) < 0)
  57.     {
  58.      printf("Image too large to store.");
  59.      free(buffer);
  60.      Display_Mouse();
  61.      return FALSE;
  62.      }
  63.       else
  64.       {
  65.      if ((buffer = (int *)malloc(size)) == NULL)
  66.         {
  67.         printf("Not enough memory.");
  68.         free(buffer);
  69.         Display_Mouse();
  70.         return FALSE;
  71.         }
  72.      else
  73.         getimage(Upper_Left_X, Upper_Left_Y, Upper_Left_X+Length_X, Upper_Left_Y+Height_Y, buffer);
  74.       }
  75.    }
  76. Display_Mouse();
  77. return TRUE;
  78. }
  79.  
  80.  
  81.  
  82. void Windw::DrawWindows (void)
  83. {
  84.  
  85.    Hide_Mouse();
  86.    //Draw basic 3D Windows.
  87.    setcolor(WHITE);
  88.    moveto(Upper_Left_X+Length_X, Upper_Left_Y);
  89.    lineto(Upper_Left_X, Upper_Left_Y);
  90.    lineto(Upper_Left_X, Upper_Left_Y+Height_Y);
  91.    moveto(Upper_Left_X+Length_X-1, Upper_Left_Y+1);
  92.    lineto(Upper_Left_X+1, Upper_Left_Y+1);
  93.    lineto(Upper_Left_X+1, Upper_Left_Y+Height_Y-1);
  94.    setcolor(DARKGRAY);
  95.    moveto(Upper_Left_X+1, Upper_Left_Y+Height_Y);
  96.    lineto(Upper_Left_X+Length_X, Upper_Left_Y+Height_Y);
  97.    lineto(Upper_Left_X+Length_X, Upper_Left_Y);
  98.    moveto(Upper_Left_X+2, Upper_Left_Y+Height_Y-1);
  99.    lineto(Upper_Left_X+Length_X-1, Upper_Left_Y+Height_Y-1);
  100.    lineto(Upper_Left_X+Length_X-1, Upper_Left_Y+1);
  101.    setfillstyle(SOLID_FILL, LIGHTGRAY);
  102.    bar(Upper_Left_X+2, Upper_Left_Y+2, Upper_Left_X+Length_X-2, Upper_Left_Y+Height_Y-2);
  103.  
  104.    //Draw border, if requested.
  105.    if (border) {
  106.       setcolor(DARKGRAY);
  107.       moveto(Upper_Left_X+Length_X-10, Upper_Left_Y+10);
  108.       lineto(Upper_Left_X+10, Upper_Left_Y+10);
  109.       lineto(Upper_Left_X+10, Upper_Left_Y+Height_Y-10);
  110.       setcolor(WHITE);
  111.       lineto(Upper_Left_X+Length_X-10, Upper_Left_Y+Height_Y-10);
  112.       lineto(Upper_Left_X+Length_X-10, Upper_Left_Y+10);
  113.    }
  114.    Display_Mouse();
  115. }
  116.  
  117.  
  118.  
  119.  
  120.  
  121.