home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / progut~1 / stdwin.zoo / h / stdwin.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-17  |  4.8 KB  |  171 lines

  1. /* GENERIC STDWIN -- INTERFACE HEADER FILE. */
  2.  
  3. #ifndef GENERIC_STDWIN
  4.  
  5. #define GENERIC_STDWIN
  6.     /* So this header file is skipped if included twice */
  7.  
  8. #define CURSOR_CARET
  9.     /* Defined so textedit will always set the caret at the start of
  10.        the focus -- useful only for ASCII terminals. */
  11.  
  12. #ifdef __GNUC__
  13. #  ifdef atarist
  14. #    include <stddef.h>
  15. #    include <stdlib.h>
  16. #    include <string.h>
  17. #    include <memory.h>
  18. #    include <unixlib.h>
  19. #  endif
  20. #endif
  21.  
  22. #ifndef _SIZE_T
  23. #define size_t    int /* or whatever is appro */
  24. #define _SIZE_T
  25. #endif
  26.  
  27. #ifndef ARGS
  28. #ifdef __STDC__
  29. #define ARGS(x) x
  30. #else
  31. #define ARGS(x) ()    /* replace by x for ANSI C */
  32. #endif
  33. #endif
  34.  
  35. #ifndef NOARGS
  36. #ifdef __STDC__
  37. #define NOARGS (void)
  38. #else
  39. #define NOARGS ()    /* replace by (void) for ANSI C */
  40. #endif
  41. #endif
  42.  
  43. #ifndef bool
  44. #define bool int
  45. #endif
  46.  
  47. void winit NOARGS;
  48. void winitnew ARGS((int *pargc, char ***pargv));
  49. void wdone NOARGS;
  50.  
  51. void wgetscrsize ARGS((int *pwidth, int *pheight));
  52. void wgetscrmm ARGS((int *pmmwidth, int *pmmheight));
  53.  
  54. void wsetmaxwinsize ARGS((int width, int height));
  55. void wsetdefwinsize ARGS((int width, int height));
  56. void wsetdefwinpos ARGS((int h, int v));
  57.  
  58. #define MENU struct menu
  59.  
  60. /* The contents of a text attributes struct are disclosed here because
  61.    the interface allows the programmer to declare objects of this type.
  62.    (I'm not so sure anymore that this is the right thing to do!) */
  63.  
  64. struct textattr {
  65.     short font;
  66.     unsigned char size;
  67.     unsigned char style;
  68. };
  69.  
  70. #define TEXTATTR struct textattr
  71.  
  72. #ifndef WINDOW
  73.  
  74. struct window {
  75.     short tag;
  76. };
  77.  
  78. #define WINDOW struct window
  79.  
  80. #endif
  81.  
  82. WINDOW *wopen ARGS((char *title,
  83.         void (*drawproc)(/*WINDOW *win,
  84.                 int left, int top, int right, int bottom*/)));
  85. void wclose ARGS((WINDOW *win));
  86. #define wgettag(win) ((win)->tag)
  87. #define wsettag(win, newtag) ((win)->tag= newtag)
  88. void wsetactive ARGS((WINDOW *win));
  89. WINDOW *wgetactive NOARGS;
  90. void wgetwinsize ARGS((WINDOW *win, int *width, int *height));
  91. void wsetdocsize ARGS((WINDOW *win, int width, int height));
  92. void wsettitle ARGS((WINDOW *win, char *title));
  93.  
  94. void wsetorigin ARGS((WINDOW *win, int h, int v));
  95. void wshow ARGS((WINDOW *win, int left, int top, int right, int bottom));
  96. void wchange ARGS((WINDOW *win, int left, int top, int right, int bottom));
  97. void wscroll ARGS((WINDOW *win, int left, int top, int right, int bottom,
  98.     int dh, int dv));
  99.  
  100. void wfleep NOARGS;
  101. void wmessage ARGS((char *str));
  102. void wperror ARGS((char *name));
  103. bool waskstr ARGS((char *prompt, char *buf, int buflen));
  104. int waskync ARGS((char *question, int dflt));
  105. bool waskfile ARGS((char *prompt, char *buf, int buflen, bool newfile));
  106.  
  107. void wsetcaret ARGS((WINDOW *win, int h, int v));
  108. void wnocaret ARGS((WINDOW *win));
  109.  
  110. void wsettimer ARGS((WINDOW *win, int deciseconds));
  111.  
  112. MENU *wmenucreate ARGS((int id, char *title));
  113. void wmenudelete ARGS((MENU *mp));
  114. int wmenuadditem ARGS((MENU *mp, char *text, int shortcut));
  115. void wmenusetitem ARGS((MENU *mp, int i, char *text));
  116. void wmenusetdeflocal ARGS((bool local));
  117. void wmenuattach ARGS((WINDOW *win, MENU *mp));
  118. void wmenudetach ARGS((WINDOW *win, MENU *mp));
  119. void wmenuenable ARGS((MENU *mp, int item, int flag));
  120. void wmenucheck ARGS((MENU *mp, int item, int flag));
  121.  
  122. /* The following is only available in termcap stdwin: */
  123. void wsetshortcut ARGS((int id, int item, char *keys));
  124.  
  125. #include "stdevent.h"
  126.  
  127. void wgetevent ARGS((EVENT *ep));
  128. void wungetevent ARGS((EVENT *ep));
  129. void wupdate ARGS((WINDOW *win));
  130. void wbegindrawing ARGS((WINDOW *win));
  131. void wenddrawing ARGS((WINDOW *win));
  132. void wflush NOARGS;
  133.  
  134. void wdrawline ARGS((int h1, int v1, int h2, int v2));
  135. void wxorline ARGS((int h1, int v1, int h2, int v2));
  136. void wdrawcircle ARGS((int h, int v, int radius));
  137. void wdrawelarc ARGS((int h, int v, int hrad, int vrad, int ang1, int ang2));
  138. void wdrawbox ARGS((int left, int top, int right, int bottom));
  139. void werase ARGS((int left, int top, int right, int bottom));
  140. void wpaint ARGS((int left, int top, int right, int bottom));
  141. void winvert ARGS((int left, int top, int right, int bottom));
  142. void wshade ARGS((int left, int top, int right, int bottom, int percent));
  143.  
  144. int wdrawtext ARGS((int h, int v, char *str, int len));
  145. int wdrawchar ARGS((int h, int v, int c));
  146. int wlineheight NOARGS;
  147. int wbaseline NOARGS;
  148. int wtextwidth ARGS((char *str, int len));
  149. int wcharwidth ARGS((int c));
  150. int wtextbreak ARGS((char *str, int len, int width));
  151.  
  152. void wgettextattr ARGS((TEXTATTR *attr));
  153. void wsettextattr ARGS((TEXTATTR *attr));
  154. void wgetwintextattr ARGS((WINDOW *win, TEXTATTR *attr));
  155. void wsetwintextattr ARGS((WINDOW *win, TEXTATTR *attr));
  156.  
  157. void wsetplain NOARGS;
  158. void wsethilite NOARGS;
  159. void wsetinverse NOARGS;
  160. void wsetitalic NOARGS;
  161. void wsetbold NOARGS;
  162. void wsetbolditalic NOARGS;
  163. void wsetunderline NOARGS;
  164.  
  165. void wsetfont ARGS((char *fontname));
  166. void wsetsize ARGS((int pointsize));
  167.  
  168. #include "stdtext.h"
  169.  
  170. #endif /* GENERIC_STDWIN */
  171.