home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_10_11 / 1011054a < prev    next >
Text File  |  1992-09-08  |  1KB  |  80 lines

  1.  
  2. **************************************************
  3.  
  4. // WINDOW.H (Listing 9)
  5. // Window class header  -- Williams
  6. #ifndef _WINCLASSDEF
  7. #define _WINCLASSDEF
  8.  
  9. #include <stddef.h>
  10. #include <conio.h>
  11. #include "region.h"
  12.  
  13.  
  14. // The basic window class
  15. extern class win : public region
  16. {
  17. protected:
  18.  
  19. // Class variable holds top window
  20. static win *topwin;
  21. // Last window
  22. static win *lastwin;
  23.  
  24. // Cursor location when window isn't on top
  25. int oldx;
  26. int oldy;
  27.  
  28. // Default screen color
  29. unsigned int color;
  30.  
  31. // Pointer to next window on stack
  32. win *next;    // Pointer to next window
  33. win *prev;              // Previous window
  34.  
  35. // Margins support borders on the windows
  36. int margin;
  37.  
  38. // Private method to register top window
  39. void settop(void);
  40.  
  41. public:
  42. // Methods:
  43. // Constructor:
  44. win(int x0=1,int y0=1,int x1=80,int y1=25,
  45.     unsigned int clr=7,int mar=0);
  46.  
  47. // Destructor. This is virtual to support
  48. // boxwindows, etc.
  49. virtual ~win();
  50.  
  51. // Force window to top of stack
  52. void maketop(void);
  53. // Set color
  54. void setcolor(int n)
  55.   {
  56.   color=n;
  57.   }
  58. // Fetch top window
  59.  static win *top_window(void)
  60.    {
  61.    return topwin;
  62.    }
  63. };
  64.  
  65. // Windows with borders
  66. extern class boxwin : public win
  67. {
  68. public:
  69. boxwin(int x0=2,int y0=2,int x1=79,int y1=24,
  70.        unsigned int clr=7,int boxt=0);
  71. };
  72.  
  73. // General purpose box drawing routine
  74. void draw_box(int type,int x0,int y0,int x1,int y1);
  75.  
  76. #endif
  77.  
  78.  
  79.  
  80.