#ifndef __WINDOW_H #define __WINDOW_H #pragma interface #include #include extern "C" { void PSend(); void PSbeep(int); int PSprtscr(const char *); void PSrefresh(); void PSsync(); void dropscrn(); void restscrn(); } class Window { Window(const Window &); Window& operator=(const Window &); friend class DebugWinMask; static unsigned char far **mask; static short numwin; /* number of visible windows */ static short totwin; /* total number of windows */ short wnum; /* index in order */ Rect screenloc; static void reset(const Rect &); void _draw(const Rect &); void remove(); /* remove from order array */ protected: short cur; /* cursor type */ short row,col; /* cursor location */ /* set non-transparent areas of window. Derived classes can override * this to make portions of the window transparent. */ virtual void set(const Rect &); public: static Rect screen; /* physical screen */ enum { MAXWIN = 256 }; void write(int row,int col,int cnt,const char *txt, CHTYPE attr); void write(int row,int col,int cnt,const CHTYPE far *txt); void fill(const Rect &,CHTYPE attr); Rect loc; /* physical location of window */ enum Dir { DIR_UP,DIR_DOWN,DIR_LEFT,DIR_RIGHT,DIR_NONE }; Window(); virtual void draw(const Rect &) = 0; void redraw(); /* redraw entire window */ void slide(const Rect &,Dir,int); void slide(const Rect &,Dir,int,bool redraw); virtual void curpos(int r,int c); /* set cursor position */ void curpos() { curpos(row,col); } void curtype(int c); /* set cursor type */ void curtype() { curtype(cur); } virtual void setphys(const Rect &); /* set physical location */ virtual void hide(); /* remove from screen */ virtual void top(); /* move to top */ virtual void bury(); /* move to bottom */ static Window *gettop() { /* get top window */ return numwin ? order[numwin - 1] : 0; } /* static */void sync(); bool istop() const { // is this the top window? return this == gettop(); } bool ontop() const; // is window unobscured? bool iscur() const; /* is this the cursor window? */ bool ishidden() const { /* is this window hidden? */ return this->wnum == MAXWIN; } virtual ~Window(); static void beep(int type = 0) { PSbeep(type); } private: static Window *order[MAXWIN]; }; class Background: virtual public Window { Background(const Background &); Background&operator=(const Background &); int color; // must manually align for gcc2.2 bug public: Background(CHTYPE = ' '); void draw(const Rect&); }; struct Invisible: virtual Window { Invisible(const Invisible &); Invisible&operator=(const Invisible &); void draw(const Rect &) {} void set(const Rect &) {} }; class Zoomable: virtual public Window { Zoomable(const Zoomable &); Zoomable&operator=(const Zoomable &); Rect orig; int zoomed; // must manually align for gcc2.2 bug public: Zoomable() { zoomed = 0; } void zoom(const Rect &); void unzoom(); void sizeFromUser(); bool isZoomed() const { return zoomed; } }; #endif