Fixed allocation of 16x16 icons.
[wine.git] / tools / wrc / wrctypes.h
blob73c8d032227b56c3169fe95575e147ae15a4cc99
1 /*
2 * General type definitions
4 * Copyright 1998 Bertho A. Stultiens (BS)
6 */
8 #ifndef __WRC_WRCTYPES_H
9 #define __WRC_WRCTYPES_H
11 #include "windef.h"
13 #ifndef MAKELANGID
14 #include "winnls.h"
15 #endif
17 #ifndef VS_FFI_SIGNATURE
18 #include "winver.h"
19 #endif
21 /* Memory/load flags */
22 #define WRC_MO_MOVEABLE 0x0010
23 #define WRC_MO_PURE 0x0020
24 #define WRC_MO_PRELOAD 0x0040
25 #define WRC_MO_DISCARDABLE 0x1000
27 /* Resource type IDs */
28 #define WRC_RT_CURSOR (1)
29 #define WRC_RT_BITMAP (2)
30 #define WRC_RT_ICON (3)
31 #define WRC_RT_MENU (4)
32 #define WRC_RT_DIALOG (5)
33 #define WRC_RT_STRING (6)
34 #define WRC_RT_FONTDIR (7)
35 #define WRC_RT_FONT (8)
36 #define WRC_RT_ACCELERATOR (9)
37 #define WRC_RT_RCDATA (10)
38 #define WRC_RT_MESSAGETABLE (11)
39 #define WRC_RT_GROUP_CURSOR (12)
40 #define WRC_RT_GROUP_ICON (14)
41 #define WRC_RT_VERSION (16)
42 #define WRC_RT_DLGINCLUDE (17)
43 #define WRC_RT_PLUGPLAY (19)
44 #define WRC_RT_VXD (20)
45 #define WRC_RT_ANICURSOR (21)
46 #define WRC_RT_ANIICON (22)
47 #define WRC_RT_DLGINIT (240)
48 #define WRC_RT_TOOLBAR (241)
50 /* Default class type IDs */
51 #define CT_BUTTON 0x80
52 #define CT_EDIT 0x81
53 #define CT_STATIC 0x82
54 #define CT_LISTBOX 0x83
55 #define CT_SCROLLBAR 0x84
56 #define CT_COMBOBOX 0x85
59 /* Binary resource structure */
60 #define RES_BLOCKSIZE 512
62 typedef struct res {
63 int allocsize; /* Allocated datablock size */
64 int size; /* Actual size of data */
65 int dataidx; /* Tag behind the resource-header */
66 char *data;
67 } res_t;
69 /* Resource strings are slightly more complex because they include '\0' */
70 enum str_e {str_char, str_unicode};
72 typedef struct string {
73 int size;
74 enum str_e type;
75 union {
76 char *cstr;
77 short *wstr;
78 } str;
79 } string_t;
81 /* Resources are identified either by name or by number */
82 enum name_e {name_str, name_ord};
84 typedef struct name_id {
85 union {
86 string_t *s_name;
87 int i_name;
88 } name;
89 enum name_e type;
90 } name_id_t;
92 /* Language definitions */
93 typedef struct language {
94 int id;
95 int sub;
96 } language_t;
98 typedef DWORD characts_t;
99 typedef DWORD version_t;
101 typedef struct lvc {
102 language_t *language;
103 version_t *version;
104 characts_t *characts;
105 } lvc_t;
107 typedef struct font_id {
108 string_t *name;
109 int size;
110 int weight;
111 int italic;
112 } font_id_t;
114 /* control styles */
115 typedef struct style {
116 DWORD or_mask;
117 DWORD and_mask;
118 } style_t;
120 /* resource types */
121 /* These are in the same order (and ordinal) as the RT_xxx
122 * defines. This is _required_.
123 * I rolled my own numbers for the win32 extension that are
124 * documented, but generate either old RT_xxx numbers, or
125 * don't have an ordinal associated (user type).
126 * I don't know any specs for those noted such, for that matter,
127 * I don't even know whether they can be generated other than by
128 * using a user-type resource.
130 enum res_e {
131 res_0 = 0,
132 res_cur,
133 res_bmp,
134 res_ico,
135 res_men,
136 res_dlg,
137 res_stt,
138 res_fntdir,
139 res_fnt,
140 res_acc,
141 res_rdt,
142 res_msg,
143 res_curg,
144 res_13, /* Hm, wonder why its not used... */
145 res_icog,
146 res_15,
147 res_ver,
148 res_dlginc, /* Not implemented, no layout available */
149 res_18,
150 res_pnp, /* Not implemented, no layout available */
151 res_vxd, /* Not implemented, no layout available */
152 res_anicur, /* Not implemented, no layout available */
153 res_aniico, /* Not implemented, no layout available */
155 res_dlginit = WRC_RT_DLGINIT, /* 240 */
156 res_toolbar = WRC_RT_TOOLBAR, /* 241 */
158 res_menex = 256 + 4,
159 res_dlgex,
160 res_usr
163 /* Raw bytes in a row... */
164 typedef struct raw_data {
165 int size;
166 char *data;
167 } raw_data_t;
169 /* Dialog structures */
170 typedef struct control {
171 struct control *next; /* List of controls */
172 struct control *prev;
173 name_id_t *ctlclass; /* ControlClass */
174 name_id_t *title; /* Title of control */
175 int id;
176 int x; /* Position */
177 int y;
178 int width; /* Size */
179 int height;
180 style_t *style; /* Style */
181 style_t *exstyle;
182 DWORD helpid; /* EX: */
183 int gotstyle; /* Used to determine whether the default */
184 int gotexstyle; /* styles must be set */
185 int gothelpid;
186 raw_data_t *extra; /* EX: number of extra bytes in resource */
187 } control_t;
189 typedef struct dialog {
190 DWORD memopt;
191 int x; /* Position */
192 int y;
193 int width; /* Size */
194 int height;
195 style_t *style; /* Style */
196 style_t *exstyle;
197 int gotstyle; /* Used to determine whether the default */
198 int gotexstyle; /* styles must be set */
199 name_id_t *menu;
200 name_id_t *dlgclass;
201 string_t *title;
202 font_id_t *font;
203 lvc_t lvc;
204 control_t *controls;
205 } dialog_t;
207 /* DialogEx structures */
208 typedef struct dialogex {
209 DWORD memopt;
210 int x; /* Position */
211 int y;
212 int width; /* Size */
213 int height;
214 style_t *style; /* Style */
215 style_t *exstyle;
216 DWORD helpid; /* EX: */
217 int gotstyle; /* Used to determine whether the default */
218 int gotexstyle; /* styles must be set */
219 int gothelpid;
220 name_id_t *menu;
221 name_id_t *dlgclass;
222 string_t *title;
223 font_id_t *font;
224 lvc_t lvc;
225 control_t *controls;
226 } dialogex_t;
228 /* Menu structures */
229 typedef struct menu_item {
230 struct menu_item *next;
231 struct menu_item *prev;
232 struct menu_item *popup;
233 int id;
234 DWORD state;
235 string_t *name;
236 } menu_item_t;
238 typedef struct menu {
239 DWORD memopt;
240 lvc_t lvc;
241 menu_item_t *items;
242 } menu_t;
244 /* MenuEx structures */
245 typedef struct menuex_item {
246 struct menuex_item *next;
247 struct menuex_item *prev;
248 struct menuex_item *popup;
249 int id;
250 DWORD type;
251 DWORD state;
252 int helpid;
253 string_t *name;
254 int gotid;
255 int gottype;
256 int gotstate;
257 int gothelpid;
258 } menuex_item_t;
260 typedef struct menuex {
261 DWORD memopt;
262 lvc_t lvc;
263 menuex_item_t *items;
264 } menuex_t;
266 typedef struct itemex_opt
268 int id;
269 DWORD type;
270 DWORD state;
271 int helpid;
272 int gotid;
273 int gottype;
274 int gotstate;
275 int gothelpid;
276 } itemex_opt_t;
278 /* RC structures for types read from file or supplied binary */
279 typedef struct font {
280 DWORD memopt;
281 raw_data_t *data;
282 } font_t;
284 typedef struct icon_dir_entry {
285 BYTE width; /* From the SDK doc. */
286 BYTE height;
287 BYTE nclr;
288 BYTE reserved;
289 WORD planes;
290 WORD bits;
291 DWORD ressize;
292 DWORD offset;
293 } icon_dir_entry_t;
295 typedef struct icon {
296 struct icon *next;
297 struct icon *prev;
298 lvc_t lvc;
299 int id; /* Unique icon id within resource file */
300 int width; /* Field from the IconDirEntry */
301 int height;
302 int nclr;
303 int planes;
304 int bits;
305 raw_data_t *data;
306 } icon_t;
308 typedef struct icon_group {
309 DWORD memopt;
310 lvc_t lvc;
311 icon_t *iconlist;
312 int nicon;
313 } icon_group_t;
315 typedef struct cursor_dir_entry {
316 BYTE width; /* From the SDK doc. */
317 BYTE height;
318 BYTE nclr;
319 BYTE reserved;
320 WORD xhot;
321 WORD yhot;
322 DWORD ressize;
323 DWORD offset;
324 } cursor_dir_entry_t;
326 typedef struct cursor {
327 struct cursor *next;
328 struct cursor *prev;
329 lvc_t lvc;
330 int id; /* Unique icon id within resource file */
331 int width; /* Field from the CursorDirEntry */
332 int height;
333 int nclr;
334 int planes;
335 int bits;
336 int xhot;
337 int yhot;
338 raw_data_t *data;
339 } cursor_t;
341 typedef struct cursor_group {
342 DWORD memopt;
343 lvc_t lvc;
344 cursor_t *cursorlist;
345 int ncursor;
346 } cursor_group_t;
348 typedef struct bitmap {
349 DWORD memopt;
350 raw_data_t *data;
351 } bitmap_t;
353 typedef struct rcdata {
354 DWORD memopt;
355 lvc_t lvc;
356 raw_data_t *data;
357 } rcdata_t;
359 typedef struct user {
360 DWORD memopt;
361 name_id_t *type;
362 raw_data_t *data;
363 } user_t;
365 typedef struct messagetable {
366 raw_data_t *data;
367 } messagetable_t;
369 /* StringTable structures */
370 typedef struct stt_entry {
371 string_t *str;
372 int id;
373 DWORD memopt;
374 characts_t *characts;
375 version_t *version;
376 } stt_entry_t;
378 typedef struct stringtable {
379 struct stringtable *next;
380 struct stringtable *prev;
381 DWORD memopt;
382 lvc_t lvc;
383 int idbase;
384 int nentries;
385 stt_entry_t *entries;
386 } stringtable_t;
388 /* VersionInfo structures */
389 enum ver_val_e {val_str, val_words, val_block};
391 struct ver_block; /* Forward ref */
393 typedef struct ver_words {
394 WORD *words;
395 int nwords;
396 } ver_words_t;
398 typedef struct ver_value {
399 struct ver_value *next;
400 struct ver_value *prev;
401 string_t *key;
402 union {
403 string_t *str;
404 ver_words_t *words;
405 struct ver_block *block;
406 } value;
407 enum ver_val_e type;
408 } ver_value_t;
410 typedef struct ver_block {
411 struct ver_block *next;
412 struct ver_block *prev;
413 string_t *name;
414 ver_value_t *values;
415 } ver_block_t;
417 typedef struct versioninfo {
418 int filever_maj1;
419 int filever_maj2;
420 int filever_min1;
421 int filever_min2;
422 int prodver_maj1;
423 int prodver_maj2;
424 int prodver_min1;
425 int prodver_min2;
426 int fileos;
427 int fileflags;
428 int fileflagsmask;
429 int filetype;
430 int filesubtype;
431 struct {
432 int fv:1;
433 int pv:1;
434 int fo:1;
435 int ff:1;
436 int ffm:1;
437 int ft:1;
438 int fst:1;
439 } gotit;
440 ver_block_t *blocks;
441 } versioninfo_t;
443 /* Accelerator structures */
444 #define WRC_AF_VIRTKEY 0x0001
445 #define WRC_AF_NOINVERT 0x0002
446 #define WRC_AF_SHIFT 0x0004
447 #define WRC_AF_CONTROL 0x0008
448 #define WRC_AF_ALT 0x0010
449 #define WRC_AF_ASCII 0x4000
451 typedef struct event {
452 struct event *next;
453 struct event *prev;
454 int flags;
455 int key;
456 int id;
457 } event_t;
459 typedef struct accelerator {
460 DWORD memopt;
461 lvc_t lvc;
462 event_t *events;
463 } accelerator_t;
465 /* Toolbar structures */
466 typedef struct toolbar_item {
467 struct toolbar_item *next;
468 struct toolbar_item *prev;
469 int id;
470 } toolbar_item_t;
472 typedef struct toolbar {
473 DWORD memopt;
474 lvc_t lvc;
475 int button_width;
476 int button_height;
477 int nitems;
478 toolbar_item_t *items;
479 } toolbar_t;
481 typedef struct dlginit {
482 DWORD memopt;
483 lvc_t lvc;
484 raw_data_t *data;
485 } dlginit_t;
488 /* A top-level resource node */
489 typedef struct resource {
490 struct resource *next;
491 struct resource *prev;
492 enum res_e type;
493 name_id_t *name; /* resource's name */
494 language_t *lan; /* Only used as a sorting key and c-name creation*/
495 union {
496 accelerator_t *acc;
497 bitmap_t *bmp;
498 cursor_t *cur;
499 cursor_group_t *curg;
500 dialog_t *dlg;
501 dialogex_t *dlgex;
502 dlginit_t *dlgi;
503 font_t *fnt;
504 icon_t *ico;
505 icon_group_t *icog;
506 menu_t *men;
507 menuex_t *menex;
508 messagetable_t *msg;
509 rcdata_t *rdt;
510 stringtable_t *stt;
511 toolbar_t *tbt;
512 user_t *usr;
513 versioninfo_t *ver;
514 void *overlay; /* To catch all types at once... */
515 } res;
516 res_t *binres; /* To binary converted resource */
517 char *c_name; /* BaseName in output */
518 DWORD memopt;
519 } resource_t;
521 /* Resource count */
522 typedef struct res32_count {
523 int count;
524 resource_t **rsc;
525 } res32_count_t;
527 typedef struct res_count {
528 name_id_t type;
529 int count; /* win16 mode */
530 resource_t **rscarray;
531 int count32;
532 res32_count_t *rsc32array; /* win32 mode */
533 int n_id_entries;
534 int n_name_entries;
535 } res_count_t;
537 typedef struct style_pair {
538 style_t *style;
539 style_t *exstyle;
540 } style_pair_t;
542 #endif