1 /*	vcode.h
2 	Copyright (C) 2013-2020 Dmitry Groshev
3 
4 	This file is part of mtPaint.
5 
6 	mtPaint is free software; you can redistribute it and/or modify
7 	it under the terms of the GNU General Public License as published by
8 	the Free Software Foundation; either version 3 of the License, or
9 	(at your option) any later version.
10 
11 	mtPaint 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
14 	GNU General Public License for more details.
15 
16 	You should have received a copy of the GNU General Public License
17 	along with mtPaint in the file COPYING.
18 */
19 
20 enum {
21 	op_WEND = 0,
22 	op_WSHOW,
23 	op_WDIALOG,
24 	op_uWEND,
25 	op_uWSHOW,
26 
27 	op_END_LAST,
28 	op_WDONE = op_END_LAST,
29 
30 	op_MAINWINDOW,
31 	op_WINDOW,
32 	op_WINDOWm,
33 	op_DIALOGm,
34 	op_FPICKpm,
35 	op_POPUP,
36 	op_TOPVBOX,
37 	op_TOPVBOXV,
38 	op_uWINDOW,
39 	op_uFPICK,
40 	op_uTOPBOX,
41 
42 	op_DOCK,
43 	op_HVSPLIT,
44 	op_PAGE,
45 	op_PAGEi,
46 	op_TABLE,
47 	op_VBOX,
48 	op_HBOX,
49 	op_EQBOX,
50 	op_FRAME,
51 	op_EFRAME,
52 	op_SCROLL,
53 	op_NBOOK,
54 	op_NBOOKl,
55 	op_PLAINBOOK,
56 	op_BOOKBTN,
57 	op_STATUSBAR,
58 	op_STLABEL,
59 	op_HSEP,
60 	op_LABEL,
61 	op_WLABEL,
62 	op_HLABEL,
63 	op_HLABELm,
64 	op_TLTEXT,
65 	op_PROGRESS,
66 	op_COLORPATCH,
67 	op_RGBIMAGE,
68 	op_RGBIMAGEP,
69 	op_CANVASIMG,
70 	op_CANVASIMGB,
71 	op_FCIMAGEP,
72 	op_NOSPIN,
73 	op_uOP,
74 	op_uFRAME,
75 	op_uLABEL,
76 
77 	op_CSCROLL,
78 	op_CANVAS,
79 
80 	op_SPIN,
81 	op_SPINc,
82 	op_FSPIN,
83 	op_SPINa,
84 
85 	op_TLSPINPACK,
86 	op_SPINSLIDE,
87 	op_SPINSLIDEa,
88 	op_CHECK,
89 	op_CHECKb,
90 	op_RPACK,
91 	op_RPACKD,
92 	op_OPT,
93 	op_OPTD,
94 	op_COMBO,
95 	op_ENTRY,
96 	op_MLENTRY,
97 	op_PENTRY,
98 	op_PATH,
99 	op_PATHs,
100 	op_TEXT,
101 	op_COMBOENTRY,
102 	op_FONTSEL,
103 	op_HEXENTRY,
104 	op_EYEDROPPER,
105 	op_KEYBUTTON,
106 	op_TABLETBTN,
107 	op_COLOR,
108 	op_TCOLOR,
109 	op_COLORLIST,
110 	op_COLORLISTN,
111 	op_GRADBAR,
112 	op_PCTCOMBO,
113 	op_LISTCCr,
114 	op_LISTC,
115 	op_LISTCd,
116 	op_LISTCu,
117 	op_LISTCS,
118 	op_LISTCX,
119 	op_OKBTN,
120 	op_CANCELBTN,
121 	op_DONEBTN,
122 	op_TOGGLE,
123 	op_BUTTON,
124 	op_TOOLBAR,
125 	op_SMARTTBAR,
126 	op_SMARTTBMORE,
127 	op_TBBUTTON,
128 	op_TBTOGGLE,
129 	op_TBRBUTTON,
130 	op_TBBOXTOG,
131 	op_TBSPACE,
132 	op_TWOBOX,
133 
134 	op_MENUBAR,
135 	op_SMARTMENU,
136 	op_SUBMENU,
137 	op_ESUBMENU,
138 	op_SSUBMENU,
139 
140 	op_MENU_0,
141 	op_MENUITEM = op_MENU_0,
142 	op_MENUCHECK,
143 	op_MENURITEM,
144 
145 	op_MENU_LAST,
146 	op_MENUTEAR = op_MENU_LAST,
147 	op_MENUSEP,
148 
149 	op_MOUNT,
150 	op_REMOUNT,
151 	op_HEIGHTBAR,
152 	op_uCHECK,
153 	op_uCHECKb,
154 	op_uSPIN,
155 	op_uFSPIN,
156 	op_uSPINa,
157 	op_uSCALE,
158 	op_uOPT,
159 	op_uOPTD,
160 	op_uRPACK,
161 	op_uRPACKD,
162 	op_uENTRY,
163 	op_uPATHSTR,
164 	op_uCOLOR,
165 	op_uLISTCC,
166 	op_uLISTC,
167 	op_uOKBTN,
168 	op_uBUTTON,
169 	op_uMENUBAR,
170 
171 	op_uMENU_0,
172 	op_uMENUITEM = op_uMENU_0,
173 	op_uMENUCHECK,
174 	op_uMENURITEM,
175 
176 	op_uMENU_LAST,
177 	op_uMOUNT = op_uMENU_LAST,
178 
179 	op_CLIPBOARD,
180 
181 	op_XBMCURSOR,
182 	op_SYSCURSOR,
183 
184 	op_CTL_0, // control tags - same for all modes
185 	op_WLIST = op_CTL_0,
186 	op_COLUMNDATA,
187 
188 	op_COLUMN_0,
189 	op_IDXCOLUMN = op_COLUMN_0,
190 	op_TXTCOLUMN,
191 	op_XTXTCOLUMN,
192 	op_FILECOLUMN,
193 	op_CHKCOLUMN,
194 
195 	op_COLUMN_LAST,
196 
197 	op_EVT_0 = op_COLUMN_LAST,
198 	op_EVT_OK = op_EVT_0,
199 	op_EVT_CANCEL,
200 	op_EVT_CLICK,
201 	op_EVT_SELECT,
202 	op_EVT_CHANGE,
203 	op_EVT_DESTROY, // before deallocation
204 	op_EVT_SCRIPT, // by cmd_setstr()
205 	op_EVT_MULTI, // by same, with intlist data & ret
206 	op_EVT_KEY, // with key data & ret
207 	op_EVT_MOUSE, // with button data & ret
208 	op_EVT_MMOUSE, // movement, with same
209 	op_EVT_RMOUSE, // release, with same
210 	op_EVT_XMOUSE0,
211 	op_EVT_XMOUSE = op_EVT_XMOUSE0, // with button & pressure data & ret
212 	op_EVT_MXMOUSE, // movement, with same
213 	op_EVT_RXMOUSE, // release, with same
214 	op_EVT_CROSS, // enter/leave, with flag
215 	op_EVT_SCROLL, // with 2 directions
216 	op_EVT_EXT, // generic event with extra data
217 	op_EVT_DRAGFROM, // with drag data & ret
218 	op_EVT_DROP, // with drag data
219 	op_EVT_COPY, // with copy data
220 	op_EVT_PASTE, // with copy data & ret
221 
222 	op_EVT_LAST,
223 	op_TRIGGER = op_EVT_LAST,
224 
225 	op_EV_0, // dynamic tags - event values
226 	op_EV_MOUSE = op_EV_0,
227 	op_EV_DRAGFROM,
228 	op_EV_COPY,
229 
230 	op_EV_LAST,
231 
232 //	op_EXEC,
233 	op_GOTO,
234 	op_CALL,
235 	op_RET,
236 	op_IF,
237 	op_UNLESS,
238 	op_UNLESSbt,
239 	op_ENDIF,
240 	op_REF,
241 	op_CLEANUP,
242 	op_TALLOC,
243 	op_TCOPY,
244 	op_IDENT,
245 	op_uOPNAME,
246 	op_uALTNAME,
247 
248 	op_CTL_LAST,
249 
250 	op_CLIPFORM = op_CTL_LAST,
251 	op_DRAGDROP,
252 	op_ACTMAP,
253 	op_KEYMAP,
254 	op_SHORTCUT,
255 	op_WANTKEYS,
256 	op_MKSHRINK,
257 	op_NORESIZE,
258 	op_WANTMAX,
259 	op_KEEPSIZE,
260 	op_WXYWH,
261 	op_WPMOUSE,
262 	op_WPWHEREVER,
263 	op_HIDDEN,
264 	op_INSENS,
265 	op_FOCUS,
266 	op_WIDTH,
267 	op_HEIGHT,
268 	op_ONTOP,
269 	op_RAISED,
270 
271 	op_BOR_0,
272 	op_BOR_TABLE = op_BOR_0,
273 	op_BOR_NBOOK,
274 	op_BOR_SCROLL,
275 	op_BOR_SPIN,
276 	op_BOR_SPINSLIDE,
277 	op_BOR_LABEL,
278 	op_BOR_OPT,
279 	op_BOR_BUTTON,
280 	op_BOR_TOOLBAR,
281 	op_BOR_POPUP,
282 	op_BOR_TOPVBOX,
283 	op_BOR_CHECK,
284 	op_BOR_FRAME,
285 	op_BOR_RPACK,
286 	op_BOR_ENTRY,
287 	op_BOR_LISTCC,
288 	op_BOR_PATH,
289 
290 	op_BOR_LAST,
291 	op_LAST = op_BOR_LAST
292 };
293 
294 //	Function to run with EXEC
295 //typedef void **(*ext_fn)(void **r, GtkWidget ***wpp, void **wdata);
296 //	Function to run with MOUNT
297 typedef void **(*mnt_fn)(void **wdata);
298 
299 //	Structure which COLORLIST provides to EXT event
300 typedef struct {
301 	int idx;	// which row was clicked
302 	int button;	// which button was clicked (1-3 etc)
303 } colorlist_ext;
304 
305 //	Structure which is provided to KEY event
306 typedef struct {
307 	unsigned int key;	// keysym
308 	unsigned int lowkey;	// lowercase keysym
309 	unsigned int realkey;	// keycode
310 	unsigned int state;	// modifier flags
311 } key_ext;
312 
313 #define MAX_PRESSURE 0xFF00 /* Nicest fixedpoint scale */
314 
315 //	Structure which is provided to MOUSE/MMOUSE/RMOUSE event
316 typedef struct {
317 	int x, y;
318 	int button;	// what was pressed, stays pressed, or got released
319 	int count;	// 1/2/3 single/double/triple click, 0 move, -1 release
320 	unsigned int state;	// button & modifier flags
321 	int pressure;	// scaled to 0..MAX_PRESSURE
322 } mouse_ext;
323 
324 //	Structure which is provided to SCROLL event
325 typedef struct {
326 	int xscroll, yscroll;
327 	unsigned int state;
328 } scroll_ext;
329 
330 //	Structure which is supplied to CLIPFORM
331 typedef struct {
332 	char *target;	// MIME type
333 	void *id;	// anything
334 	int size;	// fixed, or 0 for variable
335 	int format;	// bit width: 8/16/32 (0 defaults to 8)
336 } clipform_dd;
337 
338 //	Structure which is provided to DRAGFROM and DROP event
339 typedef struct {
340 	int x, y;
341 	clipform_dd *format;
342 	void *data;
343 	int len;
344 } drag_ext;
345 
346 //	Structure which is provided to COPY and PASTE event
347 typedef struct {
348 	clipform_dd *format;
349 	void *data;
350 	int len;
351 } copy_ext;
352 
353 //	Structure which is provided by KEYMAP
354 typedef struct {
355 	char *name;
356 	int slot;
357 } key_dd;
358 
359 typedef struct {
360 	int nslots, nkeys, maxkeys;
361 	key_dd *keys;
362 	char **slotnames;
363 } keymap_dd;
364 
365 //	Structure which is provided to MULTI event
366 typedef struct {
367 	int nrows, ncols;
368 	int mincols; // Minimum tuple size
369 	int fractcol; // Which column is fixedpoint (-1 if all integer)
370 	int *rows[1]; // Pointers to rows (int arrays preceded by their length)
371 } multi_ext;
372 
373 //	Structure which is supplied to WINDOW_TEXTENG
374 typedef struct {
375 	char *text, *font;
376 	int angle, dpi, align, spacing;
377 	rgbcontext ctx;
378 } texteng_dd;
379 
380 //	Values of mouse count
381 enum {
382 	MCOUNT_RELEASE	= -1,
383 	MCOUNT_MOVE	= 0,
384 	MCOUNT_CLICK	= 1,
385 	MCOUNT_2CLICK	= 2,
386 	MCOUNT_3CLICK	= 3,
387 	/* Used to denote other events */
388 	MCOUNT_ENTER	= 10,
389 	MCOUNT_LEAVE,
390 	MCOUNT_NOTHING
391 };
392 
393 #define _0mask (0)
394 #define _Cmask (GDK_CONTROL_MASK)
395 #define _Smask (GDK_SHIFT_MASK)
396 #define _Amask (GDK_MOD1_MASK)
397 #define _CSmask (GDK_CONTROL_MASK | GDK_SHIFT_MASK)
398 #define _CAmask (GDK_CONTROL_MASK | GDK_MOD1_MASK)
399 #define _SAmask (GDK_SHIFT_MASK | GDK_MOD1_MASK)
400 #define _CSAmask (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK)
401 #define _B1mask (GDK_BUTTON1_MASK)
402 #define _B2mask (GDK_BUTTON2_MASK)
403 #define _B3mask (GDK_BUTTON3_MASK)
404 #define _B13mask (GDK_BUTTON1_MASK | GDK_BUTTON3_MASK)
405 
406 //	Functions to run with EVENT
407 typedef void (*evt_fn)(void *ddata, void **wdata, int what, void **where);
408 typedef void (*evtx_fn)(void *ddata, void **wdata, int what, void **where,
409 	void *xdata);
410 typedef int (*evtxr_fn)(void *ddata, void **wdata, int what, void **where,
411 	void *xdata);
412 
413 //	Textengine flags
414 int texteng_aa;  /* Antialias */
415 int texteng_rot; /* Rotate */
416 int texteng_spc; /* Set spacing */
417 int texteng_dpi; /* Set DPI */
418 int texteng_lf;  /* Handle newlines */
419 int texteng_con; /* Work in console mode */
420 
421 //	Build a dialog window out of V-code decription
422 //void **run_create(const void **ifcode, const void *ddata, int ddsize);
423 void **run_create_(void **ifcode, void *ddata, int ddsize, char **script);
424 #define run_create(A,B,C) run_create_(A, B, C, NULL)
425 //	Query dialog contents using its widget-map
426 void run_query(void **wdata);
427 //	Destroy a dialog by its widget-map
428 void run_destroy(void **wdata);
429 
430 #define VSLOT_SIZE 3
431 
432 //	Extract data structure out of widget-map
433 #define GET_DDATA(V) ((V)[0])
434 //	Extract toplevel window slot out of widget-map
435 #define GET_WINDOW(V) ((V) + VSLOT_SIZE)
436 //	Extract actual toplevel window out of widget-map
437 #define GET_REAL_WINDOW(V) ((V)[VSLOT_SIZE + 0])
438 //	Iterate over slots
439 #define NEXT_SLOT(V) ((V) + VSLOT_SIZE)
440 #define PREV_SLOT(V) ((V) - VSLOT_SIZE)
441 #define SLOT_N(V,N) ((V) + (N) * VSLOT_SIZE)
442 //	Extract ID out of toolbar item
443 #define TOOL_ID(V) (int)(((void **)(V)[1])[2])
444 #define TOOL_IR(V) (int)(((void **)(V)[1])[5])
445 //	Combine action and mode
446 #define ACTMOD(A,M) (((A) << 16) | (((M) + 0x8000) & 0xFFFF))
447 
448 //	From widget to its wdata
449 void **get_wdata(GtkWidget *widget, char *id);
450 
451 //	Run event handler, defaulting to run_destroy()
452 void do_evt_1_d(void **slot);
453 
454 //	Search modes
455 #define MLEVEL_FLAT  (-1) /* All */
456 #define MLEVEL_GROUP (-2) /* Groups */
457 #define MLEVEL_BLOCK (-3) /* In group */
458 
459 //	Find slot by text name and menu level
460 void **find_slot(void **slot, char *id, int l, int mlevel);
461 
462 //	From slot to its wdata
463 void **wdata_slot(void **slot);
464 //	From event to its originator
465 void **origin_slot(void **slot);
466 
467 //	From slot to its storage location (its own, *not* originator's)
468 void *slot_data(void **slot, void *ddata);
469 
470 //	Raise event on slot
471 void cmd_event(void **slot, int op);
472 
473 //	Set sensitive state on slot
474 void cmd_sensitive(void **slot, int state);
475 //	Set visible state on slot
476 void cmd_showhide(void **slot, int state);
477 //	Set value on slot
478 void cmd_set(void **slot, int v);
479 //	Set text-encoded value on slot (-1 fail, 0 unused, 1 set)
480 int cmd_setstr(void **slot, char *s);
481 //	Read back slot value (as is), return its storage location
482 void *cmd_read(void **slot, void *ddata);
483 //	Read extra data from slot
484 void cmd_peekv(void **slot, void *res, int size, int idx);
485 //	Set extra data on slot
486 void cmd_setv(void **slot, void *res, int idx);
487 //	Repaint slot
488 void cmd_repaint(void **slot);
489 //	Reset slot (or a group)
490 void cmd_reset(void **slot, void *ddata);
491 //	Set cursor for slot window
492 void cmd_cursor(void **slot, void **cursor);
493 //	Check extra state on slot
494 int cmd_checkv(void **slot, int idx);
495 //	Run script on slot
496 int cmd_run_script(void **slot, char **strs);
497 
498 ///	Handler for dialog buttons
499 void dialog_event(void *ddata, void **wdata, int what, void **where);
500 
501 enum {
502 	pk_NONE = 0,
503 	pk_PACK,
504 	pk_XPACK,
505 	pk_DEF = pk_XPACK,
506 	pk_EPACK,
507 	pk_PACKEND,
508 	pk_TABLE1x,
509 	pk_TABLE,
510 	pk_TABLEx,
511 
512 	pk_LAST
513 };
514 
515 enum {
516 	col_DIRECT = 0,
517 	col_PTR,
518 	col_REL
519 };
520 #define COL_LSHIFT 24
521 
522 #define WB_OPBITS      12
523 #define WB_OPMASK  0x0FFF /* ((1 << WB_OPBITS) - 1) */
524 #define WB_PKBITS       4
525 #define WB_PKMASK     0xF /* ((1 << WB_PKBITS) - 1) */
526 #define WB_GETPK(X) (((X) >> WB_OPBITS) & WB_PKMASK)
527 
528 #define WB_SFLAG  0x100000 /* Scriptable */
529 #define WB_FFLAG  0x080000
530 #define WB_NFLAG  0x040000
531 #define WB_REF1   0x010000
532 #define WB_REF2   0x020000
533 #define WB_REF3   0x030000
534 #define WB_GETREF(X) (((X) >> (WB_OPBITS + WB_PKBITS)) & 3)
535 #define WB_LSHIFT     24
536 #define WB_GETLEN(X) ((X) >> WB_LSHIFT)
537 
538 #define WBlen(L) ((L) << WB_LSHIFT)
539 #define WBpk(P) ((P) << WB_OPBITS)
540 #define WB_0	0
541 #define WB_F	WB_FFLAG
542 #define WB_S	WB_SFLAG
543 #define WB_R	WB_REF1
544 #define WB_RF	(WB_REF1 + WB_FFLAG)
545 #define WB_RS	(WB_REF1 + WB_SFLAG)
546 #define WB_R2	WB_REF2
547 #define WB_R2F	(WB_REF2 + WB_FFLAG)
548 #define WB_R2S	(WB_REF2 + WB_SFLAG)
549 #define WB_R3	WB_REF3
550 #define WB_R3F	(WB_REF3 + WB_FFLAG)
551 #define WB_N	WB_NFLAG
552 #define WB_NF	(WB_NFLAG + WB_FFLAG)
553 #define WB_RNF	(WB_REF1 + WB_NFLAG + WB_FFLAG)
554 #define WB_R2NF	(WB_REF2 + WB_NFLAG + WB_FFLAG)
555 #define WBp_(OP,L,P,F) (void *)(OP + WBlen(L) + WBpk(pk_##P) + WB_##F)
556 
557 #define WBh(NM,L) WBp_(op_##NM, L, NONE, 0)
558 #define WBh_(NM,L) WBp_(op_##NM, L, PACK, 0)
559 #define WBh_x(NM,L) WBp_(op_##NM, L, XPACK, 0)
560 #define WBh_e(NM,L) WBp_(op_##NM, L, PACKEND, 0)
561 #define WBh_t(NM,L) WBp_(op_##NM, L, TABLE, 0)
562 #define WBh_tx(NM,L) WBp_(op_##NM, L, TABLEx, 0)
563 #define WBh_t1(NM,L) WBp_(op_##NM, L, TABLE1x, 0)
564 #define WBhf(NM,L) WBp_(op_##NM, L, NONE, F)
565 #define WBhf_(NM,L) WBp_(op_##NM, L, PACK, F)
566 #define WBhf_t(NM,L) WBp_(op_##NM, L, TABLE, F)
567 #define WBhs(NM,L) WBp_(op_##NM, L, NONE, S)
568 #define WBrh(NM,L) WBp_(op_##NM, L, NONE, R)
569 #define WBrh_(NM,L) WBp_(op_##NM, L, PACK, R)
570 #define WBrh_x(NM,L) WBp_(op_##NM, L, XPACK, R)
571 #define WBrh_c(NM,L) WBp_(op_##NM, L, EPACK, R)
572 #define WBrh_e(NM,L) WBp_(op_##NM, L, PACKEND, R)
573 #define WBrh_t(NM,L) WBp_(op_##NM, L, TABLE, R)
574 #define WBrh_tx(NM,L) WBp_(op_##NM, L, TABLEx, R)
575 #define WBrh_t1(NM,L) WBp_(op_##NM, L, TABLE1x, R)
576 #define WBrhf(NM,L) WBp_(op_##NM, L, NONE, RF)
577 #define WBrhf_(NM,L) WBp_(op_##NM, L, PACK, RF)
578 #define WBrhf_x(NM,L) WBp_(op_##NM, L, XPACK, RF)
579 #define WBrhf_t(NM,L) WBp_(op_##NM, L, TABLE, RF)
580 #define WBrhf_tx(NM,L) WBp_(op_##NM, L, TABLEx, RF)
581 #define WBrhf_t1(NM,L) WBp_(op_##NM, L, TABLE1x, RF)
582 #define WBrhs(NM,L) WBp_(op_##NM, L, NONE, RS)
583 #define WBrhs_(NM,L) WBp_(op_##NM, L, PACK, RS)
584 #define WBr2h(NM,L) WBp_(op_##NM, L, NONE, R2)
585 #define WBr2h_(NM,L) WBp_(op_##NM, L, PACK, R2)
586 #define WBr2h_x(NM,L) WBp_(op_##NM, L, XPACK, R2)
587 #define WBr2h_e(NM,L) WBp_(op_##NM, L, PACKEND, R2)
588 #define WBr2h_t(NM,L) WBp_(op_##NM, L, TABLE, R2)
589 #define WBr2hf_(NM,L) WBp_(op_##NM, L, PACK, R2F)
590 #define WBr2hf_x(NM,L) WBp_(op_##NM, L, XPACK, R2F)
591 #define WBr2hf_t(NM,L) WBp_(op_##NM, L, TABLE, R2F)
592 #define WBr2hf_t1(NM,L) WBp_(op_##NM, L, TABLE1x, R2F)
593 #define WBr2hs_(NM,L) WBp_(op_##NM, L, PACK, R2S)
594 #define WBr2hs_x(NM,L) WBp_(op_##NM, L, XPACK, R2S)
595 #define WBr2hs_e(NM,L) WBp_(op_##NM, L, PACKEND, R2S)
596 #define WBr2hs_t(NM,L) WBp_(op_##NM, L, TABLE, R2S)
597 #define WBr3h_(NM,L) WBp_(op_##NM, L, PACK, R3)
598 #define WBr3h_e(NM,L) WBp_(op_##NM, L, PACKEND, R3)
599 #define WBr3hf(NM,L) WBp_(op_##NM, L, NONE, R3F)
600 #define WBr3hf_(NM,L) WBp_(op_##NM, L, PACK, R3F)
601 #define WBhn(NM,L) WBp_(op_##NM, L, NONE, N)
602 #define WBhnf(NM,L) WBp_(op_##NM, L, NONE, NF)
603 #define WBhnf_(NM,L) WBp_(op_##NM, L, PACK, NF)
604 #define WBhnf_x(NM,L) WBp_(op_##NM, L, XPACK, NF)
605 #define WBhnf_t(NM,L) WBp_(op_##NM, L, TABLE, NF)
606 #define WBrhnf(NM,L) WBp_(op_##NM, L, NONE, RNF)
607 #define WBrhnf_(NM,L) WBp_(op_##NM, L, PACK, RNF)
608 #define WBrhnf_t(NM,L) WBp_(op_##NM, L, TABLE, RNF)
609 #define WBr2hnf_x(NM,L) WBp_(op_##NM, L, XPACK, R2NF)
610 
611 #define WBfield(V) (void *)offsetof(WBbase, V)
612 #define WBwh(W,H) (void *)((H) + ((W) << 16))
613 #define WBxyl(X,Y,L) (void *)((Y) + ((X) << 8) + ((L - 1) << 16))
614 #define WBnh(N,H) (void *)(((H) & 255) + ((N) << 8))
615 #define WBbs(B,S) (void *)(((S) & 255) + ((B) << 8))
616 #define WBpbs(P,B,S) (void *)(((S) & 255) + ((B) << 8) + ((P) << 16))
617 #define WBppa(PX,PY,AX) (void *)((PY) + ((PX) << 8) + (AX << 16))
618 
619 #define WBsizeof(V) sizeof(((WBbase *)NULL)->V)
620 
621 #define WEND WBh(WEND, 0)
622 #define WSHOW WBh(WSHOW, 0)
623 #define WDIALOG(V) WBhf(WDIALOG, 1), WBfield(V)
624 #define WDONE WBh(WDONE, 0)
625 #define MAINWINDOW(NM,ICN,W,H) WBrh(MAINWINDOW, 3), (NM), (ICN), WBwh(W, H)
626 #define WINDOW(NM) WBrh(WINDOW, 1), (NM)
627 #define WINDOWp(NP) WBrhnf(WINDOW, 1), WBfield(NP)
628 #define WINDOWm(NM) WBrh(WINDOWm, 1), (NM)
629 #define WINDOWpm(NP) WBrhnf(WINDOWm, 1), WBfield(NP)
630 #define DIALOGpm(NP) WBrhnf(DIALOGm, 1), WBfield(NP)
631 /* !!! Note: string "V" is in system encoding */
632 /* !!! This block holds 2 nested EVENT blocks */
633 #define FPICKpm(NP,F,V,HOK,HC) WBr3hf(FPICKpm, 3 + 2 * 2), WBfield(V), \
634 	WBfield(NP), WBfield(F), EVENT(OK, HOK), EVENT(CANCEL, HC)
635 #define POPUP(NM) WBrh(POPUP, 1), (NM)
636 #define TOPVBOX WBrh(TOPVBOX, 0)
637 #define TOPVBOXV WBrh(TOPVBOXV, 0)
638 #define DOCK(K) WBrh_(DOCK, 1), (K)
639 #define HVSPLIT WBrh_x(HVSPLIT, 0)
640 #define VSPLIT WBrh_x(HVSPLIT, 1), (void *)2
641 #define PAGE(NM) WBh(PAGE, 1), (NM)
642 #define PAGEvp(NP) WBhn(PAGE, 1), &(NP)
643 #define PAGEi(ICN,S) WBh(PAGEi, 2), (ICN), (void *)(S)
644 #define PAGEir(ICN,S) WBrh(PAGEi, 2), (ICN), (void *)(S)
645 #define TABLE(W,H) WBh_(TABLE, 1), WBwh(W, H)
646 #define TABLE2(H) TABLE(2, (H))
647 #define TABLEs(W,H,S) WBh_(TABLE, 2), WBwh(W, H), (void *)(S)
648 #define TABLEr(W,H) WBrh_(TABLE, 1), WBwh(W, H)
649 #define XTABLE(W,H) WBh_x(TABLE, 1), WBwh(W, H)
650 #define ETABLE(W,H) WBh_e(TABLE, 1), WBwh(W, H)
651 #define FTABLE(NM,W,H) FRAME(NM), TABLE(W, H)
652 #define VBOX WBh_(VBOX, 0)
653 #define VBOXr WBrh_(VBOX, 0)
654 #define VBOXbp(S,B,P) WBh_(VBOX, 1), WBpbs(P, B, S)
655 #define VBOXP VBOXbp(0, 0, 5)
656 #define VBOXB VBOXbp(0, 5, 0)
657 #define VBOXS VBOXbp(5, 0, 0)
658 #define VBOXPS VBOXbp(5, 0, 5)
659 #define VBOXBS VBOXbp(5, 5, 0)
660 #define VBOXPBS VBOXbp(5, 5, 5)
661 #define XVBOX WBh_x(VBOX, 0)
662 #define XVBOXbp(S,B,P) WBh_x(VBOX, 1), WBpbs(P, B, S)
663 #define XVBOXP XVBOXbp(0, 0, 5)
664 #define XVBOXB XVBOXbp(0, 5, 0)
665 #define XVBOXBS XVBOXbp(5, 5, 0)
666 #define EVBOX WBh_e(VBOX, 0)
667 #define HBOX WBh_(HBOX, 0)
668 #define HBOXbp(S,B,P) WBh_(HBOX, 1), WBpbs(P, B, S)
669 #define HBOXP HBOXbp(0, 0, 5)
670 #define HBOXPr WBrh_(HBOX, 1), WBpbs(5, 0, 0)
671 #define HBOXB HBOXbp(0, 5, 0)
672 #define XHBOX WBh_x(HBOX, 0)
673 #define XHBOXbp(S,B,P) WBh_x(HBOX, 1), WBpbs(P, B, S)
674 #define XHBOXP XHBOXbp(0, 0, 5)
675 #define XHBOXS XHBOXbp(5, 0, 0)
676 #define XHBOXBS XHBOXbp(5, 5, 0)
677 #define TLHBOXl(X,Y,L) WBh_t(HBOX, 1), WBxyl(X, Y, L)
678 #define TLHBOXpl(P,X,Y,L) WBh_t(HBOX, 2), WBpbs(P, 0, 0), WBxyl(X, Y, L)
679 #define FVBOX(NM) FRAME(NM), VBOX
680 #define FVBOXB(NM) FRAME(NM), VBOXB
681 #define FVBOXBS(NM) FRAME(NM), VBOXBS
682 #define FXVBOX(NM) XFRAME(NM), VBOX
683 #define FXVBOXB(NM) XFRAME(NM), VBOXB
684 #define EFVBOX EFRAME, VBOXbp(0, 10, 0)
685 #define FHBOXB(NM) FRAME(NM), HBOXB
686 #define EQBOX WBh_(EQBOX, 0)
687 #define EQBOXbp(S,B,P) WBh_(EQBOX, 1), WBpbs(P, B, S)
688 #define EQBOXP EQBOXbp(0, 0, 5)
689 #define EQBOXB EQBOXbp(0, 5, 0)
690 #define EQBOXS EQBOXbp(5, 0, 0)
691 #define EEQBOX WBh_e(EQBOX, 0)
692 #define FRAME(NM) WBh_(FRAME, 1), (NM)
693 #define XFRAME(NM) WBh_x(FRAME, 1), (NM)
694 #define XFRAMEp(V) WBhnf_x(FRAME, 1), WBfield(V)
695 #define EFRAME WBh_(EFRAME, 0)
696 #define SCROLL(HP,VP) WBh_(SCROLL, 1), WBnh(VP, HP)
697 #define XSCROLL(HP,VP) WBh_x(SCROLL, 1), WBnh(VP, HP)
698 #define FSCROLL(HP,VP) XFRAME(NULL), SCROLL(HP, VP)
699 #define CSCROLLv(A) WBrh_x(CSCROLL, 1), (A)
700 #define NBOOK WBh_x(NBOOK, 0)
701 #define NBOOKr WBrh_x(NBOOK, 0)
702 #define NBOOKl WBh_x(NBOOKl, 0)
703 #define PLAINBOOK WBrh_(PLAINBOOK, 0)
704 #define PLAINBOOKn(N) WBrh_(PLAINBOOK, 1), (void *)(N)
705 #define BOOKBTN(NM,V) WBhf_(BOOKBTN, 2), WBfield(V), (NM)
706 #define STATUSBAR WBrh_e(STATUSBAR, 0)
707 #define STLABEL(W,A) WBrh_(STLABEL, 1), (void *)((W) + ((A) << 16))
708 #define STLABELe(W,A) WBrh_e(STLABEL, 1), (void *)((W) + ((A) << 16))
709 #define HSEP WBh_(HSEP, 0)
710 #define HSEPl(V) WBh_(HSEP, 1), (void *)(V)
711 #define HSEPt WBh_(HSEP, 1), (void *)(-1)
712 #define MLABEL(NM) WBh_(LABEL, 1), (NM)
713 #define MLABELr(NM) WBrh_(LABEL, 1), (NM)
714 #define MLABELc(NM) WBh_(LABEL, 2), (NM), WBppa(0, 0, 5)
715 #define MLABELxr(NM,PX,PY,AX) WBrh_(LABEL, 2), (NM), WBppa(PX, PY, AX)
716 #define MLABELcp(V) WBhnf_(LABEL, 2), WBfield(V), WBppa(0, 0, 5)
717 #define MLABELpx(V,PX,PY,AX) WBhnf_(LABEL, 2), WBfield(V), WBppa(PX, PY, AX)
718 #define WLABELp(V) WBhnf_x(WLABEL, 2), WBfield(V), WBppa(0, 0, 5)
719 #define XLABELcr(NM) WBrh_x(LABEL, 2), (NM), WBppa(0, 0, 5)
720 #define TLABEL(NM) WBh_t1(LABEL, 1), (NM)
721 #define TLABELr(NM) WBrh_t1(LABEL, 1), (NM)
722 #define TLABELx(NM,PX,PY,AX) WBh_t1(LABEL, 2), (NM), WBppa(PX, PY, AX)
723 #define TLLABELl(NM,X,Y,L) WBh_t(LABEL, 2), (NM), WBxyl(X, Y, L)
724 #define TLLABEL(NM,X,Y) TLLABELl(NM, X, Y, 1)
725 #define TLLABELx(NM,X,Y,PX,PY,AX) WBh_t(LABEL, 3), (NM), \
726 	WBppa(PX, PY, AX), WBxyl(X, Y, 1)
727 #define TLLABELxr(NM,X,Y,PX,PY,AX) WBrh_t(LABEL, 3), (NM), \
728 	WBppa(PX, PY, AX), WBxyl(X, Y, 1)
729 #define TLLABELp(V,X,Y) WBhnf_t(LABEL, 2), WBfield(V), WBxyl(X, Y, 1)
730 #define TLLABELpx(V,X,Y,PX,PY,AX) WBhnf_t(LABEL, 3), WBfield(V), \
731 	WBppa(PX, PY, AX), WBxyl(X, Y, 1)
732 #define TXLABEL(NM,X,Y) WBh_tx(LABEL, 3), (NM), WBppa(0, 0, 3), WBxyl(X, Y, 1)
733 #define HLABELp(V) WBhnf_(HLABEL, 1), WBfield(V)
734 #define HLABELmp(V) WBhnf_(HLABELm, 1), WBfield(V)
735 #define TLTEXT(S,X,Y) WBh_t(TLTEXT, 2), (S), WBxyl(X, Y, 1)
736 #define TLTEXTf(C,X,Y) WBhf_t(TLTEXT, 2), WBfield(C), WBxyl(X, Y, 1)
737 #define TLTEXTp(V,X,Y) WBhnf_t(TLTEXT, 2), WBfield(V), WBxyl(X, Y, 1)
738 #define PROGRESSp(V) WBrhnf_(PROGRESS, 1), WBfield(V)
739 #define COLORPATCHv(CP,W,H) WBrh_x(COLORPATCH, 2), (CP), WBwh(W, H)
740 #define RGBIMAGE(CP,A) WBrhnf_(RGBIMAGE, 2), WBfield(CP), WBfield(A)
741 #define TLRGBIMAGE(CP,A,X,Y) WBrhnf_t(RGBIMAGE, 3), WBfield(CP), WBfield(A), \
742 	WBxyl(X, Y, 1)
743 #define RGBIMAGEP(CC,W,H) WBrhf_(RGBIMAGEP, 2), WBfield(CC), WBwh(W, H)
744 #define CANVASIMGv(CC,W,H) WBrh_(CANVASIMG, 2), (CC), WBwh(W, H)
745 #define CCANVASIMGv(CC,W,H) WBrh_c(CANVASIMG, 2), (CC), WBwh(W, H)
746 #define CANVASIMGB(CP,A) WBrhnf_(CANVASIMGB, 2), WBfield(CP), WBfield(A)
747 #define FCIMAGEP(CP,A,AS) WBrhnf_(FCIMAGEP, 3), WBfield(CP), WBfield(A), \
748 	WBfield(AS)
749 #define TLFCIMAGEP(CP,A,AS,X,Y) WBrhnf_t(FCIMAGEP, 4), WBfield(CP), \
750 	WBfield(A), WBfield(AS), WBxyl(X, Y, 1)
751 #define TLFCIMAGEPn(CP,AS,X,Y) WBrhnf_t(FCIMAGEP, 4), WBfield(CP), \
752 	(void *)(-1), WBfield(AS), WBxyl(X, Y, 1)
753 #define CANVAS(W,H,C,HX) WBr2h_(CANVAS, 2 + 2), WBwh(W, H), (void *)(C), \
754 	EVENT(EXT, HX)
755 #define TLNOSPIN(V,X,Y) WBhf_t(NOSPIN, 2), WBfield(V), WBxyl(X, Y, 1)
756 #define TLNOSPINr(V,X,Y) WBrhf_t(NOSPIN, 2), WBfield(V), WBxyl(X, Y, 1)
757 #define NOSPINv(V) WBh_(NOSPIN, 1), &(V)
758 #define TLSPIN(V,V0,V1,X,Y) WBrhf_t(SPIN, 4), WBfield(V), \
759 	(void *)(V0), (void *)(V1), WBxyl(X, Y, 1)
760 #define TLXSPIN(V,V0,V1,X,Y) WBrhf_tx(SPIN, 4), WBfield(V), \
761 	(void *)(V0), (void *)(V1), WBxyl(X, Y, 1)
762 #define TLXSPINv(V,V0,V1,X,Y) WBrh_tx(SPIN, 4), &(V), \
763 	(void *)(V0), (void *)(V1), WBxyl(X, Y, 1)
764 #define T1SPIN(V,V0,V1) WBrhf_t1(SPIN, 3), WBfield(V), \
765 	(void *)(V0), (void *)(V1)
766 #define TSPIN(NM,V,V0,V1) T1SPIN(V,V0,V1), TLABEL(NM)
767 #define TSPINv(NM,V,V0,V1) WBrh_t1(SPIN, 3), &(V), \
768 	(void *)(V0), (void *)(V1), TLABEL(NM)
769 #define TSPINa(NM,A) WBrhf_t1(SPINa, 1), WBfield(A), TLABEL(NM)
770 #define SPIN(V,V0,V1) WBrhf_(SPIN, 3), WBfield(V), \
771 	(void *)(V0), (void *)(V1)
772 #define SPINv(V,V0,V1) WBrh_(SPIN, 3), &(V), \
773 	(void *)(V0), (void *)(V1)
774 #define SPINc(V,V0,V1) WBrhf_(SPINc, 3), WBfield(V), \
775 	(void *)(V0), (void *)(V1)
776 #define XSPIN(V,V0,V1) WBrhf_x(SPIN, 3), WBfield(V), \
777 	(void *)(V0), (void *)(V1)
778 #define FSPIN(V,V0,V1) WBrhf_(FSPIN, 3), WBfield(V), \
779 	(void *)(V0), (void *)(V1)
780 #define FSPINv(V,V0,V1) WBrh_(FSPIN, 3), &(V), \
781 	(void *)(V0), (void *)(V1)
782 #define TFSPIN(NM,V,V0,V1) WBrhf_t1(FSPIN, 3), WBfield(V), \
783 	(void *)(V0), (void *)(V1), TLABEL(NM)
784 #define TLFSPIN(V,V0,V1,X,Y) WBrhf_t(FSPIN, 4), WBfield(V), \
785 	(void *)(V0), (void *)(V1), WBxyl(X, Y, 1)
786 #define SPINa(A) WBrhf_(SPINa, 1), WBfield(A)
787 #define XSPINa(A) WBrhf_x(SPINa, 1), WBfield(A)
788 #define uSPIN(V,V0,V1) WBrhf_(uSPIN, 3), WBfield(V), (void *)(V0), (void *)(V1)
789 #define uSPINv(V,V0,V1) WBrh_(uSPIN, 3), &(V), (void *)(V0), (void *)(V1)
790 #define uFSPINv(V,V0,V1) WBrh_(uFSPIN, 3), &(V), (void *)(V0), (void *)(V1)
791 #define uSPINa(A) WBrhf_(uSPINa, 1), WBfield(A)
792 #define uSCALE(V,V0,V1) WBrhf_(uSCALE, 3), WBfield(V), \
793 	(void *)(V0), (void *)(V1)
794 /* !!! This block holds 1 nested EVENT block */
795 #define TLSPINPACKv(A,N,HC,W,X,Y) WBr2h_t(TLSPINPACK, 3 + 2), (A), (void *)(N), \
796 	EVENT(CHANGE, HC), WBxyl(X, Y, W)
797 #define T1SPINSLIDE(V,V0,V1) WBrhf_t1(SPINSLIDE, 4), WBfield(V), \
798 	(void *)(V0), (void *)(V1), WBwh(255, 20)
799 #define TSPINSLIDE(NM,V,V0,V1) T1SPINSLIDE(V,V0,V1), TLABEL(NM)
800 #define TSPINSLIDEa(NM,A) WBrhf_t1(SPINSLIDEa, 1), WBfield(A), TLABEL(NM)
801 #define TLSPINSLIDE(V,V0,V1,X,Y) WBrhf_t(SPINSLIDE, 4), WBfield(V), \
802 	(void *)(V0), (void *)(V1), WBxyl(X, Y, 1)
803 #define TLSPINSLIDEvs(V,V0,V1,X,Y) WBrh_t(SPINSLIDE, 5), &(V), \
804 	(void *)(V0), (void *)(V1), WBwh(150, 0), WBxyl(X, Y, 1)
805 #define TLSPINSLIDExl(V,V0,V1,X,Y,L) WBrhf_tx(SPINSLIDE, 4), WBfield(V), \
806 	(void *)(V0), (void *)(V1), WBxyl(X, Y, L)
807 #define TLSPINSLIDEx(V,V0,V1,X,Y) TLSPINSLIDExl(V, V0, V1, X, Y, 1)
808 #define SPINSLIDEa(A) WBrhf_(SPINSLIDEa, 1), WBfield(A)
809 #define XSPINSLIDEa(A) WBrhf_x(SPINSLIDEa, 1), WBfield(A)
810 #define CHECK(NM,V) WBrhf_(CHECK, 2), WBfield(V), (NM)
811 #define CHECKv(NM,V) WBrh_(CHECK, 2), &(V), (NM)
812 #define CHECKb(NM,V,I) WBrhf_(CHECKb, 3), WBfield(V), (NM), (I)
813 #define XCHECK(NM,V) WBrhf_x(CHECK, 2), WBfield(V), (NM)
814 #define TLCHECKl(NM,V,X,Y,L) WBrhf_t(CHECK, 3), WBfield(V), (NM), WBxyl(X, Y, L)
815 #define TLCHECK(NM,V,X,Y) TLCHECKl(NM, V, X, Y, 1)
816 #define TLCHECKvl(NM,V,X,Y,L) WBrh_t(CHECK, 3), &(V), (NM), WBxyl(X, Y, L)
817 #define TLCHECKv(NM,V,X,Y) TLCHECKvl(NM, V, X, Y, 1)
818 #define uCHECK(NM,V) WBrhf_(uCHECK, 2), WBfield(V), (NM)
819 #define uCHECKv(NM,V) WBrh_(uCHECK, 2), &(V), (NM)
820 /* !!! No more than 255 choices */
821 #define RPACK(SS,N,H,V) WBrhf_x(RPACK, 3), WBfield(V), (SS), WBnh(N, H)
822 #define RPACKv(SS,N,H,V) WBrh_x(RPACK, 3), &(V), (SS), WBnh(N, H)
823 #define FRPACK(NM,SS,N,H,V) FRAME(NM), RPACK(SS,N,H,V)
824 #define FRPACKv(NM,SS,N,H,V) FRAME(NM), RPACKv(SS,N,H,V)
825 #define RPACKD(SP,H,V) WBrhf_x(RPACKD, 3), WBfield(V), WBfield(SP), (H)
826 #define RPACKDv(SP,H,V) WBrh_x(RPACKD, 3), &(V), WBfield(SP), (H)
827 /* !!! These blocks each hold 1 nested EVENT block */
828 #define RPACKe(SS,N,H,V,HS) WBr2hf_x(RPACK, 3 + 2), WBfield(V), (SS), \
829 	WBnh(N, H), EVENT(SELECT, HS)
830 #define FRPACKe(NM,SS,N,H,V,HS) FRAME(NM), RPACKe(SS,N,H,V,HS)
831 #define RPACKDve(SP,H,V,HS) WBr2h_x(RPACKD, 3 + 2), &(V), WBfield(SP), \
832 	(H), EVENT(SELECT, HS)
833 #define OPT(SS,N,V) WBrhf_(OPT, 3), WBfield(V), (SS), (void *)(N)
834 #define OPTv(SS,N,V) WBrh_(OPT, 3), &(V), (SS), (void *)(N)
835 #define TOPTv(NM,SS,N,V) WBrh_t1(OPT, 3), &(V), (SS), (void *)(N), TLABEL(NM)
836 #define TLOPT(SS,N,V,X,Y) WBrhf_t(OPT, 4), WBfield(V), (SS), (void *)(N), \
837 	WBxyl(X, Y, 1)
838 #define TLOPTv(SS,N,V,X,Y) WBrh_t(OPT, 4), &(V), (SS), (void *)(N), \
839 	WBxyl(X, Y, 1)
840 #define OPTD(SP,V) WBrhf_(OPTD, 2), WBfield(V), WBfield(SP)
841 #define XOPTD(SP,V) WBrhf_x(OPTD, 2), WBfield(V), WBfield(SP)
842 #define TOPTDv(NM,SP,V) WBrh_t1(OPTD, 2), &(V), WBfield(SP), TLABEL(NM)
843 /* !!! These blocks each hold 1 nested EVENT block */
844 #define OPTve(SS,N,V,HS) WBr2h_(OPT, 3 + 2), &(V), (SS), (void *)(N), \
845 	EVENT(SELECT, HS)
846 #define OPTe(SS,N,V,HS) WBr2hf_(OPT, 3 + 2), WBfield(V), (SS), (void *)(N), \
847 	EVENT(SELECT, HS)
848 #define XOPTe(SS,N,V,HS) WBr2hf_x(OPT, 3 + 2), WBfield(V), (SS), (void *)(N), \
849 	EVENT(SELECT, HS)
850 #define TLOPTle(SS,N,V,HS,X,Y,L) WBr2hf_t(OPT, 4 + 2), WBfield(V), (SS), \
851 	(void *)(N), EVENT(SELECT, HS), WBxyl(X, Y, L)
852 #define TLOPTvle(SS,N,V,HS,X,Y,L) WBr2h_t(OPT, 4 + 2), &(V), (SS), \
853 	(void *)(N), EVENT(SELECT, HS), WBxyl(X, Y, L)
854 #define TLOPTve(SS,N,V,HS,X,Y) TLOPTvle(SS, N, V, HS, X, Y, 1)
855 #define OPTDe(SP,V,HS) WBr2hf_(OPTD, 2 + 2), WBfield(V), WBfield(SP), \
856 	EVENT(SELECT, HS)
857 #define XOPTDe(SP,V,HS) WBr2hf_x(OPTD, 2 + 2), WBfield(V), WBfield(SP), \
858 	EVENT(SELECT, HS)
859 #define TOPTDe(NM,SP,V,HS) WBr2hf_t1(OPTD, 2 + 2), WBfield(V), WBfield(SP), \
860 	EVENT(SELECT, HS), TLABEL(NM)
861 #define COMBO(SS,N,V) WBrhf_(COMBO, 3), WBfield(V), (SS), (void *)(N)
862 #define GRADBAR(M,V,L,MX,A,CC,HS) WBr2hf_(GRADBAR, 6 + 2), WBfield(V), \
863 	WBfield(M), WBfield(L), WBfield(A), WBfield(CC), (void *)(MX), \
864 	EVENT(SELECT, HS)
865 #define PCTCOMBOv(V,A,HC) WBr2h_(PCTCOMBO, 2 + 2), &(V), (A), EVENT(CHANGE, HC)
866 #define LISTCCHr(V,L,H,HS) WBr2hf_(LISTCCr, 3 + 2), WBfield(V), WBfield(L), \
867 	(void *)(H), EVENT(SELECT, HS)
868 #define LISTCCr(V,L,HS) LISTCCHr(V, L, 0, HS)
869 #define LISTC(V,L,HS) WBr2hf_(LISTC, 3 + 2), WBfield(V), WBfield(L), \
870 	NULL, EVENT(SELECT, HS)
871 #define LISTCd(V,L,HS) WBr2hf_(LISTCd, 3 + 2), WBfield(V), WBfield(L), \
872 	NULL, EVENT(SELECT, HS)
873 #define LISTCu(V,L,HS) WBr2hf_(LISTCu, 3 + 2), WBfield(V), WBfield(L), \
874 	NULL, EVENT(SELECT, HS)
875 #define LISTCS(V,L,SM,HS) WBr2hf_(LISTCS, 3 + 2), WBfield(V), WBfield(L), \
876 	WBfield(SM), EVENT(SELECT, HS)
877 #define LISTCX(V,L,SM,M,HS,HX) WBr3hf_(LISTCX, 4 + 2 * 2), WBfield(V), \
878 	WBfield(L), WBfield(SM), WBfield(M), EVENT(SELECT, HS), EVENT(EXT, HX)
879 #define XENTRY(V) WBrhf_x(ENTRY, 1), WBfield(V)
880 #define XLENTRY(V,MX) WBrhf_x(ENTRY, 2), WBfield(V), (void *)(MX)
881 #define MLENTRY(V) WBrhf_(MLENTRY, 1), WBfield(V)
882 #define TLENTRY(V,MX,X,Y,L) WBrhf_t(ENTRY, 3), WBfield(V), (void *)(MX), \
883 	WBxyl(X, Y, L)
884 #define XPENTRY(V,MX) WBrhf_x(PENTRY, 2), WBfield(V), (void *)(MX)
885 #define TPENTRYv(NM,V,MX) WBrh_t1(PENTRY, 2), (V), (void *)(MX), TLABEL(NM)
886 #define PATH(NM,T,M,V) FRAME(NM), WBrhf_(PATH, 3), WBfield(V), (T), (void *)(M)
887 #define PATHv(NM,T,M,V) FRAME(NM), WBrh_(PATH, 3), (V), (T), (void *)(M)
888 #define PATHs(NM,T,M,V) FRAME(NM), WBrh_(PATHs, 3), (V), (T), (void *)(M)
889 #define TPATHv(NM,T,M,V) WBrh_t1(PATH, 3), (V), (T), (void *)(M), TLABEL(NM)
890 #define uPATHSTR(V) WBrhf_(uPATHSTR, 1), WBfield(V)
891 #define TEXT(V) WBrhf_x(TEXT, 1), WBfield(V)
892 #define COMBOENTRY(V,SP,H) WBr2hf_x(COMBOENTRY, 2 + 2), WBfield(V), \
893 	WBfield(SP), EVENT(OK, H)
894 #define KEYBUTTON(V) WBrhf_(KEYBUTTON, 1), WBfield(V)
895 #define TABLETBTN(NM) WBrh_(TABLETBTN, 1), (NM)
896 #define FONTSEL(A) WBrhf_x(FONTSEL, 1), WBfield(A)
897 #define HEXENTRY(V,HC,X,Y) WBr2hf_t(HEXENTRY, 2 + 2), WBfield(V), \
898 	EVENT(CHANGE, HC), WBxyl(X, Y, 1)
899 #define EYEDROPPER(V,HC,X,Y) WBr2hf_t(EYEDROPPER, 2 + 2), WBfield(V), \
900 	EVENT(CHANGE, HC), WBxyl(X, Y, 1)
901 #define COLOR(V) WBrhf_(COLOR, 1), WBfield(V)
902 #define TCOLOR(A) WBrhf_(TCOLOR, 1), WBfield(A)
903 /* !!! These blocks each hold 2 nested EVENT blocks */
904 /* !!! SELECT must be last, for it gets triggered */
905 #define COLORLIST(SP,V,CC,HS,HX) WBr3hf_(COLORLIST, 3 + 2 * 2), WBfield(V), \
906 	WBfield(SP), WBfield(CC), EVENT(EXT, HX), EVENT(SELECT, HS)
907 #define COLORLISTN(N,V,CC,HS,HX) WBr3hf_(COLORLISTN, 3 + 2 * 2), WBfield(V), \
908 	WBfield(N), WBfield(CC), EVENT(EXT, HX), EVENT(SELECT, HS)
909 #define OKBOX(NOK,HOK,NC,HC) EQBOX, CANCELBTN(NC, HC), OKBTN(NOK, HOK)
910 #define OKBOXP(NOK,HOK,NC,HC) EQBOXP, CANCELBTN(NC, HC), OKBTN(NOK, HOK)
911 #define OKBOXB(NOK,HOK,NC,HC) EQBOXB, CANCELBTN(NC, HC), OKBTN(NOK, HOK)
912 #define OKBOX3(NOK,HOK,NC,HC,NB,HB) EQBOX, CANCELBTN(NC, HC), BUTTON(NB, HB), \
913 	OKBTN(NOK, HOK)
914 #define OKBOX3B(NOK,HOK,NC,HC,NB,HB) EQBOXB, CANCELBTN(NC, HC), BUTTON(NB, HB), \
915 	OKBTN(NOK, HOK)
916 // !!! These *BTN,*TOGGLE,*BUTTON blocks each hold 1 nested EVENT block */
917 #define OKBTN(NM,H) WBr2h_x(OKBTN, 1 + 2), (NM), EVENT(OK, H)
918 #define uOKBTN(H) WBr2h_(uOKBTN, 0 + 2), EVENT(OK, H)
919 #define CANCELBTN(NM,H) WBr2h_x(CANCELBTN, 1 + 2), (NM), EVENT(CANCEL, H)
920 #define CANCELBTNp(NP,H) WBr2hnf_x(CANCELBTN, 1 + 2), WBfield(NP), \
921 	EVENT(CANCEL, H)
922 #define UCANCELBTN(NM,H) WBr2h_(CANCELBTN, 1 + 2), (NM), EVENT(CANCEL, H)
923 #define ECANCELBTN(NM,H) WBr2h_e(CANCELBTN, 1 + 2), (NM), EVENT(CANCEL, H)
924 #define UDONEBTN(NM,H) WBr2h_(DONEBTN, 1 + 2), (NM), EVENT(OK, H)
925 #define TOGGLE(NM,V,H) WBr2hf_x(TOGGLE, 2 + 2), WBfield(V), (NM), \
926 	EVENT(CHANGE, H)
927 #define UTOGGLEv(NM,V,H) WBr2h_(TOGGLE, 2 + 2), &(V), (NM), EVENT(CHANGE, H)
928 #define BUTTON(NM,H) WBr2h_x(BUTTON, 1 + 2), (NM), EVENT(CLICK, H)
929 #define BUTTONs(NM,H) WBr2hs_x(BUTTON, 1 + 2), (NM), EVENT(CLICK, H)
930 #define BUTTONp(NP,H) WBr2hnf_x(BUTTON, 1 + 2), WBfield(NP), EVENT(CLICK, H)
931 #define UBUTTON(NM,H) WBr2h_(BUTTON, 1 + 2), (NM), EVENT(CLICK, H)
932 #define EBUTTON(NM,H) WBr2h_e(BUTTON, 1 + 2), (NM), EVENT(CLICK, H)
933 #define EBUTTONs(NM,H) WBr2hs_e(BUTTON, 1 + 2), (NM), EVENT(CLICK, H)
934 #define TLBUTTON(NM,H,X,Y) WBr2h_t(BUTTON, 2 + 2), (NM), EVENT(CLICK, H), \
935 	WBxyl(X, Y, 1)
936 #define TLBUTTONs(NM,H,X,Y) WBr2hs_t(BUTTON, 2 + 2), (NM), EVENT(CLICK, H), \
937 	WBxyl(X, Y, 1)
938 #define uBUTTONs(NM,H) WBr2hs_(uBUTTON, 1 + 2), (NM), EVENT(CLICK, H)
939 #define TOOLBAR(HC) WBr2h_(TOOLBAR, 0 + 2), EVENT(CHANGE, HC)
940 #define TOOLBARx(HC,HR) WBr3h_(TOOLBAR, 0 + 2 * 2), EVENT(CHANGE, HC), \
941 	EVENT(CLICK, HR)
942 #define SMARTTBAR(HC) WBr2h_(SMARTTBAR, 0 + 2), EVENT(CHANGE, HC)
943 #define SMARTTBARx(HC,HR) WBr3h_(SMARTTBAR, 0 + 2 * 2), EVENT(CHANGE, HC), \
944 	EVENT(CLICK, HR)
945 #define SMARTTBMORE(NM) WBh(SMARTTBMORE, 1), (NM)
946 #define TBBUTTON(NM,IC,ID) WBrh(TBBUTTON, 4), NULL, (void *)(ID), (NM), (IC)
947 #define TBBUTTONx(NM,IC,ID,IR) WBrh(TBBUTTON, 5), NULL, (void *)(ID), (NM), \
948 	(IC), (void *)(IR)
949 #define TBTOGGLE(NM,IC,ID,V) WBrhf(TBTOGGLE, 4), WBfield(V), (void *)(ID), \
950 	(NM), (IC)
951 #define TBTOGGLEv(NM,IC,ID,V) WBrh(TBTOGGLE, 4), &(V), (void *)(ID), (NM), (IC)
952 #define TBTOGGLExv(NM,IC,ID,IR,V) WBrh(TBTOGGLE, 5), &(V), (void *)(ID), (NM), \
953 	(IC), (void *)(IR)
954 #define TBBOXTOGxv(NM,IC,ID,IR,V) WBrh(TBBOXTOG, 5), &(V), (void *)(ID), (NM), \
955 	(IC), (void *)(IR)
956 #define TBRBUTTONv(NM,IC,ID,V) WBrh(TBRBUTTON, 4), &(V), (void *)(ID), (NM), (IC)
957 #define TBRBUTTONxv(NM,IC,ID,IR,V) WBrh(TBRBUTTON, 5), &(V), (void *)(ID), \
958 	(NM), (IC), (void *)(IR)
959 #define TBSPACE WBh(TBSPACE, 0)
960 #define TWOBOX WBh_(TWOBOX, 0)
961 #define MENUBAR(HC) WBr2h_(MENUBAR, 0 + 2), EVENT(CHANGE, HC)
962 #define SMARTMENU(HC) WBr2h_(SMARTMENU, 0 + 2), EVENT(CHANGE, HC)
963 #define SUBMENU(NM) WBrh_(SUBMENU, 1), (NM)
964 #define ESUBMENU(NM) WBrh_(ESUBMENU, 1), (NM)
965 #define SSUBMENU(NM) WBrh_(SSUBMENU, 1), (NM)
966 #define MENUITEM(NM,ID) WBrh_(MENUITEM, 3), NULL, (void *)(ID), (NM)
967 #define MENUITEMs(NM,ID) WBrhs_(MENUITEM, 3), NULL, (void *)(ID), (NM)
968 #define MENUITEMi(NM,ID,IC) WBrh_(MENUITEM, 4), NULL, (void *)(ID), (NM), (IC)
969 #define MENUITEMis(NM,ID,IC) WBrhs_(MENUITEM, 4), NULL, (void *)(ID), (NM), (IC)
970 #define MENUCHECKv(NM,ID,V) WBrh_(MENUCHECK, 3), &(V), (void *)(ID), (NM)
971 #define MENUCHECKvs(NM,ID,V) WBrhs_(MENUCHECK, 3), &(V), (void *)(ID), (NM)
972 #define MENURITEMv(NM,ID,V) WBrh_(MENURITEM, 3), &(V), (void *)(ID), (NM)
973 #define MENURITEMvs(NM,ID,V) WBrhs_(MENURITEM, 3), &(V), (void *)(ID), (NM)
974 #define MENUTEAR WBh_(MENUTEAR, 0)
975 #define MENUSEP WBh_(MENUSEP, 0)
976 #define MENUSEPr WBrh_(MENUSEP, 0)
977 #define uMENUBAR(HC) WBr2h_(uMENUBAR, 0 + 2), EVENT(CHANGE, HC)
978 #define uMENUITEM(NM,ID) WBrh_(uMENUITEM, 3), NULL, (void *)(ID), (NM)
979 #define uMENUITEMs(NM,ID) WBrhs_(uMENUITEM, 3), NULL, (void *)(ID), (NM)
980 #define MOUNT(V,FN,H) WBr2hf_(MOUNT, 2 + 2), WBfield(V), (FN), EVENT(CHANGE, H)
981 #define PMOUNT(V,FN,H,K,NK) WBr2hf_x(MOUNT, 4 + 2), WBfield(V), (FN), (K), \
982 	(void *)(NK), EVENT(CHANGE, H)
983 #define REMOUNTv(V) WBrh_x(REMOUNT, 1), &(V)
984 #define HEIGHTBAR WBh_e(HEIGHTBAR, 0)
985 //#define EXEC(FN) WBh(EXEC, 1), (FN)
986 #define GOTO(A) WBh(GOTO, 1), (A)
987 #define CALL(A) WBh(CALL, 1), (A)
988 #define CALLp(V) WBhnf(CALL, 1), WBfield(V)
989 #define RET WBh(RET, 0)
990 #define IF(X) WBhf(IF, 1), WBfield(X)
991 #define IFx(X,N) WBhf(IF, 2), WBfield(X), (void *)(N)
992 #define IFv(X) WBh(IF, 1), &(X)
993 #define IFvx(X,N) WBh(IF, 2), &(X), (void *)(N)
994 #define UNLESS(X) WBhf(UNLESS, 1), WBfield(X)
995 #define UNLESSx(X,N) WBhf(UNLESS, 2), WBfield(X), (void *)(N)
996 #define UNLESSv(X) WBh(UNLESS, 1), &(X)
997 #define UNLESSbt(V) WBh(UNLESSbt, 1), (V)
998 #define ENDIF(N) WBh(ENDIF, 1), (void *)(N)
999 #define REF(V) WBhf(REF, 1), WBfield(V)
1000 #define REFv(V) WBh(REF, 1), &(V)
1001 #define CLEANUP(V) WBrhf(CLEANUP, 1), WBfield(V)
1002 #define TALLOC(V,L) WBhf(TALLOC, 2), WBfield(V), WBfield(L)
1003 #define TCOPY(V,L) WBhf(TCOPY, 2), WBfield(V), WBfield(L)
1004 #define ACTMAP(N) WBh(ACTMAP, 1), (void *)(N)
1005 #define VISMASK(N) WBh(ACTMAP, 2), (void *)(N), NULL
1006 #define KEYMAP(V, NM) WBrhf(KEYMAP, 2), WBfield(V), (NM)
1007 #define SHORTCUTs(NM) WBh(SHORTCUT, 1), (NM)
1008 #define SHORTCUT(K,M) WBh(SHORTCUT, 2), (void *)KEY(K), (void *)(_##M##mask)
1009 #define SHORTCUT0 WBh(SHORTCUT, 0)
1010 #define GROUPR WBrh(uOP, 0)
1011 #define GROUP0 WBrhs(uOP, 0)
1012 #define GROUPN WBrhs(uOP, 1), NULL
1013 #define GROUP(NM) WBrhs(uOP, 1), (NM)
1014 #define IDENT(NM) WBh(IDENT, 1), (NM)
1015 #define BORDER(T,V) WBh(BOR_##T, 1), (void *)(V)
1016 #define DEFBORDER(T) WBh(BOR_##T, 0)
1017 #define MKSHRINK WBh(MKSHRINK, 0)
1018 #define NORESIZE WBh(NORESIZE, 0)
1019 #define WANTMAX WBh(WANTMAX, 0)
1020 #define WANTMAXW WBh(WANTMAX, 1), (void *)(2)
1021 #define WXYWH(NM,W,H) WBh(WXYWH, 2), (NM), WBwh(W, H)
1022 #define DEFW(V) WXYWH(NULL, V, 0)
1023 #define DEFH(V) WXYWH(NULL, 0, V)
1024 #define DEFSIZE(W,H) WXYWH(NULL, W, H)
1025 #define WPMOUSE WBh(WPMOUSE, 0)
1026 #define WPWHEREVER WBh(WPWHEREVER, 0)
1027 #define HIDDEN WBh(HIDDEN, 0)
1028 #define INSENS WBh(INSENS, 0)
1029 #define FOCUS WBh(FOCUS, 0)
1030 #define WIDTH(N) WBh(WIDTH, 1), (void *)(N)
1031 #define MINWIDTH(N) WBh(WIDTH, 1), (void *)(-(N))
1032 #define KEEPWIDTH WBh(KEEPSIZE, 0)
1033 #define KEEPHEIGHT WBh(KEEPSIZE, 1), NULL
1034 #define HEIGHT(N) WBh(HEIGHT, 1), (void *)(N)
1035 #define ONTOP(V) WBhf(ONTOP, 1), WBfield(V)
1036 #define ONTOP0 WBh(ONTOP, 0)
1037 #define RAISED WBh(RAISED, 0)
1038 #define WLIST WBh(WLIST, 0)
1039 #define COLUMNDATA(V,S) WBhnf(COLUMNDATA, 2), WBfield(V), (void *)(S)
1040 #define IDXCOLUMN(N0,S,W,J) WBrh(IDXCOLUMN, 3), (void *)(N0), (void *)(S), \
1041 	(void *)((W) + ((J) << 16))
1042 #define TXTCOLUMNv(A,S,W,J) WBrh(TXTCOLUMN, 3), &(A), (void *)(S), \
1043 	(void *)((W) + ((J) << 16))
1044 #define XTXTCOLUMNv(A,S,W,J) WBrh(XTXTCOLUMN, 3), &(A), (void *)(S), \
1045 	(void *)((W) + ((J) << 16))
1046 #define NTXTCOLUMNv(NM,A,S,W,J) WBrh(TXTCOLUMN, 4), &(A), (void *)(S), \
1047 	(void *)((W) + ((J) << 16)), (NM)
1048 #define NTXTCOLUMND(NM,ST,F,W,J) WBrh(TXTCOLUMN, 4), (void *)offsetof(ST, F), \
1049 	NULL, (void *)((W) + ((J) << 16)), (NM)
1050 #define PTXTCOLUMN(V,S,W,J) WBrhf(TXTCOLUMN, 3), WBfield(V), (void *)(S), \
1051 	(void *)((W) + ((J) << 16) + (col_PTR << COL_LSHIFT))
1052 #define PTXTCOLUMNp(V,S,W,J) WBrhnf(TXTCOLUMN, 3), WBfield(V), (void *)(S), \
1053 	(void *)((W) + ((J) << 16) + (col_PTR << COL_LSHIFT))
1054 #define RTXTCOLUMND(ST,F,W,J) WBrh(TXTCOLUMN, 3), (void *)offsetof(ST, F), \
1055 	NULL, (void *)((W) + ((J) << 16) + (col_REL << COL_LSHIFT))
1056 #define RTXTCOLUMNDi(W,J) WBrh(TXTCOLUMN, 3), (void *)0, \
1057 	NULL, (void *)((W) + ((J) << 16) + (col_REL << COL_LSHIFT))
1058 #define NRTXTCOLUMND(NM,ST,F,W,J) WBrh(TXTCOLUMN, 4), (void *)offsetof(ST, F), \
1059 	NULL, (void *)((W) + ((J) << 16) + (col_REL << COL_LSHIFT)), (NM)
1060 #define NRTXTCOLUMNDax(NM,F,W,J,I) WBrh(TXTCOLUMN, 5), (void *)(sizeof(int) * F), \
1061 	NULL, (void *)((W) + ((J) << 16) + (col_REL << COL_LSHIFT)), (NM), (I)
1062 #define NRTXTCOLUMNDaxx(NM,F,W,J,I,S) WBrh(TXTCOLUMN, 6), (void *)(sizeof(int) * F), \
1063 	NULL, (void *)((W) + ((J) << 16) + (col_REL << COL_LSHIFT)), (NM), (I), (S)
1064 #define NRFILECOLUMNDax(NM,F,W,J,I) WBrh(FILECOLUMN, 5), (void *)(sizeof(int) * F), \
1065 	NULL, (void *)((W) + ((J) << 16) + (col_REL << COL_LSHIFT)), (NM), (I)
1066 #define CHKCOLUMNv(A,S,W,J,HC) WBr2h(CHKCOLUMN, 3 + 2), &(A), (void *)(S), \
1067 	(void *)((W) + ((J) << 16)), EVENT(CHANGE, HC)
1068 #define	XBMCURSOR(T,X,Y) WBrh(XBMCURSOR, 3), (xbm_##T##_bits), \
1069 	(xbm_##T##_mask_bits), WBxyl(X, Y, 20 + 1)
1070 #define	SYSCURSOR(T) WBrh(SYSCURSOR, 1), (void *)(GDK_##T)
1071 #define EVENT(T,H) WBrh(EVT_##T, 1), (H)
1072 #define TRIGGER WBrh(TRIGGER, 0)
1073 #define MTRIGGER(H) WBr2h(TRIGGER, 0 + 2), EVENT(CHANGE, H)
1074 #define WANTKEYS(H) WBr2h(WANTKEYS, 0 + 2), EVENT(KEY, H)
1075 #define CLIPFORM(A,N) WBrh(CLIPFORM, 2), &(A), (void *)(N)
1076 #define DRAGDROP(F,HF,HT) WBr3hf(DRAGDROP, 2 + 2 * 2), WBfield(F), NULL, \
1077 	EVENT(DRAGFROM, HF), EVENT(DROP, HT)
1078 #define DRAGDROPm(F,HF,HT) WBr3hf(DRAGDROP, 2 + 2 * 2), WBfield(F), (void *)1, \
1079 	EVENT(DRAGFROM, HF), EVENT(DROP, HT)
1080 #define CLIPBOARD(F,T,HC,HP) WBr3hf(CLIPBOARD, 2 + 2 * 2), WBfield(F), \
1081 	(void *)(T), EVENT(COPY, HC), EVENT(PASTE, HP)
1082 #define ALTNAME(NM) WBrh(uALTNAME, 1), (NM)
1083 /* Make option strings referrable as widget names */
1084 #define FLATTEN ALTNAME(":")
1085 #define OPNAME(NM) WBh(uOPNAME, 1), (NM)
1086 #define OPNAME0 WBh(uOPNAME, 0)
1087 /* Set an impossible name, to hide widget from script */
1088 #define UNNAME OPNAME("=")
1089 #define SCRIPTED WBhs(uOPNAME, 0)
1090 #define ENDSCRIPT WBrhs(uOPNAME, 0)
1091 
1092 //	Extra data of FPICK
1093 #define FPICK_VALUE	0
1094 #define FPICK_RAW	1
1095 //	Mode flags for FPICK
1096 #define FPICK_ENTRY	1
1097 #define FPICK_LOAD	2
1098 #define FPICK_DIRS_ONLY	4
1099 
1100 //	Extra data of PATH and PENTRY
1101 #define PATH_VALUE	0
1102 #define PATH_RAW	1
1103 
1104 //	Extra data of LISTCC
1105 #define LISTCC_RESET_ROW 0
1106 
1107 //	Extra data of LISTC
1108 #define LISTC_RESET_ROW	0
1109 #define LISTC_ORDER	1
1110 #define LISTC_SORT	2
1111 
1112 //	Extra data of LABEL and MENUITEM
1113 #define LABEL_VALUE	0
1114 
1115 //	Extra data of NBOOK
1116 #define NBOOK_TABS	0
1117 
1118 //	Extra data of ENTRY and COMBOENTRY
1119 #define ENTRY_VALUE	0
1120 
1121 //	Extra data of TEXT
1122 #define TEXT_VALUE	0
1123 
1124 //	Extra data of WDATA itself
1125 // !!! Must not clash with toplevels' data
1126 #define WDATA_ACTMAP	(-1)	/* Change state of slots which have ACTMAP */
1127 #define WDATA_TABLET	(-2)	/* Query tablet device */
1128 
1129 //	Extra data of WINDOW
1130 #define WINDOW_TITLE	0
1131 #define WINDOW_ESC_BTN	1
1132 #define WINDOW_FOCUS	2
1133 #define WINDOW_RAISE	3
1134 #define WINDOW_DISAPPEAR 4
1135 #define WINDOW_DPI	5
1136 #define WINDOW_TEXTENG	6
1137 
1138 //	Extra data of COLOR
1139 #define COLOR_RGBA	0
1140 #define COLOR_ALL	1
1141 
1142 //	Extra data of SPIN and SPINSLIDE
1143 #define SPIN_ALL	0
1144 
1145 //	Extra data of COLORLIST
1146 #define COLORLIST_RESET_ROW 0
1147 
1148 //	Extra data of PROGRESS
1149 #define PROGRESS_PERCENT 0
1150 
1151 //	Extra data of CSCROLL
1152 #define CSCROLL_XYSIZE	0	/* 4 ints: xywh; read-only */
1153 #define CSCROLL_LIMITS	1	/* 2 ints: wh; read-only */
1154 #define CSCROLL_XYRANGE	2	/* 4 ints: xywh */
1155 
1156 //	Extra data of CANVASIMG and CANVAS
1157 #define CANVAS_SIZE	0
1158 #define CANVAS_VPORT	1
1159 #define CANVAS_REPAINT	2
1160 #define CANVAS_PAINT	3
1161 #define CANVAS_FIND_MOUSE  4	/* mouse_ext: as motion event */
1162 #define CANVAS_BMOVE_MOUSE 5
1163 
1164 //	Extra data of FCIMAGE
1165 #define FCIMAGE_XY	0
1166 
1167 //	Extra data of KEYMAP
1168 #define KEYMAP_KEY	0
1169 #define KEYMAP_MAP	1
1170 
1171 //	Extra state of EV_MOUSE
1172 #define MOUSE_BOUND	0
1173 
1174 //	Extra data of EV_DRAGFROM
1175 #define DRAG_DATA	0	/* array of 2 pointers: start/end */
1176 #define DRAG_ICON_RGB	1
1177 
1178 //	Extra data of EV_COPY
1179 #define COPY_DATA	0
1180 
1181 //	Extra data of CLIPBOARD
1182 #define CLIP_TEXT	0
1183 
1184 //	Extra state of CLIPBOARD
1185 #define CLIP_OFFER	0
1186 #define CLIP_PROCESS	1
1187 
1188 //	Extra state of all regular widgets
1189 #define SLOT_SENSITIVE	0
1190 #define SLOT_FOCUSED	1
1191 #define SLOT_SCRIPTABLE	2
1192 #define SLOT_UNREAL	3
1193 #define SLOT_RADIO	4
1194 
1195 //	Extra data of FONTSEL
1196 #define FONTSEL_DPI	0
1197