home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / xgalaga-2_0_tar.gz / xgalaga-2_0_tar / xgalaga-2.0 / Wlib.h < prev    next >
C/C++ Source or Header  |  1998-04-12  |  7KB  |  192 lines

  1. /* Wlib.h
  2.  *
  3.  * Include file for the Windowing interface.
  4.  *
  5.  * Kevin P. Smith  6/11/89
  6.  *
  7.  * The deal is this:
  8.  *   Call W_Initialize(), and then you may call any of the listed fuinctions.
  9.  *   Also, externals you are allowed to pass or use include W_BigFont,
  10.  *     W_RegularFont, W_UnderlineFont, W_HighlightFont, W_White, W_Black,
  11.  *     W_Red, W_Green, W_Yellow, W_Cyan, W_Grey, W_Textwidth, and W_Textheight.
  12.  */
  13.  
  14. #ifndef Wlib_h_
  15. #define Wlib_h_
  16.  
  17. #define AUTOKEY
  18.  
  19. #include <X11/Xlib.h>
  20. #include "copyright2.h"
  21.  
  22. struct window;
  23.  
  24. #ifdef __STDC__
  25. #define P(s) s
  26. #else
  27. #define P(s) ()
  28. #endif
  29.  
  30. /* image struct to hold all info about an image, be it a bitmap or 
  31.    pixmap.  Replaces W_Icon.  [BDyess] */
  32. typedef struct {
  33.   /* public */
  34.   unsigned int width, height, frames;    /* frames = nviews for ships */
  35.   int xpm;            /* is it a Pixmap (> 1 plane) or not */
  36.   char *filename;        /* filename without .xpm/.xbm extension*/
  37.   int loaded;            /* 1 if loaded (for on-demand loading) */
  38.   int alternate;        /* offset into images array for alternate
  39.                                    image to use if this one can't be
  40.                    loaded */
  41.   int bad;            /* if set, loading failed */
  42.   int compiled_in;        /* image is compiled into the binary */
  43.   unsigned char *xbmdata;    /* ptr to compiled in xbm data.  Only valid */
  44.                                 /* if compiled_in is true. */
  45.   char **xpmdata;        /* ptr to compiled in xpm data.  Only valid */
  46.                                 /* if compiled_in is true. */
  47.   /* X Data structures (private) */
  48.   Pixmap pixmap, clipmask;    /* clipmask only used if in xpm mode */
  49. } W_Image;
  50.  
  51. /*typedef char *W_Window;*/
  52. typedef char *W_Icon;
  53. typedef char *W_Font;
  54. typedef int W_Color;
  55.  
  56. typedef int (*W_Callback) ();
  57. typedef char *W_Window;
  58.  
  59. extern W_Font W_BigFont, W_RegularFont, W_UnderlineFont, W_HighlightFont;
  60. extern W_Color W_White, W_Black, W_Red, W_Green, W_Yellow, W_Cyan, W_Grey, W_DarkGrey;
  61. extern int W_Textwidth, W_Textheight, W_BigTextwidth, W_BigTextheight;
  62. extern int W_FastClear;
  63.  
  64. #define W_EV_EXPOSE    1
  65. #define W_EV_KEY    2
  66. #define W_EV_BUTTON    3
  67.  
  68. #ifdef AUTOKEY
  69. #define W_EV_KEY_OFF    4
  70. #endif                /* AUTOKEY */
  71.  
  72. #define W_LBUTTON    1
  73. #define W_MBUTTON    2
  74. #define W_RBUTTON    3
  75.  
  76. typedef struct event {
  77.     int     type;
  78.     W_Window Window;
  79.     int     key;
  80.     int     x, y;
  81. }       W_Event;
  82.  
  83. #define W_BoldFont W_HighlightFont
  84.  
  85. /*#define W_StringWidth(st,font) (strlen(st)*W_Textwidth)*/
  86.  
  87. #if 0
  88. /* Don't even know what this is supposed to do... */
  89. #define W_SetSensitive(w,b)
  90. #endif /*0*/
  91.  
  92. extern int autoPoint, W_KeyDepth, animPointers, useWorkbench;
  93. extern unsigned long w_socket;
  94. #endif    /* AMIGA */
  95.  
  96. #if 0
  97. void W_FreeImage P((W_Image *image));
  98. W_Image * W_BitmapToImage P((unsigned int width, unsigned int height, char *bits));
  99. void W_DrawImage P(( W_Window window, int x, int y, int frame, W_Image *image, 
  100.     W_Color color));
  101.  
  102. extern void W_WritePixmap P((W_Window window, int x, int y, int frame,
  103.     W_Icon bit));
  104. extern W_Icon W_StorePixmap P((char *filename, int frames));
  105.  
  106. void W_ClearBuffer P((W_Window window));
  107. int W_IsBuffered P((W_Window window));
  108. void W_Buffer P((W_Window window, int on));
  109. void W_DisplayBuffer P((W_Window window));
  110.  
  111. void W_DrawImageBar P((W_Window win, int x, int y, int len, W_Image *image));
  112. void W_FillArea P((W_Window window, int x, int y, unsigned int width, unsigned int height, 
  113.     W_Color color));
  114. extern void W_GetPixmapInfo P((W_Icon pixmap, int *width, int *height, 
  115.     int *frames));
  116. extern void W_DrawShield P((W_Window window, int centerx, int centery, 
  117.     int diameter, W_Color color));
  118. extern void W_Initialize P((char *display));
  119. extern W_Window W_MakeWindow P((char *name, int x, int y, int width, 
  120.     int height, W_Window parent, char *cursname, int border, 
  121.     W_Color color));
  122. extern W_Icon W_StoreBitmap P((int width, int height, char *data));
  123. extern void W_FreeBitmap P((W_Icon bit));
  124. extern W_Window W_MakeTextWindow P((char *name, int x, int y, int width, 
  125.     int height, W_Window parent, char *cursname, int border));
  126. extern W_Window W_MakeScrollingWindow P((char *name, int x, int y, int width,
  127.     int height, W_Window parent, char *cursname, int border));
  128. extern W_Window W_MakeMenu P((char *name, int x, int y, int width, int height,
  129.     W_Window parent, int border));
  130. extern void W_WriteText P((W_Window window, int x, int y, W_Color color,
  131.     char *str, int len, W_Font font));
  132. void W_MaskText P((W_Window window, int x, int y, W_Color color,
  133.     char *str, int len, W_Font font));
  134. extern void W_DirectMaskText P((W_Window window, int x, int y, W_Color color,
  135.     char *str, int len, W_Font font));
  136. extern void W_WriteBitmap P((W_Window win, int x, int y, W_Icon icon, W_Color color));
  137. extern void W_CacheClearArea();
  138.  
  139. extern void W_ClearArea( /* window, x, y, width, height, color */ );
  140. extern void W_MakeLine( /* window, x0, y0, x1, y1, color */ );
  141. extern void W_DrawPoint( /* window, x, y, color */ );
  142. void W_MapWindow( /* window */ );
  143. extern void W_UnmapWindow( /* window */ );
  144. extern int W_EventsPending( /* void */ );
  145. extern void W_NextEvent( /* W_Event *event */ );
  146. extern void W_TileWindow( /* window, bitmap */ );
  147. extern void W_UnTileWindow( /* window */ );
  148. extern void W_ChangeBorder( /* window, color */ );
  149. extern void 
  150. W_DefineCursor(    /* window, width, height, data, mask, xhot, yhot */ );
  151. extern int W_IsMapped( /* window */ );
  152. extern void W_Beep( /* void */ );
  153. extern void W_DestroyWindow( /* window */ );
  154. extern int W_WindowWidth( /* window */ );
  155. extern int W_WindowHeight( /* window */ );
  156. extern int W_Socket( /* void */ );
  157. extern void W_ClearWindow( /* window */ );
  158. extern void W_SetIconWindow( /* mainwindow, iconwindow */ );
  159. extern int W_StringWidth( /* string, font */ );
  160. extern void W_TranslatePoints( /* window, x, y */ );
  161. extern void W_ResizeWindow( /* window, neww, newh */ );
  162. extern void W_ResizeMenu( /* window, neww, newh */ );
  163. extern void W_ResizeText( /* window, neww, newh */ );
  164. extern void W_Deiconify( /* window */ );
  165. extern void W_GetMouse();
  166. extern void W_BlankCursor();
  167. extern void W_Flush();
  168.  
  169. extern W_Icon W_MakeShieldBitmap( /* width,height, window */ );
  170.  
  171. extern W_Image *W_CreateCombinedImage();
  172.  
  173. #endif
  174.  
  175. #include "Wproto.h"
  176.  
  177. #ifdef AMIGA
  178. void switchScreen();
  179. /* things ignored or different for now: */
  180. /* some laziness on my part, mostly just unneeded. */
  181. #define W_CacheLine W_MakeLine
  182. #define W_CachePoint W_DrawPoint
  183. #define W_FlushPointCaches(w)
  184. #define W_FlushLineCaches(w)
  185. #define W_DefineTextCursor(w) W_DefineMessageCursor(w)
  186. #define W_RevertCursor(w) W_DefineTCrossCursor(w)
  187. #define W_RenameWindow(w,s)
  188.  
  189. extern W_Icon W_ReadPixmap(W_Window window, char *path, char *name, int width, int height, int x, int y, int mask);
  190.  
  191. #endif
  192.