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 95 /* For XF86VIDMODE Support */ 96 #ifdef XF86VIDMODE 97 #include <X11/extensions/xf86dga.h> 98 #include <X11/extensions/xf86vmode.h> 99 100 struct xf86vidmode_data { 101 int vidmode_available; 102 XF86VidModeModeInfo orig_mode; 103 int orig_viewport_x; 104 int orig_viewport_y; 105 }; 106 107 extern struct xf86vidmode_data XF86VidModeData; 108 #endif 109 110 #endif /* AMIGA */ 111 112 #if 0 113 void W_FreeImage P((W_Image *image)); 114 W_Image * W_BitmapToImage P((unsigned int width, unsigned int height, char *bits)); 115 void W_DrawImage P(( W_Window window, int x, int y, int frame, W_Image *image, 116 W_Color color)); 117 118 extern void W_WritePixmap P((W_Window window, int x, int y, int frame, 119 W_Icon bit)); 120 extern W_Icon W_StorePixmap P((char *filename, int frames)); 121 122 void W_ClearBuffer P((W_Window window)); 123 int W_IsBuffered P((W_Window window)); 124 void W_Buffer P((W_Window window, int on)); 125 void W_DisplayBuffer P((W_Window window)); 126 127 void W_DrawImageBar P((W_Window win, int x, int y, int len, W_Image *image)); 128 void W_FillArea P((W_Window window, int x, int y, unsigned int width, unsigned int height, 129 W_Color color)); 130 extern void W_GetPixmapInfo P((W_Icon pixmap, int *width, int *height, 131 int *frames)); 132 extern void W_DrawShield P((W_Window window, int centerx, int centery, 133 int diameter, W_Color color)); 134 extern void W_Initialize P((char *display)); 135 extern W_Window W_MakeWindow P((char *name, int x, int y, int width, 136 int height, W_Window parent, char *cursname, int border, 137 W_Color color)); 138 extern W_Icon W_StoreBitmap P((int width, int height, char *data)); 139 extern void W_FreeBitmap P((W_Icon bit)); 140 extern W_Window W_MakeTextWindow P((char *name, int x, int y, int width, 141 int height, W_Window parent, char *cursname, int border)); 142 extern W_Window W_MakeScrollingWindow P((char *name, int x, int y, int width, 143 int height, W_Window parent, char *cursname, int border)); 144 extern W_Window W_MakeMenu P((char *name, int x, int y, int width, int height, 145 W_Window parent, int border)); 146 extern void W_WriteText P((W_Window window, int x, int y, W_Color color, 147 char *str, int len, W_Font font)); 148 void W_MaskText P((W_Window window, int x, int y, W_Color color, 149 char *str, int len, W_Font font)); 150 extern void W_DirectMaskText P((W_Window window, int x, int y, W_Color color, 151 char *str, int len, W_Font font)); 152 extern void W_WriteBitmap P((W_Window win, int x, int y, W_Icon icon, W_Color color)); 153 extern void W_CacheClearArea(); 154 155 extern void W_ClearArea( /* window, x, y, width, height, color */ ); 156 extern void W_MakeLine( /* window, x0, y0, x1, y1, color */ ); 157 extern void W_DrawPoint( /* window, x, y, color */ ); 158 void W_MapWindow( /* window */ ); 159 extern void W_UnmapWindow( /* window */ ); 160 extern int W_EventsPending( /* void */ ); 161 extern void W_NextEvent( /* W_Event *event */ ); 162 extern void W_TileWindow( /* window, bitmap */ ); 163 extern void W_UnTileWindow( /* window */ ); 164 extern void W_ChangeBorder( /* window, color */ ); 165 extern void 166 W_DefineCursor( /* window, width, height, data, mask, xhot, yhot */ ); 167 extern int W_IsMapped( /* window */ ); 168 extern void W_Beep( /* void */ ); 169 extern void W_DestroyWindow( /* window */ ); 170 extern int W_WindowWidth( /* window */ ); 171 extern int W_WindowHeight( /* window */ ); 172 extern int W_Socket( /* void */ ); 173 extern void W_ClearWindow( /* window */ ); 174 extern void W_SetIconWindow( /* mainwindow, iconwindow */ ); 175 extern int W_StringWidth( /* string, font */ ); 176 extern void W_TranslatePoints( /* window, x, y */ ); 177 extern void W_ResizeWindow( /* window, neww, newh */ ); 178 extern void W_ResizeMenu( /* window, neww, newh */ ); 179 extern void W_ResizeText( /* window, neww, newh */ ); 180 extern void W_Deiconify( /* window */ ); 181 extern void W_GetMouse(); 182 extern void W_BlankCursor(); 183 extern void W_Flush(); 184 185 extern W_Icon W_MakeShieldBitmap( /* width,height, window */ ); 186 187 extern W_Image *W_CreateCombinedImage(); 188 189 #endif 190 191 #include "Wproto.h" 192 193 #ifdef AMIGA 194 void switchScreen(); 195 /* things ignored or different for now: */ 196 /* some laziness on my part, mostly just unneeded. */ 197 #define W_CacheLine W_MakeLine 198 #define W_CachePoint W_DrawPoint 199 #define W_FlushPointCaches(w) 200 #define W_FlushLineCaches(w) 201 #define W_DefineTextCursor(w) W_DefineMessageCursor(w) 202 #define W_RevertCursor(w) W_DefineTCrossCursor(w) 203 #define W_RenameWindow(w,s) 204 205 extern W_Icon W_ReadPixmap(W_Window window, char *path, char *name, int width, int height, int x, int y, int mask); 206 207 #endif 208