dmime: The soft synth doesn't supports sharing the channel groups.
[wine.git] / tools / wrc / wrctypes.h
blob21b2f8242d7509a7c8153446f57cfe0f9442e694
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"
27 #include "winnls.h"
29 #ifndef VS_FFI_SIGNATURE
30 #include "winver.h"
31 #endif
33 /* Memory/load flags */
34 #define WRC_MO_MOVEABLE 0x0010
35 #define WRC_MO_PURE 0x0020
36 #define WRC_MO_PRELOAD 0x0040
37 #define WRC_MO_DISCARDABLE 0x1000
39 /* Resource type IDs */
40 #define WRC_RT_CURSOR (1)
41 #define WRC_RT_BITMAP (2)
42 #define WRC_RT_ICON (3)
43 #define WRC_RT_MENU (4)
44 #define WRC_RT_DIALOG (5)
45 #define WRC_RT_STRING (6)
46 #define WRC_RT_FONTDIR (7)
47 #define WRC_RT_FONT (8)
48 #define WRC_RT_ACCELERATOR (9)
49 #define WRC_RT_RCDATA (10)
50 #define WRC_RT_MESSAGETABLE (11)
51 #define WRC_RT_GROUP_CURSOR (12)
52 #define WRC_RT_GROUP_ICON (14)
53 #define WRC_RT_VERSION (16)
54 #define WRC_RT_DLGINCLUDE (17)
55 #define WRC_RT_PLUGPLAY (19)
56 #define WRC_RT_VXD (20)
57 #define WRC_RT_ANICURSOR (21)
58 #define WRC_RT_ANIICON (22)
59 #define WRC_RT_HTML (23)
60 #define WRC_RT_DLGINIT (240)
61 #define WRC_RT_TOOLBAR (241)
63 /* Default class type IDs */
64 #define CT_BUTTON 0x80
65 #define CT_EDIT 0x81
66 #define CT_STATIC 0x82
67 #define CT_LISTBOX 0x83
68 #define CT_SCROLLBAR 0x84
69 #define CT_COMBOBOX 0x85
71 #define GET_WORD(ptr) (((unsigned char *)(ptr))[0] | (((unsigned char *)(ptr))[1] << 8))
72 #define GET_DWORD(ptr) (((unsigned char *)(ptr))[0] | (((unsigned char *)(ptr))[1] << 8) | (((unsigned char *)(ptr))[2] << 16) | (((unsigned char *)(ptr))[3] << 24))
74 typedef struct
76 const char *file;
77 int line;
78 int col;
79 } location_t;
81 /* Resource strings are slightly more complex because they include '\0' */
82 enum str_e {str_char, str_unicode};
84 typedef struct string {
85 int size;
86 enum str_e type;
87 union {
88 char *cstr;
89 WCHAR *wstr;
90 } str;
91 location_t loc;
92 } string_t;
94 /* Resources are identified either by name or by number */
95 enum name_e {name_str, name_ord};
97 typedef struct name_id {
98 union {
99 string_t *s_name;
100 int i_name;
101 } name;
102 enum name_e type;
103 } name_id_t;
105 /* Language definitions */
106 typedef struct language {
107 int id;
108 int sub;
109 } language_t;
111 typedef unsigned int characts_t;
112 typedef unsigned int version_t;
114 typedef struct lvc {
115 language_t *language;
116 version_t *version;
117 characts_t *characts;
118 } lvc_t;
120 typedef struct font_id {
121 string_t *name;
122 int size;
123 int weight;
124 int italic;
125 } font_id_t;
127 /* control styles */
128 typedef struct style {
129 unsigned int or_mask;
130 unsigned int and_mask;
131 } style_t;
133 /* resource types */
134 /* These are in the same order (and ordinal) as the RT_xxx
135 * defines. This is _required_.
136 * I rolled my own numbers for the win32 extension that are
137 * documented, but generate either old RT_xxx numbers, or
138 * don't have an ordinal associated (user type).
139 * I don't know any specs for those noted such, for that matter,
140 * I don't even know whether they can be generated other than by
141 * using a user-type resource.
143 enum res_e {
144 res_0 = 0,
145 res_cur,
146 res_bmp,
147 res_ico,
148 res_men,
149 res_dlg,
150 res_stt,
151 res_fntdir,
152 res_fnt,
153 res_acc,
154 res_rdt,
155 res_msg,
156 res_curg,
157 res_13, /* Hm, wonder why it's not used... */
158 res_icog,
159 res_15,
160 res_ver,
161 res_dlginc, /* Not implemented, no layout available */
162 res_18,
163 res_pnp, /* Not implemented, no layout available */
164 res_vxd, /* Not implemented, no layout available */
165 res_anicur,
166 res_aniico,
167 res_html, /* Not implemented, no layout available */
169 res_dlginit = WRC_RT_DLGINIT, /* 240 */
170 res_toolbar = WRC_RT_TOOLBAR, /* 241 */
172 res_usr = 256 + 6
175 /* Raw bytes in a row... */
176 typedef struct raw_data {
177 unsigned int size;
178 char *data;
179 lvc_t lvc; /* Localized data */
180 } raw_data_t;
182 /* Dialog structures */
183 typedef struct control {
184 struct control *next; /* List of controls */
185 struct control *prev;
186 name_id_t *ctlclass; /* ControlClass */
187 name_id_t *title; /* Title of control */
188 int id;
189 int x; /* Position */
190 int y;
191 int width; /* Size */
192 int height;
193 style_t *style; /* Style */
194 style_t *exstyle;
195 unsigned int helpid; /* EX: */
196 int gotstyle; /* Used to determine whether the default */
197 int gotexstyle; /* styles must be set */
198 int gothelpid;
199 raw_data_t *extra; /* EX: number of extra bytes in resource */
200 } control_t;
202 typedef struct dialog {
203 unsigned int memopt;
204 int x; /* Position */
205 int y;
206 int width; /* Size */
207 int height;
208 style_t *style; /* Style */
209 style_t *exstyle;
210 unsigned int helpid; /* EX: */
211 int gotstyle; /* Used to determine whether the default */
212 int gotexstyle; /* styles must be set */
213 int gothelpid;
214 int is_ex;
215 name_id_t *menu;
216 name_id_t *dlgclass;
217 string_t *title;
218 font_id_t *font;
219 lvc_t lvc;
220 control_t *controls;
221 } dialog_t;
223 /* Menu structures */
224 typedef struct menu_item {
225 struct menu_item *next;
226 struct menu_item *prev;
227 struct menu_item *popup;
228 int id;
229 unsigned int type;
230 unsigned int state;
231 int helpid;
232 string_t *name;
233 int gotid;
234 int gottype;
235 int gotstate;
236 int gothelpid;
237 } menu_item_t;
239 typedef struct menu {
240 unsigned int memopt;
241 lvc_t lvc;
242 int is_ex;
243 menu_item_t *items;
244 } menu_t;
246 typedef struct itemex_opt
248 int id;
249 unsigned int type;
250 unsigned int state;
251 int helpid;
252 int gotid;
253 int gottype;
254 int gotstate;
255 int gothelpid;
256 } itemex_opt_t;
259 * Font resources
261 typedef struct font {
262 unsigned int memopt;
263 raw_data_t *data;
264 } font_t;
266 typedef struct fontdir {
267 unsigned int memopt;
268 raw_data_t *data;
269 } fontdir_t;
272 * Icon resources
274 typedef struct icon_header {
275 unsigned short reserved; /* Don't know, should be 0 I guess */
276 unsigned short type; /* Always 1 for icons */
277 unsigned short count; /* Number of packed icons in resource */
278 } icon_header_t;
280 typedef struct icon_dir_entry {
281 unsigned char width; /* From the SDK doc. */
282 unsigned char height;
283 unsigned char nclr;
284 unsigned char reserved;
285 unsigned short planes;
286 unsigned short bits;
287 unsigned int ressize;
288 unsigned int offset;
289 } icon_dir_entry_t;
291 typedef struct icon {
292 struct icon *next;
293 struct icon *prev;
294 lvc_t lvc;
295 int id; /* Unique icon id within resource file */
296 int width; /* Field from the IconDirEntry */
297 int height;
298 int nclr;
299 int planes;
300 int bits;
301 raw_data_t *data;
302 } icon_t;
304 typedef struct icon_group {
305 unsigned int memopt;
306 lvc_t lvc;
307 icon_t *iconlist;
308 int nicon;
309 } icon_group_t;
312 * Cursor resources
314 typedef struct cursor_header {
315 unsigned short reserved; /* Don't know, should be 0 I guess */
316 unsigned short type; /* Always 2 for cursors */
317 unsigned short count; /* Number of packed cursors in resource */
318 } cursor_header_t;
320 typedef struct cursor_dir_entry {
321 unsigned char width; /* From the SDK doc. */
322 unsigned char height;
323 unsigned char nclr;
324 unsigned char reserved;
325 unsigned short xhot;
326 unsigned short yhot;
327 unsigned int ressize;
328 unsigned int offset;
329 } cursor_dir_entry_t;
331 typedef struct cursor {
332 struct cursor *next;
333 struct cursor *prev;
334 lvc_t lvc;
335 int id; /* Unique icon id within resource file */
336 int width; /* Field from the CursorDirEntry */
337 int height;
338 int nclr;
339 int planes;
340 int bits;
341 int xhot;
342 int yhot;
343 raw_data_t *data;
344 } cursor_t;
346 typedef struct cursor_group {
347 unsigned int memopt;
348 lvc_t lvc;
349 cursor_t *cursorlist;
350 int ncursor;
351 } cursor_group_t;
354 * Animated cursors and icons
356 typedef struct aniheader {
357 unsigned int structsize; /* Header size (36 bytes) */
358 unsigned int frames; /* Number of unique icons in this cursor */
359 unsigned int steps; /* Number of blits before the animation cycles */
360 unsigned int cx; /* reserved, must be 0? */
361 unsigned int cy; /* reserved, must be 0? */
362 unsigned int bitcount; /* reserved, must be 0? */
363 unsigned int planes; /* reserved, must be 0? */
364 unsigned int rate; /* Default rate (1/60th of a second) if "rate" not present */
365 unsigned int flags; /* Animation flag (1==AF_ICON, although both icons and cursors set this) */
366 } aniheader_t;
368 typedef struct riff_tag {
369 unsigned char tag[4];
370 unsigned int size;
371 } riff_tag_t;
373 typedef struct ani_curico {
374 unsigned int memopt;
375 raw_data_t *data;
376 } ani_curico_t;
378 typedef struct ani_any {
379 enum res_e type;
380 union {
381 ani_curico_t *ani;
382 cursor_group_t *curg;
383 icon_group_t *icog;
384 } u;
385 } ani_any_t;
388 * Bitmaps
390 typedef struct bitmap {
391 unsigned int memopt;
392 raw_data_t *data;
393 } bitmap_t;
395 typedef struct html {
396 unsigned int memopt;
397 raw_data_t *data;
398 } html_t;
400 typedef struct rcdata {
401 unsigned int memopt;
402 raw_data_t *data;
403 } rcdata_t;
405 typedef struct {
406 unsigned int memopt;
407 name_id_t *type;
408 raw_data_t *data;
409 } user_t;
412 * Messagetables
414 typedef struct msgtab_block {
415 unsigned int idlo; /* Lowest id in the set */
416 unsigned int idhi; /* Highest is in the set */
417 unsigned int offset; /* Offset from resource start to first entry */
418 } msgtab_block_t;
420 typedef struct msgtab_entry {
421 unsigned short length; /* Length of the data in bytes */
422 unsigned short flags; /* 0 for char, 1 for WCHAR */
423 /* {char}|{WCHAR} data[...]; */
424 } msgtab_entry_t;
426 typedef struct messagetable {
427 unsigned int memopt;
428 raw_data_t *data;
429 } messagetable_t;
431 /* StringTable structures */
432 typedef struct stt_entry {
433 string_t *str;
434 int id;
435 unsigned int memopt;
436 characts_t *characts;
437 version_t *version;
438 } stt_entry_t;
440 typedef struct stringtable {
441 struct stringtable *next;
442 struct stringtable *prev;
443 unsigned int memopt;
444 lvc_t lvc;
445 int idbase;
446 int nentries;
447 stt_entry_t *entries;
448 } stringtable_t;
450 /* VersionInfo structures */
451 enum ver_val_e {val_str, val_words, val_block};
453 struct ver_block; /* Forward ref */
455 typedef struct ver_words {
456 unsigned short *words;
457 int nwords;
458 } ver_words_t;
460 typedef struct ver_value {
461 struct ver_value *next;
462 struct ver_value *prev;
463 string_t *key;
464 union {
465 string_t *str;
466 ver_words_t *words;
467 struct ver_block *block;
468 } value;
469 enum ver_val_e type;
470 } ver_value_t;
472 typedef struct ver_block {
473 struct ver_block *next;
474 struct ver_block *prev;
475 string_t *name;
476 ver_value_t *values;
477 } ver_block_t;
479 typedef struct versioninfo {
480 int filever_maj1;
481 int filever_maj2;
482 int filever_min1;
483 int filever_min2;
484 int prodver_maj1;
485 int prodver_maj2;
486 int prodver_min1;
487 int prodver_min2;
488 int fileos;
489 int fileflags;
490 int fileflagsmask;
491 int filetype;
492 int filesubtype;
493 struct {
494 unsigned fv:1;
495 unsigned pv:1;
496 unsigned fo:1;
497 unsigned ff:1;
498 unsigned ffm:1;
499 unsigned ft:1;
500 unsigned fst:1;
501 } gotit;
502 ver_block_t *blocks;
503 lvc_t lvc;
504 unsigned int memopt;
505 } versioninfo_t;
507 /* Accelerator structures */
508 #define WRC_AF_VIRTKEY 0x0001
509 #define WRC_AF_NOINVERT 0x0002
510 #define WRC_AF_SHIFT 0x0004
511 #define WRC_AF_CONTROL 0x0008
512 #define WRC_AF_ALT 0x0010
513 #define WRC_AF_ASCII 0x4000
515 typedef struct event {
516 struct event *next;
517 struct event *prev;
518 string_t *str;
519 int flags;
520 int key;
521 int id;
522 } event_t;
524 typedef struct accelerator {
525 unsigned int memopt;
526 lvc_t lvc;
527 event_t *events;
528 } accelerator_t;
530 /* Toolbar structures */
531 typedef struct toolbar_item {
532 struct toolbar_item *next;
533 struct toolbar_item *prev;
534 int id;
535 } toolbar_item_t;
537 typedef struct toolbar {
538 unsigned int memopt;
539 lvc_t lvc;
540 int button_width;
541 int button_height;
542 int nitems;
543 toolbar_item_t *items;
544 } toolbar_t;
546 typedef struct dlginit {
547 unsigned int memopt;
548 raw_data_t *data;
549 } dlginit_t;
552 /* A top-level resource node */
553 typedef struct resource {
554 struct resource *next;
555 struct resource *prev;
556 enum res_e type;
557 name_id_t *name; /* resource's name */
558 language_t *lan; /* Only used as a sorting key and c-name creation*/
559 union {
560 accelerator_t *acc;
561 ani_curico_t *ani;
562 bitmap_t *bmp;
563 cursor_t *cur;
564 cursor_group_t *curg;
565 dialog_t *dlg;
566 dlginit_t *dlgi;
567 font_t *fnt;
568 fontdir_t *fnd;
569 icon_t *ico;
570 icon_group_t *icog;
571 menu_t *men;
572 messagetable_t *msg;
573 html_t *html;
574 rcdata_t *rdt;
575 stringtable_t *stt;
576 toolbar_t *tbt;
577 user_t *usr;
578 versioninfo_t *ver;
579 void *overlay; /* To catch all types at once... */
580 } res;
581 unsigned int memopt;
582 } resource_t;
584 /* Resource count */
585 typedef struct res32_count {
586 int count;
587 resource_t **rsc;
588 } res32_count_t;
590 typedef struct res_count {
591 name_id_t type;
592 int count; /* win16 mode */
593 resource_t **rscarray;
594 int count32;
595 res32_count_t *rsc32array; /* win32 mode */
596 int n_id_entries;
597 int n_name_entries;
598 } res_count_t;
600 typedef struct style_pair {
601 style_t *style;
602 style_t *exstyle;
603 } style_pair_t;
605 #endif