ddraw/tests: Test d3d2 and 3 drawing with non-standard viewports.
[wine.git] / tools / wrc / wrctypes.h
blobd71c4acf51dcb1cd6f56bbd294810c9ec63b4652
1 /*
2 * General type definitions
4 * Copyright 1998 Bertho A. Stultiens (BS)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WRC_WRCTYPES_H
22 #define __WRC_WRCTYPES_H
24 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
28 #ifndef MAKELANGID
29 #include "winnls.h"
30 #endif
32 #ifndef VS_FFI_SIGNATURE
33 #include "winver.h"
34 #endif
36 /* Memory/load flags */
37 #define WRC_MO_MOVEABLE 0x0010
38 #define WRC_MO_PURE 0x0020
39 #define WRC_MO_PRELOAD 0x0040
40 #define WRC_MO_DISCARDABLE 0x1000
42 /* Resource type IDs */
43 #define WRC_RT_CURSOR (1)
44 #define WRC_RT_BITMAP (2)
45 #define WRC_RT_ICON (3)
46 #define WRC_RT_MENU (4)
47 #define WRC_RT_DIALOG (5)
48 #define WRC_RT_STRING (6)
49 #define WRC_RT_FONTDIR (7)
50 #define WRC_RT_FONT (8)
51 #define WRC_RT_ACCELERATOR (9)
52 #define WRC_RT_RCDATA (10)
53 #define WRC_RT_MESSAGETABLE (11)
54 #define WRC_RT_GROUP_CURSOR (12)
55 #define WRC_RT_GROUP_ICON (14)
56 #define WRC_RT_VERSION (16)
57 #define WRC_RT_DLGINCLUDE (17)
58 #define WRC_RT_PLUGPLAY (19)
59 #define WRC_RT_VXD (20)
60 #define WRC_RT_ANICURSOR (21)
61 #define WRC_RT_ANIICON (22)
62 #define WRC_RT_HTML (23)
63 #define WRC_RT_DLGINIT (240)
64 #define WRC_RT_TOOLBAR (241)
66 /* Default class type IDs */
67 #define CT_BUTTON 0x80
68 #define CT_EDIT 0x81
69 #define CT_STATIC 0x82
70 #define CT_LISTBOX 0x83
71 #define CT_SCROLLBAR 0x84
72 #define CT_COMBOBOX 0x85
74 /* Byteordering defines */
75 #define WRC_BO_NATIVE 0x00
76 #define WRC_BO_LITTLE 0x01
77 #define WRC_BO_BIG 0x02
79 #define WRC_LOBYTE(w) ((WORD)(w) & 0xff)
80 #define WRC_HIBYTE(w) (((WORD)(w) >> 8) & 0xff)
81 #define WRC_LOWORD(d) ((DWORD)(d) & 0xffff)
82 #define WRC_HIWORD(d) (((DWORD)(d) >> 16) & 0xffff)
83 #define BYTESWAP_WORD(w) ((WORD)(((WORD)WRC_LOBYTE(w) << 8) + (WORD)WRC_HIBYTE(w)))
84 #define BYTESWAP_DWORD(d) ((DWORD)(((DWORD)BYTESWAP_WORD(WRC_LOWORD(d)) << 16) + ((DWORD)BYTESWAP_WORD(WRC_HIWORD(d)))))
86 typedef struct
88 const char *file;
89 int line;
90 int col;
91 } location_t;
93 /* Binary resource structure */
94 #define RES_BLOCKSIZE 512
96 typedef struct res {
97 unsigned int allocsize; /* Allocated datablock size */
98 unsigned int size; /* Actual size of data */
99 unsigned int dataidx; /* Tag behind the resource-header */
100 unsigned char *data;
101 } res_t;
103 /* Resource strings are slightly more complex because they include '\0' */
104 enum str_e {str_char, str_unicode};
106 typedef struct string {
107 int size;
108 enum str_e type;
109 union {
110 char *cstr;
111 WCHAR *wstr;
112 } str;
113 location_t loc;
114 } string_t;
116 /* Resources are identified either by name or by number */
117 enum name_e {name_str, name_ord};
119 typedef struct name_id {
120 union {
121 string_t *s_name;
122 int i_name;
123 } name;
124 enum name_e type;
125 } name_id_t;
127 /* Language definitions */
128 typedef struct language {
129 int id;
130 int sub;
131 } language_t;
133 typedef DWORD characts_t;
134 typedef DWORD version_t;
136 typedef struct lvc {
137 language_t *language;
138 version_t *version;
139 characts_t *characts;
140 } lvc_t;
142 typedef struct font_id {
143 string_t *name;
144 int size;
145 int weight;
146 int italic;
147 } font_id_t;
149 /* control styles */
150 typedef struct style {
151 DWORD or_mask;
152 DWORD and_mask;
153 } style_t;
155 /* resource types */
156 /* These are in the same order (and ordinal) as the RT_xxx
157 * defines. This is _required_.
158 * I rolled my own numbers for the win32 extension that are
159 * documented, but generate either old RT_xxx numbers, or
160 * don't have an ordinal associated (user type).
161 * I don't know any specs for those noted such, for that matter,
162 * I don't even know whether they can be generated other than by
163 * using a user-type resource.
165 enum res_e {
166 res_0 = 0,
167 res_cur,
168 res_bmp,
169 res_ico,
170 res_men,
171 res_dlg,
172 res_stt,
173 res_fntdir,
174 res_fnt,
175 res_acc,
176 res_rdt,
177 res_msg,
178 res_curg,
179 res_13, /* Hm, wonder why it's not used... */
180 res_icog,
181 res_15,
182 res_ver,
183 res_dlginc, /* Not implemented, no layout available */
184 res_18,
185 res_pnp, /* Not implemented, no layout available */
186 res_vxd, /* Not implemented, no layout available */
187 res_anicur,
188 res_aniico,
189 res_html, /* Not implemented, no layout available */
191 res_dlginit = WRC_RT_DLGINIT, /* 240 */
192 res_toolbar = WRC_RT_TOOLBAR, /* 241 */
194 res_usr = 256 + 6
197 /* Raw bytes in a row... */
198 typedef struct raw_data {
199 unsigned int size;
200 char *data;
201 lvc_t lvc; /* Localized data */
202 } raw_data_t;
204 /* Dialog structures */
205 typedef struct control {
206 struct control *next; /* List of controls */
207 struct control *prev;
208 name_id_t *ctlclass; /* ControlClass */
209 name_id_t *title; /* Title of control */
210 int id;
211 int x; /* Position */
212 int y;
213 int width; /* Size */
214 int height;
215 style_t *style; /* Style */
216 style_t *exstyle;
217 DWORD helpid; /* EX: */
218 int gotstyle; /* Used to determine whether the default */
219 int gotexstyle; /* styles must be set */
220 int gothelpid;
221 raw_data_t *extra; /* EX: number of extra bytes in resource */
222 } control_t;
224 typedef struct dialog {
225 DWORD memopt;
226 int x; /* Position */
227 int y;
228 int width; /* Size */
229 int height;
230 style_t *style; /* Style */
231 style_t *exstyle;
232 DWORD helpid; /* EX: */
233 int gotstyle; /* Used to determine whether the default */
234 int gotexstyle; /* styles must be set */
235 int gothelpid;
236 int is_ex;
237 name_id_t *menu;
238 name_id_t *dlgclass;
239 string_t *title;
240 font_id_t *font;
241 lvc_t lvc;
242 control_t *controls;
243 } dialog_t;
245 /* Menu structures */
246 typedef struct menu_item {
247 struct menu_item *next;
248 struct menu_item *prev;
249 struct menu_item *popup;
250 int id;
251 DWORD type;
252 DWORD state;
253 int helpid;
254 string_t *name;
255 int gotid;
256 int gottype;
257 int gotstate;
258 int gothelpid;
259 } menu_item_t;
261 typedef struct menu {
262 DWORD memopt;
263 lvc_t lvc;
264 int is_ex;
265 menu_item_t *items;
266 } menu_t;
268 typedef struct itemex_opt
270 int id;
271 DWORD type;
272 DWORD state;
273 int helpid;
274 int gotid;
275 int gottype;
276 int gotstate;
277 int gothelpid;
278 } itemex_opt_t;
281 * Font resources
283 typedef struct font {
284 DWORD memopt;
285 raw_data_t *data;
286 } font_t;
288 typedef struct fontdir {
289 DWORD memopt;
290 raw_data_t *data;
291 } fontdir_t;
294 * Icon resources
296 typedef struct icon_header {
297 WORD reserved; /* Don't know, should be 0 I guess */
298 WORD type; /* Always 1 for icons */
299 WORD count; /* Number of packed icons in resource */
300 } icon_header_t;
302 typedef struct icon_dir_entry {
303 BYTE width; /* From the SDK doc. */
304 BYTE height;
305 BYTE nclr;
306 BYTE reserved;
307 WORD planes;
308 WORD bits;
309 DWORD ressize;
310 DWORD offset;
311 } icon_dir_entry_t;
313 typedef struct icon {
314 struct icon *next;
315 struct icon *prev;
316 lvc_t lvc;
317 int id; /* Unique icon id within resource file */
318 int width; /* Field from the IconDirEntry */
319 int height;
320 int nclr;
321 int planes;
322 int bits;
323 raw_data_t *data;
324 } icon_t;
326 typedef struct icon_group {
327 DWORD memopt;
328 lvc_t lvc;
329 icon_t *iconlist;
330 int nicon;
331 } icon_group_t;
334 * Cursor resources
336 typedef struct cursor_header {
337 WORD reserved; /* Don't know, should be 0 I guess */
338 WORD type; /* Always 2 for cursors */
339 WORD count; /* Number of packed cursors in resource */
340 } cursor_header_t;
342 typedef struct cursor_dir_entry {
343 BYTE width; /* From the SDK doc. */
344 BYTE height;
345 BYTE nclr;
346 BYTE reserved;
347 WORD xhot;
348 WORD yhot;
349 DWORD ressize;
350 DWORD offset;
351 } cursor_dir_entry_t;
353 typedef struct cursor {
354 struct cursor *next;
355 struct cursor *prev;
356 lvc_t lvc;
357 int id; /* Unique icon id within resource file */
358 int width; /* Field from the CursorDirEntry */
359 int height;
360 int nclr;
361 int planes;
362 int bits;
363 int xhot;
364 int yhot;
365 raw_data_t *data;
366 } cursor_t;
368 typedef struct cursor_group {
369 DWORD memopt;
370 lvc_t lvc;
371 cursor_t *cursorlist;
372 int ncursor;
373 } cursor_group_t;
376 * Animated cursors and icons
378 typedef struct aniheader {
379 DWORD structsize; /* Header size (36 bytes) */
380 DWORD frames; /* Number of unique icons in this cursor */
381 DWORD steps; /* Number of blits before the animation cycles */
382 DWORD cx; /* reserved, must be 0? */
383 DWORD cy; /* reserved, must be 0? */
384 DWORD bitcount; /* reserved, must be 0? */
385 DWORD planes; /* reserved, must be 0? */
386 DWORD rate; /* Default rate (1/60th of a second) if "rate" not present */
387 DWORD flags; /* Animation flag (1==AF_ICON, although both icons and cursors set this) */
388 } aniheader_t;
390 typedef struct riff_tag {
391 BYTE tag[4];
392 DWORD size;
393 } riff_tag_t;
395 typedef struct ani_curico {
396 DWORD memopt;
397 raw_data_t *data;
398 } ani_curico_t;
400 typedef struct ani_any {
401 enum res_e type;
402 union {
403 ani_curico_t *ani;
404 cursor_group_t *curg;
405 icon_group_t *icog;
406 } u;
407 } ani_any_t;
410 * Bitmaps
412 typedef struct bitmap {
413 DWORD memopt;
414 raw_data_t *data;
415 } bitmap_t;
417 typedef struct html {
418 DWORD memopt;
419 raw_data_t *data;
420 } html_t;
422 typedef struct rcdata {
423 DWORD memopt;
424 raw_data_t *data;
425 } rcdata_t;
427 typedef struct {
428 DWORD memopt;
429 name_id_t *type;
430 raw_data_t *data;
431 } user_t;
434 * Messagetables
436 typedef struct msgtab_block {
437 DWORD idlo; /* Lowest id in the set */
438 DWORD idhi; /* Highest is in the set */
439 DWORD offset; /* Offset from resource start to first entry */
440 } msgtab_block_t;
442 typedef struct msgtab_entry {
443 WORD length; /* Length of the data in bytes */
444 WORD flags; /* 0 for char, 1 for WCHAR */
445 /* {char}|{WCHAR} data[...]; */
446 } msgtab_entry_t;
448 typedef struct messagetable {
449 DWORD memopt;
450 raw_data_t *data;
451 } messagetable_t;
453 /* StringTable structures */
454 typedef struct stt_entry {
455 string_t *str;
456 int id;
457 DWORD memopt;
458 characts_t *characts;
459 version_t *version;
460 } stt_entry_t;
462 typedef struct stringtable {
463 struct stringtable *next;
464 struct stringtable *prev;
465 DWORD memopt;
466 lvc_t lvc;
467 int idbase;
468 int nentries;
469 stt_entry_t *entries;
470 } stringtable_t;
472 /* VersionInfo structures */
473 enum ver_val_e {val_str, val_words, val_block};
475 struct ver_block; /* Forward ref */
477 typedef struct ver_words {
478 WORD *words;
479 int nwords;
480 } ver_words_t;
482 typedef struct ver_value {
483 struct ver_value *next;
484 struct ver_value *prev;
485 string_t *key;
486 union {
487 string_t *str;
488 ver_words_t *words;
489 struct ver_block *block;
490 } value;
491 enum ver_val_e type;
492 } ver_value_t;
494 typedef struct ver_block {
495 struct ver_block *next;
496 struct ver_block *prev;
497 string_t *name;
498 ver_value_t *values;
499 } ver_block_t;
501 typedef struct versioninfo {
502 int filever_maj1;
503 int filever_maj2;
504 int filever_min1;
505 int filever_min2;
506 int prodver_maj1;
507 int prodver_maj2;
508 int prodver_min1;
509 int prodver_min2;
510 int fileos;
511 int fileflags;
512 int fileflagsmask;
513 int filetype;
514 int filesubtype;
515 struct {
516 unsigned fv:1;
517 unsigned pv:1;
518 unsigned fo:1;
519 unsigned ff:1;
520 unsigned ffm:1;
521 unsigned ft:1;
522 unsigned fst:1;
523 } gotit;
524 ver_block_t *blocks;
525 lvc_t lvc;
526 DWORD memopt;
527 } versioninfo_t;
529 /* Accelerator structures */
530 #define WRC_AF_VIRTKEY 0x0001
531 #define WRC_AF_NOINVERT 0x0002
532 #define WRC_AF_SHIFT 0x0004
533 #define WRC_AF_CONTROL 0x0008
534 #define WRC_AF_ALT 0x0010
535 #define WRC_AF_ASCII 0x4000
537 typedef struct event {
538 struct event *next;
539 struct event *prev;
540 string_t *str;
541 int flags;
542 int key;
543 int id;
544 } event_t;
546 typedef struct accelerator {
547 DWORD memopt;
548 lvc_t lvc;
549 event_t *events;
550 } accelerator_t;
552 /* Toolbar structures */
553 typedef struct toolbar_item {
554 struct toolbar_item *next;
555 struct toolbar_item *prev;
556 int id;
557 } toolbar_item_t;
559 typedef struct toolbar {
560 DWORD memopt;
561 lvc_t lvc;
562 int button_width;
563 int button_height;
564 int nitems;
565 toolbar_item_t *items;
566 } toolbar_t;
568 typedef struct dlginit {
569 DWORD memopt;
570 raw_data_t *data;
571 } dlginit_t;
574 /* A top-level resource node */
575 typedef struct resource {
576 struct resource *next;
577 struct resource *prev;
578 enum res_e type;
579 name_id_t *name; /* resource's name */
580 language_t *lan; /* Only used as a sorting key and c-name creation*/
581 union {
582 accelerator_t *acc;
583 ani_curico_t *ani;
584 bitmap_t *bmp;
585 cursor_t *cur;
586 cursor_group_t *curg;
587 dialog_t *dlg;
588 dlginit_t *dlgi;
589 font_t *fnt;
590 fontdir_t *fnd;
591 icon_t *ico;
592 icon_group_t *icog;
593 menu_t *men;
594 messagetable_t *msg;
595 html_t *html;
596 rcdata_t *rdt;
597 stringtable_t *stt;
598 toolbar_t *tbt;
599 user_t *usr;
600 versioninfo_t *ver;
601 void *overlay; /* To catch all types at once... */
602 } res;
603 res_t *binres; /* To binary converted resource */
604 char *c_name; /* BaseName in output */
605 DWORD memopt;
606 } resource_t;
608 /* Resource count */
609 typedef struct res32_count {
610 int count;
611 resource_t **rsc;
612 } res32_count_t;
614 typedef struct res_count {
615 name_id_t type;
616 int count; /* win16 mode */
617 resource_t **rscarray;
618 int count32;
619 res32_count_t *rsc32array; /* win32 mode */
620 int n_id_entries;
621 int n_name_entries;
622 } res_count_t;
624 typedef struct style_pair {
625 style_t *style;
626 style_t *exstyle;
627 } style_pair_t;
629 #endif