Category : Files from Magazines
Archive   : DDJSRC.ZIP
Filename : WINDOW.H

 
Output of file : WINDOW.H contained in archive : DDJSRC.ZIP

/* ---------- window.h ----------- */

void establish_window(int,int,int,int,int,int,int);
void window_title(char *);
void clear_window(void);
void delete_window(void);
void scroll_window(int);
void text_window(char **, int);
int select_window(int, int, int, int (*)(int,int));
int getkey(void);
void hidecursor(void);
void set_cursor_type(unsigned);
void clear_screen(void);
void writeline(int, int, char *);
void current_window(void);
void error_message(char *);

#define MAX_WINDOWS 10 /* maximum windows open at once */

#define TRUE 1
#define FALSE 0
#define ERROR -1

#define BELL 7
#define ESC 27
#define SHIFT_HT 143
#define CTRL_T 20
#define CTRL_B 2
#define CTRL_D 4
#define ALT_D 160
#define ALT_F 161
#define ALT_E 146
#define ALT_O 152
#define ALT_S 159

#define F1 187
#define F2 188
#define F3 189
#define F4 190
#define F5 191
#define F6 192
#define F7 193
#define F8 194
#define F9 195
#define F10 196
#define ALT_F7 238

#define HOME 199
#define UP 200
#define PGUP 201
#define BS 203
#define FWD 205
#define END 207
#define DN 208
#define PGDN 209
#define INS 210
#define DEL 211

#define CTRL_HOME 247
#define CTRL_BS 243
#define CTRL_FWD 244
#define CTRL_END 245

/* --------- window definition structure ------------ */
struct wn {
int lf,tp,rt,bt; /* window position */
int ht,wd; /* window dimensions */
int wx, wy; /* window cursor */
int wtop; /* top text line */
int wlines; /* total text lines */
int fg,bg; /* window colors */
char *wsave; /* video memory save buffer */
char **wtext; /* pointer to text */
};

/* ------ internal Turbo C stuff ------- */
void far * pascal __vptr(int, int);
void pascal __vram(void far *, void far *, int);
extern struct {
char filler1[4];
char attribute;
char filler2[5];
char snow;
} _video;

/* ------------ window colors --------------- */
#define TEXTFG WHITE /* data display screen */
#define TEXTBG BLACK
#define BLOCKFG BLACK /* data blocks */
#define BLOCKBG WHITE
#define HELPBG WHITE /* help windows */
#define HELPFG BLACK
#define MENUBG WHITE /* menus */
#define MENUFG BLACK
#define SELECTBG BLACK /* menu selector bars */
#define SELECTFG WHITE
#define ENTRYFG WHITE /* data entry windows */
#define ENTRYBG BLACK
#define FIELDFG BLACK /* data entry fields */
#define FIELDBG WHITE
#define ERRORFG BLACK /* error messages */
#define ERRORBG WHITE

/* -------------- microsft.h ---------------- */
/* #include this file at the end of window.h */

#if COMPILER == MSOFT

/* this line replaces the select_window prototype in window.h */
int select_window(int, int, int, int (*)(int,int));

#define setmem(bf,sz,c) memset(bf,c,sz)
#define movmem(fr,to,ln) memmove(to,fr,ln)
#define cprintf wprintf
#define cputs(s) wprintf(s)
#define putch(c) wputch(c)
#define getch() wgetch()

void window(int lf,int tp,int rt,int bt);
void puttext(int lf,int tp,int rt,int bt,char *sv);
void gettext(int lf,int tp,int rt,int bt,char *sv);
void movetext(int lf, int tp, int rt, int bt, int lf1, int tp1);
void gotoxy(int x,int y);
void textcolor(int cl);
void textbackground(int cl);
int wherex(void);
int wherey(void);
void wprintf(char *, ...);
void wputch(int c);
int wgetch(void);

#define BLACK 0
#define BLUE 1
#define GREEN 2
#define CYAN 3
#define RED 4
#define MAGENTA 5
#define BROWN 6
#define LIGHTGRAY 7
#define DARKGRAY 8
#define LIGHTBLUE 9
#define LIGHTGREEN 10
#define LIGHTCYAN 11
#define LIGHTRED 12
#define LIGHTMAGENTA 13
#define YELLOW 14
#define WHITE 15

#endif