~ubuntu-branches/ubuntu/trusty/netrek-client-cow/trusty

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/* Wlib.h

 * Include file for the Windowing interface.
 *
 * Kevin P. Smith  6/11/89
 *
 * The deal is this:
 *   Call W_Initialize(), and then you may call any of the listed fuinctions.
 *   Also, externals you are allowed to pass or use include W_BigFont,
 *     W_RegularFont, W_UnderlineFont, W_HighlightFont, W_White, W_Black,
 *     W_Red, W_Green, W_Yellow, W_Cyan, W_Grey, W_Textwidth, and W_Textheight.
 *
 */

#ifndef _h_Wlib
#define _h_Wlib


#include "copyright2.h"
#include "defs.h"

typedef void (*W_Callback) ();

typedef char *W_Window;

typedef struct event
 {
	int type;
	W_Window Window;
	unsigned char key;
	int x, y;
#ifdef MOUSE_AS_SHIFT
	int modifier;
#endif
 }
W_Event;

/* mapping for some X11 keys that are not represented by ASCII or Latin-1 */
#define W_Key_Up   1
#define W_Key_Down 2

extern W_Callback W_GetWindowKeyDownHandler (W_Window w);
extern W_Callback W_GetWindowKeyUpHandler (W_Window w);
extern W_Callback W_GetWindowButtonHandler (W_Window w);
extern W_Callback W_GetWindowExposeHandler (W_Window w);
extern void W_SetWindowKeyDownHandler (W_Window w, W_Callback c);
extern void W_SetWindowKeyUpHandler (W_Window w, W_Callback c);
extern void W_SetWindowButtonHandler (W_Window w, W_Callback c);
extern void W_SetWindowExposeHandler (W_Window w, W_Callback c);

typedef char *W_Icon;
typedef char *W_Font;
typedef int W_Color;

extern W_Font W_BigFont, W_RegularFont, W_UnderlineFont, W_HighlightFont,
  W_IndyFont;
extern W_Color W_White, W_Black, W_Red, W_Green, W_Yellow, W_Cyan, W_Grey;
#ifdef RACE_COLORS
extern W_Color W_Ind, W_Fed, W_Rom, W_Kli, W_Ori;
#endif
extern int W_BigTextwidth, W_BigTextheight, W_Textwidth, W_Textheight;
extern int W_FastClear;
extern W_Font W_MyPlanetFont, W_FriendlyPlanetFont, W_EnemyPlanetFont;

extern void W_Initialize (char *str);
extern void W_GetPixmaps(W_Window t, W_Window g);
extern void W_RenameWindow(W_Window window, char *str);
extern W_Window W_MakeWindow (char *name, int x, int y, int width, int height, W_Window parent, int border, W_Color color);
extern W_Icon W_StoreBitmap (int width, int height, char *data, W_Window window);
extern W_Window W_MakeTextWindow (char *name, int x, int y, int width, int height, W_Window parent, int border);
extern W_Window W_MakeScrollingWindow (char *name, int x, int y, int width, int height, W_Window parent, int border);
extern void W_FlushScrollingWindow(W_Window window);
extern void W_SetSensitive(W_Window w, int v);
extern W_Window W_MakeMenu (char *name, int x, int y, int width, int height, W_Window parent, int border);
extern void W_WriteText (W_Window window, int x, int y, W_Color color, char *str, int len, W_Font font);
extern void W_MaskText (W_Window window, int x, int y, W_Color color, char *str, int len, W_Font font);
extern void W_WriteBitmap (int x, int y, W_Icon bit, W_Color color);
extern void W_ClearArea (W_Window window, int x, int y, int width, int height);
extern void W_MakeLine (W_Window window, int x0, int y0, int x1, int y1, W_Color color);
extern void W_MapWindow (W_Window window);
extern void W_UnmapWindow (W_Window window);
extern int W_EventsPending (void);
extern void W_NextEvent (W_Event *wevent);
extern void W_SetWindowName(W_Window window, char *name);
extern void W_TileWindow (W_Window window, W_Icon bit);
extern void W_UnTileWindow (W_Window window);
extern void W_ChangeBorder (W_Window window, int color);
void W_DefineMapcursor(W_Window window);
void W_DefineLocalcursor(W_Window window);
void W_DefineFedCursor(W_Window window);
void W_DefineRomCursor(W_Window window);
void W_DefineKliCursor(W_Window window);
void W_DefineOriCursor(W_Window window);
void W_DefineTrekCursor(W_Window window);
void W_DefineWarningCursor(W_Window window);
void W_DefineTextCursor(W_Window window);
extern void W_DefineCursor (W_Window window, int width, int height, char *bits, char *mask, int xhot, int yhot);
extern int W_IsMapped (W_Window window);
void W_ReinitMenu(W_Window window, int neww, int newh);
void W_ResizeMenu(W_Window window, int neww, int newh);
void W_ResizeWindow(W_Window window, int neww, int newh);
extern void W_Beep (void);
extern void W_DestroyWindow (W_Window window);
extern int W_WindowWidth (W_Window window);
extern int W_WindowHeight (W_Window window);
extern int W_Socket (void);
extern void W_ClearWindow (W_Window window);
extern void W_SetIconWindow (W_Window main, W_Window icon);
extern void W_CacheLine(W_Window, int, int, int, int, int);
extern void W_MakeTractLine(W_Window, int, int, int, int, W_Color);
extern void W_MakePhaserLine(W_Window, int, int, int, int, W_Color);
extern void W_WriteCircle(W_Window, int, int, int, W_Color);
extern void W_WriteTriangle(W_Window, int, int, int, int, W_Color);
extern void W_CacheClearArea(W_Window, int, int, int, int);
extern void W_FlushClearAreaCache(W_Window);
extern void W_FlushLineCaches(W_Window);
extern void W_ResizeTextWindow(W_Window, int, int);
extern int W_Mono(void);
extern int W_EventsQueuedCk(void);
extern void W_OverlayBitmap(int, int, W_Icon, W_Color);
extern void W_WriteTriangle(W_Window, int, int, int, int, W_Color);
extern void W_Flush(void);

#define W_EV_EXPOSE	1
#define W_EV_KEY	2
#define W_EV_BUTTON	3

#ifdef MOUSE_AS_SHIFT
#define W_EV_MKEY	4
#endif

#ifdef AUTOKEY
#define W_EV_KEY_OFF	4
#endif /*AUTOKEY */

#ifdef MOTION_MOUSE
#define W_EV_CM_BUTTON	5
#endif

#define W_EV_CLOSED	6	/* window was closed by user action */

#define W_LBUTTON       1
#define W_MBUTTON       2
#define W_RBUTTON       3
#define W_WUBUTTON      4    // Mouse wheel up
#define W_WDBUTTON      5    // wheel down
#define W_X1BUTTON      6    // future extra keys
#define W_X2BUTTON      7


#ifdef SHIFTED_MOUSE
#define W_SHIFT_BUTTON	0x08
#define W_CTRL_BUTTON	0x10
#define W_BUTTON_RANGE  0x20
#else
#define W_BUTTON_RANGE  8
#endif

#define W_BoldFont W_HighlightFont

void W_FillArea(W_Window window, int x, int y, int width, int height, W_Color color);
void W_DefineArrowCursor(W_Window window);
void W_GalacticBgd(int which);
void W_LocalBgd(int which);

int W_TTSTextHeight(void);
int W_TTSTextWidth(char *s, int l);
void W_EraseTTSText(W_Window window, int max_width, int y, int width);
void W_WriteTTSText(W_Window window, int max_width, int y, int width, char *str, int len);
void W_Halo(int x, int y, W_Color color);

void W_FullScreenOn(W_Window window);
void W_FullScreenOff(W_Window window);
void W_FullScreenInitialise(void);
int W_FullScreenToggle(W_Window window);
#define FULLSCREEN_NOT_COMPILED -1
#define FULLSCREEN_OK 0
#define FULLSCREEN_FAILED 1
void W_FullScreenBegin(W_Window window);
void W_FullScreen(W_Window window);
void W_CameraSnap(W_Window window);
int W_SpNextEvent(W_Event *wevent);
int findMouseInWin(int *x, int *y, W_Window w);
int W_EventsQueued(void);
int W_EventsQueuedCk(void);

void W_SetBackground(W_Window w, int which);
void *W_SetBackgroundImage(W_Window w, char *name);

void W_NextScreenShot(W_Window w, int x, int y);
void W_DrawScreenShot(W_Window w, int x, int y);

void *W_ReadImage(W_Window w, char *name);
void W_DrawImage(int x, int y, void *sprite_v);
void W_DropImage(void *sprite_v);

#endif /* _h_Wlib */