home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / pcmagazi / 1992 / 04 / window.h < prev   
C/C++ Source or Header  |  1992-01-03  |  2KB  |  91 lines

  1. // window.h RHS 11/1/91
  2.  
  3. #if !defined(WINDOW_H)
  4. #define WINDOW_H
  5.  
  6. #include"screen.h"
  7.  
  8. const WIN_SCROLLUP = 0;
  9. const WIN_SCROLLDN = 1;
  10.  
  11. const DWORD WIN_DEFAULT_POSITION = 0xffffffff;
  12. const BYTE WIN_DEFAULT_FILLCHAR = ' ';
  13. extern BYTE WIN_DEFAULT_COLORS;
  14.  
  15. class Window : public Screen
  16.     {
  17. protected:
  18.     char    far *title;
  19.     BYTE    attributes;
  20.     BYTE    top;
  21.     BYTE    left;
  22.     BYTE    height;
  23.     BYTE    width;
  24.     BYTE    clientheight;
  25.     BYTE    clientwidth;
  26.     BYTE    fillchar;
  27.     BYTE    color;
  28.     BYTE    curRow;
  29.     BYTE    curCol;
  30.     BYTE    isOpen;
  31.  
  32. // ADD DEFAULT SETTINGS HERE!
  33.     void SetDefaults(char *title, 
  34.         DWORD position,
  35. //        BYTE top, BYTE left, BYTE height, BYTE width, 
  36.         BYTE attrib, BYTE fc, BYTE clr);
  37.  
  38.     void Init(void);
  39. public:
  40. //    Window(void);
  41.     Window(char *title = "", 
  42.         DWORD position = WIN_DEFAULT_POSITION,
  43. //        BYTE top, BYTE left, BYTE height, BYTE width, 
  44.         BYTE attrib = 0, 
  45.         BYTE fc = WIN_DEFAULT_FILLCHAR, 
  46.         BYTE clr = WIN_DEFAULT_COLORS);
  47.     void Paint(void);
  48.     ~Window(void);
  49.     WORD far *GotoXY(int row, int col);
  50.     void Open(void);
  51.     void Clear(void);
  52.     void ClearEntireWindow(void);
  53.     WORD ScreenChar(BYTE c) {   return MakeCell(c,params.currAttr); }
  54.     WORD WindowChar(BYTE c) {   return MakeCell(c,color);   }
  55.     void cdecl AtSay(int row, int col, char *fmt, ...);
  56.     void AtSay(int row, int col, char *buffer, BYTE color);
  57.     void Scroll(void);
  58.     WORD Lines(void)        {   return clientheight;    }
  59.     WORD Cols(void)         {   return clientwidth;     }
  60.     void Scroll(int direction,int numlines = 1);
  61.     void cdecl Printf(char *fmt, ...);
  62.     void Puts(char *str);
  63.     void SetTitle(char *newtitle = NULL);
  64.     void GetTitle(char *buf);
  65.     BYTE GetColors(void)    {   return color;           }
  66.     static void SetDefaultColors(BYTE newcolors);
  67.     };
  68.  
  69. class PopWin : public Window
  70.     {
  71.     BYTE far *saved_screen;
  72.  
  73. public:
  74.     PopWin(char *title = "", 
  75.         DWORD position = WIN_DEFAULT_POSITION,
  76.         BYTE attrib = 0, 
  77.         BYTE fc = WIN_DEFAULT_FILLCHAR, 
  78.         BYTE clr = WIN_DEFAULT_COLORS)
  79.         : Window(title, position, attrib, fc, clr)
  80.         {
  81.         saved_screen = NULL;
  82.         }
  83.     ~PopWin(void);
  84.     void Open(void);
  85.     void Close(void);
  86.     };
  87.  
  88. #endif
  89.  
  90.  
  91.