home *** CD-ROM | disk | FTP | other *** search
- //
- // *************************************************************************
- // * *
- // * OMEGA C++ Windowing Class Library *
- // * ================================= *
- // * *
- // * Copyright 1991,92 Tom Clancy *
- // * Submitted to the public domain, April 1992 *
- // * *
- // *************************************************************************
- // * *
- // * Window Class Object *
- // * *
- // *************************************************************************
- //
-
- #ifndef _OMWINDOW
- #define _OMWINDOW
- #endif
-
- #ifndef _OMSCREEN
- #include "omscreen.hpp"
- #define _OMSCREEN
- #endif
-
- #define CLOSECHAR 0xFE
- #define EXPANDCHAR 0x18
- #define CONTRACTCHAR 0x19
- #define RESIZECHAR1 0xC4
- #define RESIZECHAR2 0xD9
-
-
-
-
- enum Titleposition {
- tRight,
- tLeft,
- tCenter,
- };
-
- enum windowjust {
- mNojust,
- mCenterX,
- mCenterY,
- mCenterBoth
- };
-
- class oWindow : public oScreen {
-
- image Behind;
- image Shside1,Shside2;
-
- int Startx, Starty, Endx, Endy;
- int Oldx, Oldy, Oldx2, Oldy2;
- int Shx1, Shy1, Shx2, Shy2;
- int Side1, Side2;
- int Len, Wid, OldWid, OldLen;
- int FGcolor, BKcolor;
- int Shadowed;
- int ShadDir;
- int Opened;
- int Wstyle;
- int Just;
-
- char title[130];
- int tPos;
- int tFGcolor, tBKcolor;
- int SolidHeader;
-
- int Candrag, Canclose, Canexpand, Canresize;
- int Buttoncolor;
- int Expanded;
-
- int MinWid, MinLen;
- int BoundX, BoundY, BoundX2, BoundY2;
-
- int TxtStartx, TxtStarty;
-
- void drawshadow();
- void hideshadow();
- char *makewinstr(int x, int y, char *s, char *t);
-
- public:
-
- oWindow(int x, int y, int w, int l, int fg, int bk, int style);
- oWindow();
- ~oWindow();
-
- void setwindow(int x, int y, int w, int l, int fg, int bk, int style);
- void setshadow(int on, int dir) {Shadowed=on; ShadDir=dir;}
- void settitle(char *s, int tpos, int fgcolor, int bkcolor);
- void setbuttoncolors(int c) {Buttoncolor=c;}
- void setjustify(windowjust j);
- void setboundaries(int x, int y, int x2, int y2) {
- BoundX=x; BoundY=y; BoundX2=x2; BoundY2=y2;
- }
- virtual void snaptocenter();
- void openwin();
- void closewin();
- void disposewin();
- void showtitle();
- int withinwindow();
-
- void dragging(int d);
- void closing(int c) {Canclose=c;}
- void expanding(int e);
- void resizing(int r);
- void setsolidheader(int h) {SolidHeader=h;}
- void setminlen(int m) {MinLen=m;}
- void setminwid(int m) {MinWid=m;}
-
- int getleft() {return Startx;}
- int getright() {return Endx;}
- int gettop() {return Starty;}
- int getbottom() {return Endy;}
- int getwid() {return Wid;}
- int getlen() {return Len;}
- int getfgcolor() {return FGcolor;}
- int getbkcolor() {return BKcolor;}
- int gettfgcolor() {return tFGcolor;}
- int gettbkcolor() {return tBKcolor;}
- void setfgcolor(int fg) {FGcolor=fg;}
- void setbkcolor(int bk) {BKcolor=bk;}
- int getstyle() {return Wstyle;}
- int getsolidheader() {return SolidHeader;}
- int getshaddir() {return ShadDir;}
-
- int onclose();
- int onresize();
- int ondrag();
- int onexpand();
-
- void mDragwin();
- void mSizewin();
- void expandwin();
- void contractwin();
-
- virtual void display_info();
- virtual void display_help();
-
- int handle_key_event();
- int handle_mouse_event();
- void run();
-
- // Window Relative mouse routines
-
- void getmouse(int &x, int &y, int &b);
-
- // Window Writing Routines (Will Clip at the edge of the windows)
-
- void writeat(int x, int y, int fg, int bk, char *str);
- void plainwriteat(int x, int y, char *str);
- void chwriteat(int x, int y, int fg, int bk, unsigned char c);
- void plainchwriteat(int x, int y, unsigned char c);
- void writeshadow(int x, int y);
- void movexy(int x, int y);
- //void wherexy(int &x, int &y);
- void attribln(int y, int x1, int x2, int fg, int bk);
-
- };
-