home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / msdos / graphics / tcxl.arc / TCXLWIN.H < prev   
C/C++ Source or Header  |  1988-05-12  |  11KB  |  234 lines

  1.  
  2. /*
  3.    ┌──────────────────────────────────────────────────────────────────────────┐
  4.    │                                                                          │
  5.    │  TCXLWIN.H - TCXL (c) 1987, 1988 by Mike Smedley.                        │
  6.    │                                                                          │
  7.    │  This header file contains function prototypes and definitions for       │
  8.    │  windowing functions.                                                    │
  9.    │                                                                          │
  10.    └──────────────────────────────────────────────────────────────────────────┘
  11. */
  12.  
  13.  
  14. #if __STDC__
  15. #define _Cdecl
  16. #else
  17. #define _Cdecl cdecl
  18. #endif
  19.  
  20.  
  21. /*---------------------------[ Function Prototypes ]-------------------------*/
  22.  
  23. int      _Cdecl disktowin(char *fname);
  24. void     _Cdecl videoinit(void);
  25. int      _Cdecl wactiv(int whandle);
  26. int      _Cdecl wcclear(int attr);
  27. int      _Cdecl wchgattr(int newattr);
  28. int      _Cdecl wclose(void);
  29. int      _Cdecl wcloseall(void);
  30. int      _Cdecl wclreol(void);
  31. int      _Cdecl wcopy(int nsrow,int nscol);
  32. char    *_Cdecl werrmsg(void);
  33. int      _Cdecl wgetc(void);
  34. int      _Cdecl wgetchf(char *valid);
  35. int      _Cdecl wgets(char *str);
  36. int      _Cdecl wgetns(char *str,int max);
  37. int      _Cdecl wgotoxy(int wrow,int wcol);
  38. int     *_Cdecl whide(int **wbuf);
  39. int      _Cdecl whline(int wsrow,int wscol,int count,int btype);
  40. int      _Cdecl winpdef(int wrow,int wcol,char *str,int ftype,int fattr);
  41. int      _Cdecl winpread(void);
  42. int      _Cdecl winputsf(char *str,char *fmt);
  43. int      _Cdecl winpxcel(void);
  44. int      _Cdecl wintodisk(int srow,int scol,int erow,int ecol,char *fname);
  45. int      _Cdecl wmbardef(int wrow,int wcol,int attr,char *str,int tagchar);
  46. int      _Cdecl wmbarget(int barattr,int taginit,int pulldown);
  47. int      _Cdecl wmbarxcel(void);
  48. int      _Cdecl wmove(int nsrow,int nscol);
  49. int      _Cdecl wopen(int srow,int scol,int erow,int ecol,int btype,int attr);
  50. int      _Cdecl wpgotoxy(int wrow,int wcol);
  51. int      _Cdecl wprintc(int wrow,int wcol,int attr,int ch);
  52. int      _Cdecl wprintf(const char *format,...);
  53. int      _Cdecl wprints(int wrow,int wcol,int attr,char *str);
  54. int      _Cdecl wputc(int ch);
  55. int      _Cdecl wputns(char *str,int width);
  56. int      _Cdecl wputs(char *str);
  57. int      _Cdecl wreadcur(int *wrow,int *wcol);
  58. void     _Cdecl wrestore(int *wbuf);
  59. int     *_Cdecl wsave(int srow,int scol,int erow,int ecol);
  60. int      _Cdecl wscanf(const char *format,...);
  61. int      _Cdecl wscroll(int count,int direction);
  62. int      _Cdecl wsize(int nerow,int necol);
  63. int      _Cdecl wtextattr(int attr);
  64. int      _Cdecl wtitle(char *str,int tpos);
  65. int      _Cdecl wvline(int wsrow,int wscol,int count,int btype);
  66.  
  67.  
  68. /*----------------------[ structure of window records ]----------------------*/
  69.  
  70. struct  _wrecord {
  71.     int *wbuf;                          /*  address of window's buffer       */
  72.     int whandle;                        /*  window's handle                  */
  73.     unsigned char srow;                 /*  start row of window              */
  74.     unsigned char scol;                 /*  start column of window           */
  75.     unsigned char erow;                 /*  end row of window                */
  76.     unsigned char ecol;                 /*  end column of window             */
  77.     unsigned char row;                  /*  window's current cursor row      */
  78.     unsigned char column;               /*  window's current cursor column   */
  79.     unsigned char attr;                 /*  window's current text attribute  */
  80.     unsigned char btype;                /*  window's box type                */
  81.     unsigned char wattr;                /*  window's initial text attribute  */
  82.     char *title;                        /*  address of window's title str    */
  83.     unsigned char tpos;                 /*  position of window's title       */
  84. };
  85.  
  86.  
  87. /*-------------------[ variables used by window manager ]--------------------*/
  88.  
  89. extern struct _wrecord *_wrecord;      /*  array of window records           */
  90. extern int _wcurrent;                  /*  array subscript of active window  */
  91. extern int _werrno;                    /*  last window function error code   */
  92. extern int _whandle;                   /*  last assigned handle number       */
  93. extern int _wesc;                      /*  Escape checking flag              */
  94.  
  95.  
  96. /*-------------[ error codes returned from windowing functions ]-------------*/
  97.  
  98. #define W_NOERROR   0                   /*  no error                        */
  99. #define W_ALLOCERR  1                   /*  memory allocation error         */
  100. #define W_NOTFOUND  2                   /*  window handle not found         */
  101. #define W_NOACTIVE  3                   /*  no active (open) windows        */
  102. #define W_INVCOORD  4                   /*  invalid coordinates             */
  103. #define W_ESCPRESS  5                   /*  Escape key was pressed          */
  104. #define W_INVFORMT  6                   /*  invalid format string           */
  105. #define W_NOINPDEF  7                   /*  no inputs defined               */
  106. #define W_INVFTYPE  8                   /*  invalid field type              */
  107. #define W_STRLONG   9                   /*  string too long for window      */
  108. #define W_NOBARDEF  10                  /*  no bar menu records defined     */
  109. #define W_INVTAGCH  11                  /*  invalid tag character           */
  110. #define W_TITLLONG  12                  /*  title string too long           */
  111. #define W_INVBTYPE  13                  /*  invalid box type                */
  112. #define W_INVTPOS   14                  /*  invalid title position          */
  113.  
  114.  
  115. /*---------------------[ direction codes for wscroll() ]---------------------*/
  116.  
  117. #define DOWN        0                   /*  scroll down                     */
  118. #define UP          1                   /*  scroll up                       */
  119.  
  120.  
  121. /*---------------------[ window input record definition ]--------------------*/
  122.  
  123. struct _winprec {
  124.     unsigned char wrow;                 /*  start of input - window row     */
  125.     unsigned char wcol;                 /*  start of input - window column  */
  126.     char *str;                          /*  address of receiving string     */
  127.     int length;                         /*  length of receiving string      */
  128.     char *buf;                          /*  address of temp receive string  */
  129.     unsigned char ftype;                /*  input field type                */
  130.     unsigned char fattr;                /*  input field attribute           */
  131. };
  132.  
  133.  
  134. /*-----------------[ variables used by window input functions ]--------------*/
  135.  
  136. extern struct _winprec *_winprec;       /*  window input record array       */
  137. extern int _winplast;                   /*  highest inp rec array subscript */
  138. extern int _winpattr;                   /*  attribute of input fields       */
  139.  
  140.  
  141. /*------------------[ window bar menu record definition ]--------------------*/
  142.  
  143. struct _wmbarrec {
  144.     unsigned char wrow;                 /*  start of text opt - window row  */
  145.     unsigned char wcol;                 /*  start of text opt - window col  */
  146.     unsigned char attr;                 /*  attribute of text option        */
  147.     char *str;                          /*  string containing text option   */
  148.     unsigned char tagchar;              /*  menu bar tag character          */
  149. };
  150.  
  151.  
  152. /*-------------[ variables used by window menu bar functions ]---------------*/
  153.  
  154. extern struct _wmbarrec *_wmbarrec;     /*  window menu bar record array    */
  155. extern int _wmbarlast;                  /*  highest menu bar rec subscript  */
  156.  
  157.  
  158. /*--------------[ pull-down menu definitions for wmbarget() ]----------------*/
  159.  
  160. #define PDMAIN      1                   /*  main menu of a pull-down system  */
  161. #define PDPREV      2                   /*  main menu, select prev pull-down */
  162. #define PDNEXT      3                   /*  main menu, select next pull-down */
  163. #define PDMENU      4                   /*  pull-down menu                   */
  164.  
  165.  
  166. /*------------[ window title position definitions for wtitle() ]-------------*/
  167.  
  168. #define TDELETE     0                   /*  delete title                    */
  169. #define TLEFT       1                   /*  left justified                  */
  170. #define TCENTER     2                   /*  centered                        */
  171. #define TRIGHT      3                   /*  right justified                 */
  172.  
  173.  
  174. /*-----------------------[ video RAM segment address ]-----------------------*/
  175.  
  176. extern unsigned _videoseg;
  177.  
  178.  
  179. /*--------------[ attribute codes for functions that use them ]--------------*/
  180.  
  181.     /*  attribute codes are created by ORing the codes for foreground
  182.         color, background color, and optionally blink, together.  For
  183.         example, to create an attribute code for light blue on green,
  184.         you would use LBLUE|_GREEN and to make the foreground blink,
  185.         you would add |BLINK onto the end of that.                      */
  186.  
  187. #ifndef BLACK                           /*  foreground colors  */
  188. #define BLACK       0                   
  189. #define BLUE        1
  190. #define GREEN       2
  191. #define CYAN        3
  192. #define RED         4
  193. #define MAGENTA     5
  194. #define BROWN       6
  195. #define YELLOW      14
  196. #define WHITE       15
  197. #endif
  198. #ifndef LGREY
  199. #define LGREY       7                   /*  TCXL abbreviates LIGHT as L    */
  200. #define DGREY       8                   /*  and DARK as D for ease of use  */
  201. #define LBLUE       9
  202. #define LGREEN      10
  203. #define LCYAN       11
  204. #define LRED        12
  205. #define LMAGENTA    13
  206.  
  207. #define _BLACK      0                   /*  background colors  */
  208. #define _BLUE       16
  209. #define _GREEN      32
  210. #define _CYAN       48
  211. #define _RED        64
  212. #define _MAGENTA    80
  213. #define _BROWN      96
  214. #define _LGREY      112
  215.  
  216. #define BLINK       128                 /*  blink attribute  */
  217. #endif
  218.  
  219.  
  220. /*-----------------------[ Macro-Function Definitions ]----------------------*/
  221.  
  222. #ifndef attrib
  223. #define attrib(f,b,i,bl)    ((b<<4)|(f)|(i<<3)|(bl<<7))
  224. #endif
  225. #ifndef clrwin
  226. #define clrwin(a,b,c,d)     gotoxy_(a,b);fill(a,b,c,d,' ',(readchat()>>8))
  227. #endif
  228. #define wclear()            wcclear(_wrecord[_wcurrent].wattr)
  229. #define wisactiv(a)         ((a==_wcurrent)?1:0)
  230. #define wnopen()            (_wcurrent+1)
  231. #define wsetesc(a)          _wesc=((a)?ON:OFF)
  232. #define wunhide(a)          whide(a)
  233.  
  234.