1 |
673 |
markom |
#ifndef _MWTYPES_H
|
2 |
|
|
#define _MWTYPES_H
|
3 |
|
|
/*
|
4 |
|
|
* Copyright (c) 1999, 2000, 2001 Greg Haerr <greg@censoft.com>
|
5 |
|
|
*
|
6 |
|
|
* Exported Microwindows engine typedefs and defines
|
7 |
|
|
*/
|
8 |
|
|
#define MWPACKED __attribute__ ((aligned(1), packed))
|
9 |
|
|
|
10 |
|
|
/* builtin font std names*/
|
11 |
|
|
#define MWFONT_SYSTEM_VAR "System" /* winSystem 14x16 (ansi)*/
|
12 |
|
|
#define MWFONT_GUI_VAR "Helvetica" /* winMSSansSerif 11x13 (ansi)*/
|
13 |
|
|
#define MWFONT_OEM_FIXED "Terminal" /* rom8x16 (oem)*/
|
14 |
|
|
#define MWFONT_SYSTEM_FIXED "SystemFixed" /* X6x13 (should be ansi)*/
|
15 |
|
|
|
16 |
|
|
/* Text/GetTextSize encoding flags*/
|
17 |
|
|
#define MWTF_ASCII 0x0000 /* 8 bit packing, ascii*/
|
18 |
|
|
#define MWTF_UTF8 0x0001 /* 8 bit packing, utf8*/
|
19 |
|
|
#define MWTF_UC16 0x0002 /* 16 bit packing, unicode 16*/
|
20 |
|
|
#define MWTF_UC32 0x0004 /* 32 bit packing, unicode 32*/
|
21 |
|
|
#define MWTF_PACKMASK 0x0007 /* packing mask*/
|
22 |
|
|
|
23 |
|
|
/* Text alignment flags*/
|
24 |
|
|
#define MWTF_TOP 0x0010 /* align on top*/
|
25 |
|
|
#define MWTF_BASELINE 0x0020 /* align on baseline*/
|
26 |
|
|
#define MWTF_BOTTOM 0x0040 /* align on bottom*/
|
27 |
|
|
|
28 |
|
|
/* SetFontAttr flags*/
|
29 |
|
|
#define MWTF_KERNING 0x1000 /* font kerning*/
|
30 |
|
|
#define MWTF_ANTIALIAS 0x2000 /* antialiased output*/
|
31 |
|
|
#define MWTF_UNDERLINE 0x4000 /* draw underline*/
|
32 |
|
|
|
33 |
|
|
/* Drawing modes*/
|
34 |
|
|
#define MWMODE_COPY 0 /* src*/
|
35 |
|
|
#define MWMODE_XOR 1 /* src ^ dst*/
|
36 |
|
|
#define MWMODE_OR 2 /* src | dst*/
|
37 |
|
|
#define MWMODE_AND 3 /* src & dst*/
|
38 |
|
|
#define MWMODE_CLEAR 4 /* 0*/
|
39 |
|
|
#define MWMODE_SETTO1 5 /* 11111111*/ /* obsolete name, will be MWMODE_SET*/
|
40 |
|
|
#define MWMODE_EQUIV 6 /* ~(src ^ dst)*/
|
41 |
|
|
#define MWMODE_NOR 7 /* ~(src | dst)*/
|
42 |
|
|
#define MWMODE_NAND 8 /* ~(src & dst)*/
|
43 |
|
|
#define MWMODE_INVERT 9 /* ~dst*/
|
44 |
|
|
#define MWMODE_COPYINVERTED 10 /* ~src*/
|
45 |
|
|
#define MWMODE_ORINVERTED 11 /* ~src | dst*/
|
46 |
|
|
#define MWMODE_ANDINVERTED 12 /* ~src & dst*/
|
47 |
|
|
#define MWMODE_ORREVERSE 13 /* src | ~dst*/
|
48 |
|
|
#define MWMODE_ANDREVERSE 14 /* src & ~dst*/
|
49 |
|
|
#define MWMODE_NOOP 15 /* dst*/
|
50 |
|
|
#define MWMODE_MAX 15
|
51 |
|
|
|
52 |
|
|
/* Mouse button bits*/
|
53 |
|
|
#define MWBUTTON_L 04
|
54 |
|
|
#define MWBUTTON_M 02
|
55 |
|
|
#define MWBUTTON_R 01
|
56 |
|
|
|
57 |
|
|
/* Color defines*/
|
58 |
|
|
#define MWRGB(r,g,b) ((MWCOLORVAL)(((unsigned char)(r)|\
|
59 |
|
|
((unsigned short)((unsigned char)(g))<<8))|\
|
60 |
|
|
(((unsigned long)(unsigned char)(b))<<16)))
|
61 |
|
|
#define MWF_PALINDEX 0x01000000
|
62 |
|
|
#define MWPALINDEX(x) ((MWCOLORVAL)MWF_PALINDEX | (x))
|
63 |
|
|
|
64 |
|
|
/*
|
65 |
|
|
* ROP blitter opcodes (extensions < 0x10000000 are MWMODE_xxx blit ops)
|
66 |
|
|
*/
|
67 |
|
|
#define MWROP_EXTENSION 0xff000000L /* rop extension bits*/
|
68 |
|
|
|
69 |
|
|
/* copy src -> dst except for transparent color in src*/
|
70 |
|
|
#define MWROP_SRCTRANSCOPY 0x11000000L
|
71 |
|
|
|
72 |
|
|
/* alpha blend src -> dst with constant alpha, alpha value in low 8 bits*/
|
73 |
|
|
#define MWROP_BLENDCONSTANT 0x12000000L
|
74 |
|
|
|
75 |
|
|
/* alpha blend fg/bg color -> dst with src as alpha channel*/
|
76 |
|
|
#define MWROP_BLENDFGBG 0x13000000L
|
77 |
|
|
|
78 |
|
|
/* alpha blend src -> dst with separate per pixel alpha channel*/
|
79 |
|
|
#define MWROP_BLENDCHANNEL 0x14000000L
|
80 |
|
|
|
81 |
|
|
/* stretch src -> dst*/
|
82 |
|
|
#define MWROP_STRETCH 0x15000000L
|
83 |
|
|
|
84 |
|
|
/* blits rops based on src/dst binary operations*/
|
85 |
|
|
#define MWROP_COPY (MWMODE_COPY << 24L)
|
86 |
|
|
#define MWROP_XOR (MWMODE_XOR << 24L)
|
87 |
|
|
#define MWROP_OR (MWMODE_OR << 24L)
|
88 |
|
|
#define MWROP_AND (MWMODE_AND << 24L)
|
89 |
|
|
#define MWROP_CLEAR (MWMODE_CLEAR << 24L)
|
90 |
|
|
#define MWROP_SET (MWMODE_SETTO1 << 24L)
|
91 |
|
|
#define MWROP_EQUIV (MWMODE_EQUIV << 24L)
|
92 |
|
|
#define MWROP_NOR (MWMODE_NOR << 24L)
|
93 |
|
|
#define MWROP_NAND (MWMODE_NAND << 24L)
|
94 |
|
|
#define MWROP_INVERT (MWMODE_INVERT << 24L)
|
95 |
|
|
#define MWROP_COPYINVERTED (MWMODE_COPYINVERTED << 24L)
|
96 |
|
|
#define MWROP_ORINVERTED (MWMODE_ORINVERTED << 24L)
|
97 |
|
|
#define MWROP_ANDINVERTED (MWMODE_ANDINVERTED << 24L)
|
98 |
|
|
#define MWROP_ORREVERSE (MWMODE_ORREVERSE << 24L)
|
99 |
|
|
#define MWROP_ANDREVERSE (MWMODE_ANDREVERSE << 24L)
|
100 |
|
|
#define MWROP_NOOP (MWMODE_NOOP << 24L)
|
101 |
|
|
|
102 |
|
|
#define MWROP_SRCCOPY MWROP_COPY /* obsolete*/
|
103 |
|
|
#define MWROP_SRCAND MWROP_AND /* obsolete*/
|
104 |
|
|
#define MWROP_SRCINVERT MWROP_XOR /* obsolete*/
|
105 |
|
|
#define MWROP_BLACKNESS MWROP_CLEAR /* obsolete*/
|
106 |
|
|
|
107 |
|
|
/* convert an MWROP to drawing mode MWMODE value*/
|
108 |
|
|
#define MWROP_TO_MODE(op) ((op) >> 24)
|
109 |
|
|
|
110 |
|
|
/*
|
111 |
|
|
* Pixel formats
|
112 |
|
|
* Note the two pseudo pixel formats are never returned by display drivers,
|
113 |
|
|
* but rather used as a data structure type in GrArea. The other
|
114 |
|
|
* types are both returned by display drivers and used as pixel packing
|
115 |
|
|
* specifiers.
|
116 |
|
|
*/
|
117 |
|
|
#define MWPF_RGB 0 /* pseudo, convert from packed 32 bit RGB*/
|
118 |
|
|
#define MWPF_PIXELVAL 1 /* pseudo, no convert from packed PIXELVAL*/
|
119 |
|
|
#define MWPF_PALETTE 2 /* pixel is packed 8 bits 1, 4 or 8 pal index*/
|
120 |
|
|
#define MWPF_TRUECOLOR0888 3 /* pixel is packed 32 bits 8/8/8 truecolor*/
|
121 |
|
|
#define MWPF_TRUECOLOR888 4 /* pixel is packed 24 bits 8/8/8 truecolor*/
|
122 |
|
|
#define MWPF_TRUECOLOR565 5 /* pixel is packed 16 bits 5/6/5 truecolor*/
|
123 |
|
|
#define MWPF_TRUECOLOR555 6 /* pixel is packed 16 bits 5/5/5 truecolor*/
|
124 |
|
|
#define MWPF_TRUECOLOR332 7 /* pixel is packed 8 bits 3/3/2 truecolor*/
|
125 |
|
|
|
126 |
|
|
/*
|
127 |
|
|
* MWPIXELVAL definition: changes based on target system
|
128 |
|
|
* Set using -DMWPIXEL_FORMAT=MWPF_XXX
|
129 |
|
|
*
|
130 |
|
|
* For the Nano-X server, it is important to use the correct MWPF_* value
|
131 |
|
|
* for the MWPIXEL_FORMAT macro in order to match the hardware,
|
132 |
|
|
* while the Nano-X clients that includes this file can get away with
|
133 |
|
|
* a default pixel format of 24-bit color as the client will either:
|
134 |
|
|
* 1) Use the MWPF_PIXELVAL native format when calling GrReadArea, in
|
135 |
|
|
* which case we have to have enough spare room to hold 32-bit
|
136 |
|
|
* pixlevalues (hence the default MWPF_TRUECOLOR0888 format), or
|
137 |
|
|
* 2) Will use some other PF_* format, in which case the application
|
138 |
|
|
* is well aware of which pixel-format it uses and can avoid the
|
139 |
|
|
* device specific RGB2PIXEL and use RGB2PIXEL565 etc. instead,
|
140 |
|
|
* and specifiy the pixel fomar as MWPF_TRUECOLOR565 etc. when
|
141 |
|
|
* calling the GrArea function(s).
|
142 |
|
|
*/
|
143 |
|
|
#ifndef MWPIXEL_FORMAT
|
144 |
|
|
#define MWPIXEL_FORMAT MWPF_TRUECOLOR0888
|
145 |
|
|
#endif
|
146 |
|
|
|
147 |
|
|
#if defined(__AS386_16__)
|
148 |
|
|
/* Force 8 bit palettized display for ELKS*/
|
149 |
|
|
#undef MWPIXEL_FORMAT
|
150 |
|
|
#define MWPIXEL_FORMAT MWPF_PALETTE
|
151 |
|
|
#endif
|
152 |
|
|
|
153 |
|
|
#if (MWPIXEL_FORMAT == MWPF_TRUECOLOR565) || (MWPIXEL_FORMAT == MWPF_TRUECOLOR555)
|
154 |
|
|
typedef unsigned short MWPIXELVAL;
|
155 |
|
|
#else
|
156 |
|
|
#if MWPIXEL_FORMAT == MWPF_TRUECOLOR332
|
157 |
|
|
typedef unsigned char MWPIXELVAL;
|
158 |
|
|
#else
|
159 |
|
|
#if MWPIXEL_FORMAT == MWPF_PALETTE
|
160 |
|
|
typedef unsigned char MWPIXELVAL;
|
161 |
|
|
#else
|
162 |
|
|
typedef unsigned long MWPIXELVAL;
|
163 |
|
|
#endif
|
164 |
|
|
#endif
|
165 |
|
|
#endif
|
166 |
|
|
|
167 |
|
|
/* portrait modes*/
|
168 |
|
|
#define MWPORTRAIT_NONE 0x00 /* hw framebuffer, no rotation*/
|
169 |
|
|
#define MWPORTRAIT_LEFT 0x01 /* rotate left*/
|
170 |
|
|
#define MWPORTRAIT_RIGHT 0x02 /* rotate right*/
|
171 |
|
|
#define MWPORTRAIT_DOWN 0x04 /* upside down*/
|
172 |
|
|
|
173 |
|
|
/*
|
174 |
|
|
* Type definitions
|
175 |
|
|
*/
|
176 |
|
|
typedef int MWCOORD; /* device coordinates*/
|
177 |
|
|
typedef int MWBOOL; /* boolean value*/
|
178 |
|
|
typedef unsigned char MWUCHAR; /* unsigned char*/
|
179 |
|
|
typedef unsigned long MWCOLORVAL; /* device-independent color value*/
|
180 |
|
|
typedef unsigned short MWIMAGEBITS; /* bitmap image unit size*/
|
181 |
|
|
typedef unsigned long MWTIMEOUT; /* timeout value */
|
182 |
|
|
|
183 |
|
|
/* dbl linked list data structure*/
|
184 |
|
|
typedef struct _mwlist { /* LIST must be first decl in struct*/
|
185 |
|
|
struct _mwlist *next; /* next item*/
|
186 |
|
|
struct _mwlist *prev; /* previous item*/
|
187 |
|
|
} MWLIST, *PMWLIST;
|
188 |
|
|
|
189 |
|
|
/* dbl linked list head data structure*/
|
190 |
|
|
typedef struct _mwlisthead {
|
191 |
|
|
struct _mwlist *head; /* first item*/
|
192 |
|
|
struct _mwlist *tail; /* last item*/
|
193 |
|
|
} MWLISTHEAD, *PMWLISTHEAD;
|
194 |
|
|
|
195 |
|
|
/* Keyboard state modifiers*/
|
196 |
|
|
typedef unsigned int MWKEYMOD;
|
197 |
|
|
|
198 |
|
|
/* GetScreenInfo structure*/
|
199 |
|
|
typedef struct {
|
200 |
|
|
MWCOORD rows; /* number of rows on screen */
|
201 |
|
|
MWCOORD cols; /* number of columns on screen */
|
202 |
|
|
int xdpcm; /* dots/centimeter in x direction */
|
203 |
|
|
int ydpcm; /* dots/centimeter in y direction */
|
204 |
|
|
int planes; /* hw # planes*/
|
205 |
|
|
int bpp; /* hw bpp*/
|
206 |
|
|
long ncolors; /* hw number of colors supported*/
|
207 |
|
|
int fonts; /* number of built-in fonts */
|
208 |
|
|
int buttons; /* buttons which are implemented */
|
209 |
|
|
MWKEYMOD modifiers; /* modifiers which are implemented */
|
210 |
|
|
int pixtype; /* format of pixel value*/
|
211 |
|
|
int portrait; /* current portrait mode*/
|
212 |
|
|
MWBOOL fbdriver; /* true if running mwin fb screen driver*/
|
213 |
|
|
unsigned long rmask; /* red mask bits in pixel*/
|
214 |
|
|
unsigned long gmask; /* green mask bits in pixel*/
|
215 |
|
|
unsigned long bmask; /* blue mask bits in pixel*/
|
216 |
|
|
MWCOORD xpos; /* current x mouse position*/
|
217 |
|
|
MWCOORD ypos; /* current y mouse position*/
|
218 |
|
|
|
219 |
|
|
/* items below are get/set by the window manager and not used internally*/
|
220 |
|
|
int vs_width; /* virtual screen width/height*/
|
221 |
|
|
int vs_height;
|
222 |
|
|
int ws_width; /* workspace width/height*/
|
223 |
|
|
int ws_height;
|
224 |
|
|
} MWSCREENINFO, *PMWSCREENINFO;
|
225 |
|
|
|
226 |
|
|
/* client side window framebuffer info*/
|
227 |
|
|
typedef struct {
|
228 |
|
|
unsigned char * physpixels; /* address of real framebuffer*/
|
229 |
|
|
/* note winpixels is only correct in non-portrait modes*/
|
230 |
|
|
unsigned char * winpixels; /* address of 0,0 this window in fb*/
|
231 |
|
|
int pixtype; /* MWPF_ pixel type*/
|
232 |
|
|
int bpp; /* bits per pixel*/
|
233 |
|
|
int bytespp; /* bytes per pixel*/
|
234 |
|
|
int pitch; /* bytes per scan line for window (=fb pitch)*/
|
235 |
|
|
int x, y; /* absolute virtual window coordinates*/
|
236 |
|
|
int portrait_mode; /* current portrait mode*/
|
237 |
|
|
MWCOORD xres; /* real framebuffer resolution*/
|
238 |
|
|
MWCOORD yres;
|
239 |
|
|
MWCOORD xvirtres; /* virtual framebuffer resolution*/
|
240 |
|
|
MWCOORD yvirtres;
|
241 |
|
|
} MWWINDOWFBINFO;
|
242 |
|
|
|
243 |
|
|
/* GetFontInfo structure*/
|
244 |
|
|
typedef struct {
|
245 |
|
|
int maxwidth; /* maximum width of any char */
|
246 |
|
|
int height; /* height of font in pixels*/
|
247 |
|
|
int baseline; /* baseline (ascent) of font */
|
248 |
|
|
int firstchar; /* first character in font*/
|
249 |
|
|
int lastchar; /* last character in font*/
|
250 |
|
|
MWBOOL fixed; /* TRUE if font is fixed width */
|
251 |
|
|
MWUCHAR widths[256]; /* table of character widths */
|
252 |
|
|
} MWFONTINFO, *PMWFONTINFO;
|
253 |
|
|
|
254 |
|
|
/* GetFontList structure */
|
255 |
|
|
typedef struct {
|
256 |
|
|
char *ttname; /* TrueType name, eg "Times New Roman Bold" */
|
257 |
|
|
char *mwname; /* microwin name, eg "timesb" */
|
258 |
|
|
} MWFONTLIST, *PMWFONTLIST;
|
259 |
|
|
|
260 |
|
|
/* logical font descriptor*/
|
261 |
|
|
|
262 |
|
|
/* font classes - used internally*/
|
263 |
|
|
#define MWLF_CLASS_BUILTIN 1 /* Builtin fonts (bitmaps) */
|
264 |
|
|
#define MWLF_CLASS_FREETYPE 2 /* FreeType fonts in TT format */
|
265 |
|
|
#define MWLF_CLASS_T1LIB 3 /* T1LIB outlined Adobe Type 1 fonts */
|
266 |
|
|
#define MWLF_CLASS_ANY 4 /* Any font*/
|
267 |
|
|
|
268 |
|
|
#define MWLF_FACESIZE 64 /* max facename size*/
|
269 |
|
|
|
270 |
|
|
/* font type selection - lfOutPrecision*/
|
271 |
|
|
#define MWLF_TYPE_DEFAULT 0 /* any font*/
|
272 |
|
|
#define MWLF_TYPE_SCALED 4 /* outlined font (tt or adobe)*/
|
273 |
|
|
#define MWLF_TYPE_RASTER 5 /* raster only*/
|
274 |
|
|
#define MWLF_TYPE_TRUETYPE 7 /* truetype only*/
|
275 |
|
|
#define MWLF_TYPE_ADOBE 10 /* adobe type 1 only*/
|
276 |
|
|
|
277 |
|
|
/* font weights - lfWeight*/
|
278 |
|
|
#define MWLF_WEIGHT_DEFAULT 0 /* any weight*/
|
279 |
|
|
#define MWLF_WEIGHT_THIN 100 /* thin*/
|
280 |
|
|
#define MWLF_WEIGHT_EXTRALIGHT 200
|
281 |
|
|
#define MWLF_WEIGHT_LIGHT 300 /* light */
|
282 |
|
|
#define MWLF_WEIGHT_NORMAL 400 /* regular*/
|
283 |
|
|
#define MWLF_WEIGHT_REGULAR 400
|
284 |
|
|
#define MWLF_WEIGHT_MEDIUM 500 /* medium */
|
285 |
|
|
#define MWLF_WEIGHT_DEMIBOLD 600
|
286 |
|
|
#define MWLF_WEIGHT_BOLD 700 /* bold*/
|
287 |
|
|
#define MWLF_WEIGTH_EXTRABOLD 800
|
288 |
|
|
#define MWLF_WEIGHT_BLACK 900 /* black */
|
289 |
|
|
|
290 |
|
|
/* font charset - lfCharSet*/
|
291 |
|
|
#define MWLF_CHARSET_ANSI 0 /* win32 ansi*/
|
292 |
|
|
#define MWLF_CHARSET_DEFAULT 1 /* any charset*/
|
293 |
|
|
#define MWLF_CHARSET_UNICODE 254 /* unicode*/
|
294 |
|
|
#define MWLF_CHARSET_OEM 255 /* local hw*/
|
295 |
|
|
|
296 |
|
|
/* font pitch - lfPitch */
|
297 |
|
|
#define MWLF_PITCH_DEFAULT 0 /* any pitch */
|
298 |
|
|
#define MWLF_PITCH_ULTRACONDENSED 10
|
299 |
|
|
#define MWLF_PITCH_EXTRACONDENSED 20
|
300 |
|
|
#define MWLF_PITCH_CONDENSED 30
|
301 |
|
|
#define MWLF_PITCH_SEMICONDENSED 40
|
302 |
|
|
#define MWLF_PITCH_NORMAL 50
|
303 |
|
|
#define MWLF_PITCH_SEMIEXPANDED 60
|
304 |
|
|
#define MWLF_PITCH_EXPANDED 70
|
305 |
|
|
#define MWLF_PITCH_EXTRAEXPANDED 80
|
306 |
|
|
#define MWLF_PITCH_ULTRAEXPANDED 90
|
307 |
|
|
|
308 |
|
|
/* flags for the GdAddFont function */
|
309 |
|
|
#define MWLF_FLAGS_ALIAS 1
|
310 |
|
|
|
311 |
|
|
typedef struct {
|
312 |
|
|
long lfHeight; /* desired height in pixels*/
|
313 |
|
|
long lfWidth; /* desired width in pixels or 0*/
|
314 |
|
|
long lfEscapement; /* rotation in tenths of degree*/
|
315 |
|
|
long lfOrientation; /* not used*/
|
316 |
|
|
long lfWeight; /* font weight*/
|
317 |
|
|
MWUCHAR lfItalic; /* =1 for italic */
|
318 |
|
|
MWUCHAR lfUnderline; /* =1 for underline */
|
319 |
|
|
MWUCHAR lfStrikeOut; /* not used*/
|
320 |
|
|
MWUCHAR lfCharSet; /* font character set*/
|
321 |
|
|
MWUCHAR lfOutPrecision; /* font type selection*/
|
322 |
|
|
MWUCHAR lfClipPrecision; /* not used*/
|
323 |
|
|
MWUCHAR lfQuality; /* not used*/
|
324 |
|
|
|
325 |
|
|
/* the following differs from windows font model*/
|
326 |
|
|
MWUCHAR lfRoman; /* =1 for Roman letters (upright) */
|
327 |
|
|
MWUCHAR lfSerif; /* =1 for Serifed font */
|
328 |
|
|
MWUCHAR lfSansSerif; /* =1 for Sans-serif font */
|
329 |
|
|
MWUCHAR lfModern; /* =1 for Modern font */
|
330 |
|
|
MWUCHAR lfMonospace; /* =1 for Monospaced font */
|
331 |
|
|
MWUCHAR lfProportional; /* =1 for Proportional font */
|
332 |
|
|
MWUCHAR lfOblique; /* =1 for Oblique (kind of Italic) */
|
333 |
|
|
MWUCHAR lfSmallCaps; /* =1 for small caps */
|
334 |
|
|
MWUCHAR lfPitch; /* font pitch (width) */
|
335 |
|
|
|
336 |
|
|
char lfFaceName[MWLF_FACESIZE]; /* font name, may be aliased*/
|
337 |
|
|
} MWLOGFONT, *PMWLOGFONT;
|
338 |
|
|
|
339 |
|
|
/*
|
340 |
|
|
* Macros to initialize the MWLOGFONT structure to the most common defaults
|
341 |
|
|
* needed by application programs and the nano-X server program.
|
342 |
|
|
*/
|
343 |
|
|
|
344 |
|
|
#define MWLF_Clear(lf) \
|
345 |
|
|
do { \
|
346 |
|
|
(lf)->lfHeight = 0; \
|
347 |
|
|
(lf)->lfWidth = 0; \
|
348 |
|
|
(lf)->lfEscapement = 0; \
|
349 |
|
|
(lf)->lfOrientation = 0; \
|
350 |
|
|
(lf)->lfWeight = MWLF_WEIGHT_REGULAR; \
|
351 |
|
|
(lf)->lfPitch = 0; \
|
352 |
|
|
(lf)->lfItalic = 0; \
|
353 |
|
|
(lf)->lfOblique = 0; \
|
354 |
|
|
(lf)->lfRoman = 0; \
|
355 |
|
|
(lf)->lfSerif = 0; \
|
356 |
|
|
(lf)->lfSansSerif = 0; \
|
357 |
|
|
(lf)->lfModern = 0; \
|
358 |
|
|
(lf)->lfMonospace = 0; \
|
359 |
|
|
(lf)->lfProportional = 0; \
|
360 |
|
|
(lf)->lfSmallCaps = 0; \
|
361 |
|
|
(lf)->lfUnderline = 0; \
|
362 |
|
|
(lf)->lfStrikeOut = 0; \
|
363 |
|
|
(lf)->lfCharSet = 0; \
|
364 |
|
|
(lf)->lfOutPrecision = 0; \
|
365 |
|
|
(lf)->lfClipPrecision = 0; \
|
366 |
|
|
(lf)->lfQuality = 0; \
|
367 |
|
|
(lf)->lfFaceName[0] = '\0'; \
|
368 |
|
|
} while (0)
|
369 |
|
|
|
370 |
|
|
#define MWLF_SetBold(lf) \
|
371 |
|
|
do { \
|
372 |
|
|
(lf)->lfWeight = MWLF_WEIGHT_BOLD; \
|
373 |
|
|
} while (0)
|
374 |
|
|
|
375 |
|
|
#define MWLF_SetRegular(lf) \
|
376 |
|
|
do { \
|
377 |
|
|
(lf)->lfWeight = MWLF_WEIGHT_REGULAR; \
|
378 |
|
|
} while (0)
|
379 |
|
|
|
380 |
|
|
#define MWLF_SetItalics(lf) \
|
381 |
|
|
do { \
|
382 |
|
|
(lf)->lfItalic = 1; \
|
383 |
|
|
(lf)->lfOblique = 0; \
|
384 |
|
|
(lf)->lfRoman = 0; \
|
385 |
|
|
} while (0)
|
386 |
|
|
|
387 |
|
|
#define MWLF_SetRoman(lf) \
|
388 |
|
|
do { \
|
389 |
|
|
(lf)->lfItalic = 0; \
|
390 |
|
|
(lf)->lfOblique = 0; \
|
391 |
|
|
(lf)->lfRoman = 1; \
|
392 |
|
|
} while (0)
|
393 |
|
|
|
394 |
|
|
/*
|
395 |
|
|
* Rectangle and point structures.
|
396 |
|
|
* These structures are "inherited" in wingdi.h for
|
397 |
|
|
* the Win32 RECT and POINT structures, so they must match
|
398 |
|
|
* Microsoft's definition.
|
399 |
|
|
*/
|
400 |
|
|
|
401 |
|
|
/* MWPOINT used in GdPoly, GdFillPoly*/
|
402 |
|
|
typedef struct {
|
403 |
|
|
MWCOORD x;
|
404 |
|
|
MWCOORD y;
|
405 |
|
|
} MWPOINT;
|
406 |
|
|
|
407 |
|
|
/* MWRECT used in region routines*/
|
408 |
|
|
typedef struct {
|
409 |
|
|
MWCOORD left;
|
410 |
|
|
MWCOORD top;
|
411 |
|
|
MWCOORD right;
|
412 |
|
|
MWCOORD bottom;
|
413 |
|
|
} MWRECT;
|
414 |
|
|
|
415 |
|
|
/* dynamically allocated multi-rectangle clipping region*/
|
416 |
|
|
typedef struct {
|
417 |
|
|
int size; /* malloc'd # of rectangles*/
|
418 |
|
|
int numRects; /* # rectangles in use*/
|
419 |
|
|
int type; /* region type*/
|
420 |
|
|
MWRECT *rects; /* rectangle array*/
|
421 |
|
|
MWRECT extents; /* bounding box of region*/
|
422 |
|
|
} MWCLIPREGION;
|
423 |
|
|
|
424 |
|
|
/* region types */
|
425 |
|
|
#define MWREGION_ERROR 0
|
426 |
|
|
#define MWREGION_NULL 1
|
427 |
|
|
#define MWREGION_SIMPLE 2
|
428 |
|
|
#define MWREGION_COMPLEX 3
|
429 |
|
|
|
430 |
|
|
/* GdRectInRegion return codes*/
|
431 |
|
|
#define MWRECT_OUT 0 /* rectangle not in region*/
|
432 |
|
|
#define MWRECT_ALLIN 1 /* rectangle all in region*/
|
433 |
|
|
#define MWRECT_PARTIN 2 /* rectangle partly in region*/
|
434 |
|
|
|
435 |
|
|
/* GdAllocPolyRegion types*/
|
436 |
|
|
#define MWPOLY_EVENODD 1
|
437 |
|
|
#define MWPOLY_WINDING 2
|
438 |
|
|
|
439 |
|
|
/* In-core color palette structure*/
|
440 |
|
|
typedef struct {
|
441 |
|
|
MWUCHAR r;
|
442 |
|
|
MWUCHAR g;
|
443 |
|
|
MWUCHAR b;
|
444 |
|
|
} MWPALENTRY;
|
445 |
|
|
|
446 |
|
|
/* In-core mono and color image structure*/
|
447 |
|
|
#define MWIMAGE_UPSIDEDOWN 01 /* compression flag: upside down image*/
|
448 |
|
|
#define MWIMAGE_BGR 00 /* compression flag: BGR byte order*/
|
449 |
|
|
#define MWIMAGE_RGB 02 /* compression flag: RGB not BGR bytes*/
|
450 |
|
|
|
451 |
|
|
typedef struct {
|
452 |
|
|
int width; /* image width in pixels*/
|
453 |
|
|
int height; /* image height in pixels*/
|
454 |
|
|
int planes; /* # image planes*/
|
455 |
|
|
int bpp; /* bits per pixel (1, 4 or 8)*/
|
456 |
|
|
int pitch; /* bytes per line*/
|
457 |
|
|
int bytesperpixel; /* bytes per pixel*/
|
458 |
|
|
int compression; /* compression algorithm*/
|
459 |
|
|
int palsize; /* palette size*/
|
460 |
|
|
long transcolor; /* transparent color or -1 if none*/
|
461 |
|
|
MWPALENTRY * palette; /* palette*/
|
462 |
|
|
MWUCHAR * imagebits; /* image bits (dword right aligned)*/
|
463 |
|
|
} MWIMAGEHDR, *PMWIMAGEHDR;
|
464 |
|
|
|
465 |
|
|
/* image information structure - returned by GdGetImageInfo*/
|
466 |
|
|
typedef struct {
|
467 |
|
|
int id; /* image id*/
|
468 |
|
|
int width; /* image width in pixels*/
|
469 |
|
|
int height; /* image height in pixels*/
|
470 |
|
|
int planes; /* # image planes*/
|
471 |
|
|
int bpp; /* bits per pixel (1, 4 or 8)*/
|
472 |
|
|
int pitch; /* bytes per line*/
|
473 |
|
|
int bytesperpixel; /* bytes per pixel*/
|
474 |
|
|
int compression; /* compression algorithm*/
|
475 |
|
|
int palsize; /* palette size*/
|
476 |
|
|
MWPALENTRY palette[256]; /* palette*/
|
477 |
|
|
} MWIMAGEINFO, *PMWIMAGEINFO;
|
478 |
|
|
|
479 |
|
|
#define MWMAX_CURSOR_SIZE 16 /* maximum cursor x and y size*/
|
480 |
|
|
|
481 |
|
|
/* In-core software cursor structure*/
|
482 |
|
|
typedef struct {
|
483 |
|
|
int width; /* cursor width in pixels*/
|
484 |
|
|
int height; /* cursor height in pixels*/
|
485 |
|
|
MWCOORD hotx; /* relative x pos of hot spot*/
|
486 |
|
|
MWCOORD hoty; /* relative y pos of hot spot*/
|
487 |
|
|
MWCOLORVAL fgcolor; /* foreground color*/
|
488 |
|
|
MWCOLORVAL bgcolor; /* background color*/
|
489 |
|
|
MWIMAGEBITS image[MWMAX_CURSOR_SIZE];/* cursor image bits*/
|
490 |
|
|
MWIMAGEBITS mask[MWMAX_CURSOR_SIZE];/* cursor mask bits*/
|
491 |
|
|
} MWCURSOR, *PMWCURSOR;
|
492 |
|
|
|
493 |
|
|
typedef struct _mwfont * PMWFONT;
|
494 |
|
|
|
495 |
|
|
/* outline and filled arc and pie types*/
|
496 |
|
|
#define MWARC 0x0001 /* arc*/
|
497 |
|
|
#define MWOUTLINE 0x0002
|
498 |
|
|
#define MWARCOUTLINE 0x0003 /* arc + outline*/
|
499 |
|
|
#define MWPIE 0x0004 /* pie (filled)*/
|
500 |
|
|
#define MWELLIPSE 0x0008 /* ellipse outline*/
|
501 |
|
|
#define MWELLIPSEFILL 0x0010 /* ellipse filled*/
|
502 |
|
|
|
503 |
|
|
#ifdef MWINCLUDECOLORS
|
504 |
|
|
/*
|
505 |
|
|
* Common colors - note any color including these may not be
|
506 |
|
|
* available on palettized systems, and the system will
|
507 |
|
|
* then use the nearest color already in the system palette,
|
508 |
|
|
* or allocate a new color entry.
|
509 |
|
|
* These colors are the first 16 entries in the std palette,
|
510 |
|
|
* and are written to the system palette if writable.
|
511 |
|
|
*/
|
512 |
|
|
#define BLACK MWRGB( 0 , 0 , 0 )
|
513 |
|
|
#define BLUE MWRGB( 0 , 0 , 128 )
|
514 |
|
|
#define GREEN MWRGB( 0 , 128, 0 )
|
515 |
|
|
#define CYAN MWRGB( 0 , 128, 128 )
|
516 |
|
|
#define RED MWRGB( 128, 0 , 0 )
|
517 |
|
|
#define MAGENTA MWRGB( 128, 0 , 128 )
|
518 |
|
|
#define BROWN MWRGB( 128, 64 , 0 )
|
519 |
|
|
#define LTGRAY MWRGB( 192, 192, 192 )
|
520 |
|
|
#define GRAY MWRGB( 128, 128, 128 )
|
521 |
|
|
#define LTBLUE MWRGB( 0 , 0 , 255 )
|
522 |
|
|
#define LTGREEN MWRGB( 0 , 255, 0 )
|
523 |
|
|
#define LTCYAN MWRGB( 0 , 255, 255 )
|
524 |
|
|
#define LTRED MWRGB( 255, 0 , 0 )
|
525 |
|
|
#define LTMAGENTA MWRGB( 255, 0 , 255 )
|
526 |
|
|
#define YELLOW MWRGB( 255, 255, 0 )
|
527 |
|
|
#define WHITE MWRGB( 255, 255, 255 )
|
528 |
|
|
|
529 |
|
|
/* other common colors*/
|
530 |
|
|
#define DKGRAY MWRGB( 32, 32, 32)
|
531 |
|
|
#endif /* MWINCLUDECOLORS*/
|
532 |
|
|
|
533 |
|
|
/* Keyboard values*/
|
534 |
|
|
typedef unsigned short MWKEY;
|
535 |
|
|
typedef unsigned char MWSCANCODE;
|
536 |
|
|
|
537 |
|
|
#define MWKEY_UNKNOWN 0
|
538 |
|
|
/* Following special control keysyms are mapped to ASCII*/
|
539 |
|
|
#define MWKEY_BACKSPACE 8
|
540 |
|
|
#define MWKEY_TAB 9
|
541 |
|
|
#define MWKEY_ENTER 13
|
542 |
|
|
#define MWKEY_ESCAPE 27
|
543 |
|
|
/* Keysyms from 32-126 are mapped to ASCII*/
|
544 |
|
|
|
545 |
|
|
#define MWKEY_NONASCII_MASK 0xFF00
|
546 |
|
|
/* Following keysyms are mapped to private use portion of Unicode-16*/
|
547 |
|
|
/* arrows + home/end pad*/
|
548 |
|
|
#define MWKEY_FIRST 0xF800
|
549 |
|
|
#define MWKEY_LEFT 0xF800
|
550 |
|
|
#define MWKEY_RIGHT 0xF801
|
551 |
|
|
#define MWKEY_UP 0xF802
|
552 |
|
|
#define MWKEY_DOWN 0xF803
|
553 |
|
|
#define MWKEY_INSERT 0xF804
|
554 |
|
|
#define MWKEY_DELETE 0xF805
|
555 |
|
|
#define MWKEY_HOME 0xF806
|
556 |
|
|
#define MWKEY_END 0xF807
|
557 |
|
|
#define MWKEY_PAGEUP 0xF808
|
558 |
|
|
#define MWKEY_PAGEDOWN 0xF809
|
559 |
|
|
|
560 |
|
|
/* Numeric keypad*/
|
561 |
|
|
#define MWKEY_KP0 0xF80A
|
562 |
|
|
#define MWKEY_KP1 0xF80B
|
563 |
|
|
#define MWKEY_KP2 0xF80C
|
564 |
|
|
#define MWKEY_KP3 0xF80D
|
565 |
|
|
#define MWKEY_KP4 0xF80E
|
566 |
|
|
#define MWKEY_KP5 0xF80F
|
567 |
|
|
#define MWKEY_KP6 0xF810
|
568 |
|
|
#define MWKEY_KP7 0xF811
|
569 |
|
|
#define MWKEY_KP8 0xF812
|
570 |
|
|
#define MWKEY_KP9 0xF813
|
571 |
|
|
#define MWKEY_KP_PERIOD 0xF814
|
572 |
|
|
#define MWKEY_KP_DIVIDE 0xF815
|
573 |
|
|
#define MWKEY_KP_MULTIPLY 0xF816
|
574 |
|
|
#define MWKEY_KP_MINUS 0xF817
|
575 |
|
|
#define MWKEY_KP_PLUS 0xF818
|
576 |
|
|
#define MWKEY_KP_ENTER 0xF819
|
577 |
|
|
#define MWKEY_KP_EQUALS 0xF81A
|
578 |
|
|
|
579 |
|
|
/* Function keys */
|
580 |
|
|
#define MWKEY_F1 0xF81B
|
581 |
|
|
#define MWKEY_F2 0xF81C
|
582 |
|
|
#define MWKEY_F3 0xF81D
|
583 |
|
|
#define MWKEY_F4 0xF81E
|
584 |
|
|
#define MWKEY_F5 0xF81F
|
585 |
|
|
#define MWKEY_F6 0xF820
|
586 |
|
|
#define MWKEY_F7 0xF821
|
587 |
|
|
#define MWKEY_F8 0xF822
|
588 |
|
|
#define MWKEY_F9 0xF823
|
589 |
|
|
#define MWKEY_F10 0xF824
|
590 |
|
|
#define MWKEY_F11 0xF825
|
591 |
|
|
#define MWKEY_F12 0xF827
|
592 |
|
|
|
593 |
|
|
/* Key state modifier keys*/
|
594 |
|
|
#define MWKEY_NUMLOCK 0xF828
|
595 |
|
|
#define MWKEY_CAPSLOCK 0xF829
|
596 |
|
|
#define MWKEY_SCROLLOCK 0xF82A
|
597 |
|
|
#define MWKEY_LSHIFT 0xF82B
|
598 |
|
|
#define MWKEY_RSHIFT 0xF82C
|
599 |
|
|
#define MWKEY_LCTRL 0xF82D
|
600 |
|
|
#define MWKEY_RCTRL 0xF82E
|
601 |
|
|
#define MWKEY_LALT 0xF82F
|
602 |
|
|
#define MWKEY_RALT 0xF830
|
603 |
|
|
#define MWKEY_LMETA 0xF831
|
604 |
|
|
#define MWKEY_RMETA 0xF832
|
605 |
|
|
#define MWKEY_ALTGR 0xF833
|
606 |
|
|
|
607 |
|
|
/* Misc function keys*/
|
608 |
|
|
#define MWKEY_PRINT 0xF834
|
609 |
|
|
#define MWKEY_SYSREQ 0xF835
|
610 |
|
|
#define MWKEY_PAUSE 0xF836
|
611 |
|
|
#define MWKEY_BREAK 0xF837
|
612 |
|
|
#define MWKEY_QUIT 0xF838 /* virtual key*/
|
613 |
|
|
#define MWKEY_MENU 0xF839 /* virtual key*/
|
614 |
|
|
#define MWKEY_REDRAW 0xF83A /* virtual key*/
|
615 |
|
|
|
616 |
|
|
/* Handheld function keys*/
|
617 |
|
|
#define MWKEY_RECORD 0xF840
|
618 |
|
|
#define MWKEY_PLAY 0xF841
|
619 |
|
|
#define MWKEY_CONTRAST 0xF842
|
620 |
|
|
#define MWKEY_BRIGHTNESS 0xF843
|
621 |
|
|
#define MWKEY_SELECTUP 0xF844
|
622 |
|
|
#define MWKEY_SELECTDOWN 0xF845
|
623 |
|
|
#define MWKEY_ACCEPT 0xF846
|
624 |
|
|
#define MWKEY_CANCEL 0xF847
|
625 |
|
|
#define MWKEY_APP1 0xF848
|
626 |
|
|
#define MWKEY_APP2 0xF849
|
627 |
|
|
#define MWKEY_LAST 0xF849
|
628 |
|
|
|
629 |
|
|
/* Keyboard state modifiers*/
|
630 |
|
|
#define MWKMOD_NONE 0x0000
|
631 |
|
|
#define MWKMOD_LSHIFT 0x0001
|
632 |
|
|
#define MWKMOD_RSHIFT 0x0002
|
633 |
|
|
#define MWKMOD_LCTRL 0x0040
|
634 |
|
|
#define MWKMOD_RCTRL 0x0080
|
635 |
|
|
#define MWKMOD_LALT 0x0100
|
636 |
|
|
#define MWKMOD_RALT 0x0200
|
637 |
|
|
#define MWKMOD_LMETA 0x0400 /* Windows key*/
|
638 |
|
|
#define MWKMOD_RMETA 0x0800 /* Windows key*/
|
639 |
|
|
#define MWKMOD_NUM 0x1000
|
640 |
|
|
#define MWKMOD_CAPS 0x2000
|
641 |
|
|
#define MWKMOD_ALTGR 0x4000
|
642 |
|
|
#define MWKMOD_SCR 0x8000
|
643 |
|
|
|
644 |
|
|
#define MWKMOD_CTRL (MWKMOD_LCTRL|MWKMOD_RCTRL)
|
645 |
|
|
#define MWKMOD_SHIFT (MWKMOD_LSHIFT|MWKMOD_RSHIFT)
|
646 |
|
|
#define MWKMOD_ALT (MWKMOD_LALT|MWKMOD_RALT)
|
647 |
|
|
#define MWKMOD_META (MWKMOD_LMETA|MWKMOD_RMETA)
|
648 |
|
|
|
649 |
|
|
#define MWKINFO_LED_MASK (1 << 0)
|
650 |
|
|
#define MWKINFO_LED_MODE_MASK (1 << 1)
|
651 |
|
|
|
652 |
|
|
/* Keyboard info values */
|
653 |
|
|
#define MWKINFO_LED_CAP (1 << 0)
|
654 |
|
|
#define MWKINFO_LED_NUM (1 << 1)
|
655 |
|
|
#define MWKINFO_LED_SCR (1 << 2)
|
656 |
|
|
|
657 |
|
|
#define MWKINFO_LED_MODE_ON (1 << 3)
|
658 |
|
|
#define MWKINFO_LED_MODE_OFF (1 << 4)
|
659 |
|
|
|
660 |
|
|
typedef struct {
|
661 |
|
|
int led;
|
662 |
|
|
int led_mode;
|
663 |
|
|
} MWKBINFO, *PMWKBINFO;
|
664 |
|
|
#endif /* _MWTYPES_H*/
|