Initial revision
[ssr] / StraySrc / Libraries / Steel / h / wimpstruct
1 /*
2 * wimpstruct.h
3 *
4 * All the many structures you need for the WIMP
5 *
6 * © 1994-1998 Straylight
7 */
8
9 /*----- Licensing note ----------------------------------------------------*
10 *
11 * This file is part of Straylight's Steel library.
12 *
13 * Steel is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
16 * any later version.
17 *
18 * Steel is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with Steel. If not, write to the Free Software Foundation,
25 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 */
27
28 #ifndef __wimpstruct_h
29 #define __wimpstruct_h
30
31 #ifndef __os_h
32 #include "os.h"
33 #endif
34
35 #ifndef __sprite_h
36 #include "sprite.h"
37 #endif
38
39 /*----- Various handles ---------------------------------------------------*/
40
41 typedef int wimp_w; /* Normal window handle */
42 typedef int wimp_i; /* Icon `handle' */
43 typedef int wimp_t; /* Task handle */
44
45 /*----- Defining windows and icons ----------------------------------------*/
46
47 /* --- Window flags --- *
48 *
49 * Warning: The naming here is inconsistent. Be careful. The names are
50 * the same as used in RISC_OSLib, so it's not my fault
51 */
52
53 typedef enum
54 {
55 /* --- Basic window properties --- */
56
57 wimp_WMOVEABLE =(1<<1), /* Can be moved by user */
58 wimp_REDRAW_OK =(1<<4), /* Is redrawn only by WIMP */
59 wimp_WPANE =(1<<5), /* Is a pane of a window */
60 wimp_WTRESPASS =(1<<6), /* Can move off-screen */
61 wimp_WSCROLL_R1 =(1<<8), /* Scroll requests, auto-repeat */
62 wimp_SCROLL_R2 =(1<<9), /* Scroll requests, debounced */
63 wimp_REAL_COLOURS =(1<<10), /* Use real window colours */
64 wimp_BACK_WINDOW =(1<<11), /* Always stays at the back */
65 wimp_HOT_KEYS =(1<<12), /* Intercepts hotkeys */
66
67 /* --- Current window state (set by the WIMP) --- */
68
69 wimp_WOPEN =(1<<16), /* Is currently open */
70 wimp_WTOP =(1<<17), /* Is completely visible */
71 wimp_WFULL =(1<<18), /* Is as big as possible */
72 wimp_WCLICK_TOGGLE =(1<<19), /* Size has just been toggled */
73 wimp_WFOCUS =(1<<20), /* Owns the input focus */
74
75 /* --- Window `gadgets' --- */
76
77 wimp_WBACK =(1<<24), /* Send-to-back gadget */
78 wimp_WQUIT =(1<<25), /* Close window gadget */
79 wimp_WTITLE =(1<<26), /* Title bar */
80 wimp_WTOGGLE =(1<<27), /* Toggle size gadget */
81 wimp_WVSCR =(1<<28), /* Vertical scroll bar */
82 wimp_WSIZE =(1<<29), /* Adjust size gadget */
83 wimp_WHSCR =(1<<30), /* Horizontal scroll bar */
84 wimp_WNEW =~0x7FFFFFFF /* Use new gadget flags */
85 }
86 wimp_wflags;
87
88 /* --- Icon flags --- */
89
90 typedef enum
91 {
92 /* --- General flags --- */
93
94 wimp_ITEXT =(1<<0), /* Contains text */
95 wimp_ISPRITE =(1<<1), /* Contains a sprite */
96 wimp_IBORDER =(1<<2), /* Has a WIMP-drawn border */
97 wimp_IHCENTRE =(1<<3), /* Is horizontally centred */
98 wimp_IVCENTRE =(1<<4), /* Is vertically centred */
99 wimp_IFILLED =(1<<5), /* Has a filled background */
100 wimp_IFONT =(1<<6), /* Draw text anti-aliased */
101 wimp_IREDRAW =(1<<7), /* Force redraw on change */
102 wimp_INDIRECT =(1<<8), /* Icon data is indirected */
103 wimp_IRJUST =(1<<9), /* Is right-aligned */
104 wimp_IESG_NOC =(1<<10), /* Adjust clicks toggle selection */
105 wimp_IHALVESPRITE =(1<<11), /* Draw sprite half sized */
106
107 /* --- Larger fields --- */
108
109 wimp_IBTYPE =(1<<12), /* Button type (4 bits) */
110 wimp_IESG =(1<<16), /* ESG number (5 bits) */
111
112 /* --- Some more flags --- */
113
114 wimp_ISELECTED =(1<<21), /* Is selected (inverted) */
115 wimp_INOSELECT =(1<<22), /* Is shaded (unavailable) */
116 wimp_IDELETED =(1<<23), /* Is deleted (invisible) */
117
118 /* --- Colours/font information --- */
119
120 wimp_IFORECOL =(1<<24), /* Foreground colour (4 bits) */
121 wimp_IBACKCOL =(1<<28), /* Background colour (4 bits) */
122
123 wimp_IFONTH =(1<<24) /* Font handle (8 bits) */
124 }
125 wimp_iconflags;
126
127 /* --- Icon and window button types --- */
128
129 typedef enum
130 {
131 wimp_BIGNORE, /* Ignore all mouse clicks */
132 wimp_BNOTIFY, /* Always report pointer over icon */
133 wimp_BCLICKAUTO, /* Report mouse clicks, autorepeat */
134 wimp_BCLICKDEBOUNCE, /* Report mouse clicks, debounced */
135 wimp_BSELREL, /* Report mouse button release */
136 wimp_BSELDOUBLE, /* Report mouse double clicks */
137 wimp_BDEBOUNCEDRAG, /* Report clicks and drags */
138 wimp_BRELEASEDRAG, /* Report releases and drags */
139 wimp_BDOUBLEDRAG, /* Report double clicks and drags */
140 wimp_BSELNOTIFY, /* `Menu icon' (reports clicks) */
141 wimp_BCLICKDRAGDOUBLE, /* Clicks, double clicks and drags */
142 wimp_BCLICKSEL, /* `Radio icon' (clicks and drags) */
143 wimp_BTYPE12, /* Reserved for future exapansion */
144 wimp_BTYPE13, /* Reserved for future exapansion */
145 wimp_BCLICKWRITEDRAG, /* Writable; report clicks, drags */
146 wimp_BWRITABLE /* Writable; report nothing */
147 }
148 wimp_ibtype;
149
150 /* --- Window colours --- */
151
152 typedef enum
153 {
154 wimp_WCTITLEFORE, /* Title bar foreground (7) */
155 wimp_WCTITLEBACK, /* Title bar background (1) */
156 wimp_WCWKAREAFORE, /* Workarea default foreground (7) */
157 wimp_WCWKAREABACK, /* Workarea default background (0) */
158 wimp_WCSCROLLOUTER, /* Scroll bar `shoulder' area (3) */
159 wimp_WCSCROLLINNER, /* Scroll bar `thumb' area (1) */
160 wimp_WCTITLEHI, /* Highlight for input focus (12) */
161 wimp_WCRESERVED /* The non-existant useless colour */
162 }
163 wimp_wcolours;
164
165 /* --- Defining rectangles --- */
166
167 typedef struct
168 {
169 int x0,y0; /* Bottom left (inclusive) */
170 int x1,y1; /* Top right (exclusive) */
171 }
172 wimp_box;
173
174 /* --- Icon data --- */
175
176 typedef union
177 {
178 char text[12]; /* Non-indirected text string */
179
180 char sprite_name[12]; /* Non-indirected sprite name */
181
182 struct
183 {
184 char *name; /* Pointer to sprite name */
185 void *spritearea; /* Pointer to real sprite area */
186 BOOL nameisname; /* FALSE => name is sprite pointer */
187 }
188 indirectsprite; /* Indirected sprite information */
189
190 struct
191 {
192 char *buffer; /* Pointer to text buffer */
193 char *validstring; /* Pointer to validation string */
194 int bufflen; /* Size of text buffer in bytes */
195 }
196 indirecttext; /* Indirectted text information */
197 }
198 wimp_icondata;
199
200 /* --- Window definitions --- */
201
202 typedef struct
203 {
204 wimp_box box; /* Initial position on the screen */
205 int scx,scy; /* Initial scroll bar positions */
206 wimp_w behind; /* Window behind which to open */
207
208 wimp_wflags flags; /* Window flags word */
209 char colours[8]; /* Various colours for the window */
210
211 wimp_box ex; /* Initial window extent */
212
213 wimp_iconflags titleflags; /* Information about window title */
214 wimp_iconflags workflags; /* Work area button type */
215
216 void *spritearea; /* Sprite area for this window */
217 int minsize; /* Minimum size for the window */
218 wimp_icondata title; /* Title bar icon data info */
219 int nicons; /* Number of icons in the window */
220 }
221 wimp_wind;
222
223 /* --- Icon definitions --- */
224
225 typedef struct
226 {
227 wimp_box box; /* Position of icon within window */
228 wimp_iconflags flags; /* Icon flags word */
229 wimp_icondata data; /* Icon data information */
230 }
231 wimp_icon;
232
233 /*----- Manipulating windows and icons ------------------------------------*/
234
235 /* --- Creating an icon --- */
236
237 typedef struct
238 {
239 wimp_w w; /* Window in which to create icon */
240 wimp_icon i; /* Information about icon */
241 }
242 wimp_icreate;
243
244 /* --- Opening windows --- */
245
246 typedef struct
247 {
248 wimp_w w; /* Window handle to open */
249 wimp_box box; /* Position on screen to open at */
250 int x,y; /* Scroll bar positions to set */
251 wimp_w behind; /* Window behind which to open */
252 }
253 wimp_openstr;
254
255 /* --- Redrawing windows --- */
256
257 typedef struct
258 {
259 wimp_w w; /* The window handle to redraw */
260 wimp_box box; /* Where it is on the screen */
261 int scx,scy; /* Scroll bar positions */
262 wimp_box g; /* Graphics clipping rectangle */
263 }
264 wimp_redrawstr;
265
266 /* --- Finding information about a window --- */
267
268 typedef struct
269 {
270 wimp_openstr o; /* Where the window is on screen */
271 wimp_wflags flags; /* Anything else about the window */
272 }
273 wimp_wstate;
274
275 /* --- Reading a whole window definition --- */
276
277 typedef struct
278 {
279 wimp_w w; /* Window handle (fill this in) */
280 wimp_wind info; /* Window definition (Wimp fills) */
281 }
282 wimp_winfo;
283
284 /*----- Pointer and caret structures --------------------------------------*/
285
286 /* --- Mouse button status --- */
287
288 typedef enum
289 {
290 /* --- Button-type independent actions --- */
291
292 wimp_BMID =0x002, /* Menu button click */
293
294 /* --- Standard click codes --- *
295 *
296 * As returned by wimp_get_point_info, or for single clicks on button
297 * types Always, Autorepeat, Debounced, Release, Click/Drag, Release/Drag,
298 * Menu, Select/Drag or Click/Write/Drag, or double clicks on Double,
299 * Double/Drag and Double/Click/Drag.
300 */
301
302 wimp_BRIGHT =0x001, /* Adjust click or double click */
303 wimp_BLEFT =0x004, /* Select click or double click */
304
305 /* --- Drag codes --- *
306 *
307 * As returned by drags on button types Click/Drag, Release/Drag,
308 * Double/Drag, Select/Drag, Double/Click/Drag and Click/Write/Drag.
309 */
310
311 wimp_BDRAGRIGHT =0x010, /* Adjust drag */
312 wimp_BDRAGLEFT =0x040, /* Select drag */
313
314 /* --- Odd click codes --- *
315 *
316 * As returned by single clicks on button type Double/Click/Drag.
317 */
318
319 wimp_BCLICKRIGHT =0x100, /* Adjust single click */
320 wimp_BCLICKLEFT =0x400, /* Select single click */
321
322 /* --- And nothing at all --- *
323 *
324 * As returned by wimp_get_point_info, or by just pointing at button type
325 * Always.
326 */
327
328 wimp_BNOTHING =0x000 /* Not doing anything at all */
329 }
330 wimp_bbits;
331
332 /* --- Current mouse status --- */
333
334 typedef struct
335 {
336 int x,y; /* Mouse position on the screen */
337 wimp_bbits bbits; /* Current mouse button state */
338 wimp_w w; /* Window under the mouse pointer */
339 wimp_w i; /* Icon under the mouse pointer */
340 }
341 wimp_mousestr;
342
343 /* --- Special caret flags --- */
344
345 typedef enum
346 {
347 wimp_CHEIGHT =(1<<0), /* The caret height (16 bits) */
348 wimp_CCOLOUR =(1<<16), /* The caret colour (8 bits) */
349 wimp_CVDUSTYLE =(1<<24), /* Plot VDU-5 caret, not Font one */
350 wimp_CINVISIBLE =(1<<25), /* Don't actually draw it at all */
351 wimp_CUSECOLOUR =(1<<26), /* Use the colour I've specified */
352 wimp_CNOTWIMPCOL =(1<<27) /* The colour is a GCOL, not a */
353 /* normal Wimp colour */
354 }
355 wimp_caretflags;
356
357 /* --- Current caret status --- */
358
359 typedef struct
360 {
361 wimp_w w; /* The window containing the caret */
362 wimp_w i; /* The icon containing the caret */
363 int x,y; /* Its position within the window */
364 wimp_caretflags height; /* Its height, and other things */
365 int index; /* Its index into the icon */
366 }
367 wimp_caretstr;
368
369 /*----- Wimp message structures -------------------------------------------*/
370
371 typedef enum
372 {
373 wimp_MCLOSEDOWN =0x00000, /* Task is being told to quit */
374
375 /* --- Data transfer protocol messages --- */
376
377 wimp_MDATASAVE =0x00001, /* Request to import some data */
378 wimp_MDATASAVEOK =0x00002, /* Import data by scrap file */
379 wimp_MDATALOAD =0x00003, /* Request to load data from file */
380 wimp_MDATALOADOK =0x00004, /* File loaded successfully */
381 wimp_MDATAOPEN =0x00005, /* File double-clicked in Filer */
382 wimp_MRAMFETCH =0x00006, /* Transfer data to by buffer */
383 wimp_MRAMTRANSMIT =0x00007, /* Data transferred, try again */
384 wimp_MDATASAVED =0x0000D, /* File has magically become safe */
385
386 /* --- Miscellaneous --- */
387
388 wimp_MPREQUIT =0x00008, /* Task will be asked to quit soon */
389 wimp_PALETTECHANGE =0x00009, /* Desktop palette has changed */
390
391 /* --- RISC OS 3 only --- */
392
393 wimp_SAVEDESK =0x0000A, /* Save application status to file */
394 wimp_MDEVICECLAIM =0x0000B, /* Broadcast before device claims */
395 wimp_MDEVICEINUSE =0x0000C, /* The device claimed is in use */
396
397 /* --- Filer messages --- */
398
399 wimp_FilerOpenDir =0x00400, /* Open a Filer window on screen */
400 wimp_FilerCloseDir =0x00401, /* Close a Filer window or two */
401
402 /* --- Help messages --- */
403
404 wimp_MHELPREQUEST =0x00502, /* `What does this thing do?' */
405 wimp_MHELPREPLY =0x00503, /* `Oh well, it does this, y'see' */
406
407 /* --- NetFiler messages --- */
408
409 wimp_Notify =0x40040, /* Someone else notified us */
410
411 /* --- WIMP messages --- */
412
413 wimp_MMENUWARN =0x400C0, /* A submenu needs opening */
414 wimp_MMODECHANGE =0x400C1, /* The screen mode has changed */
415 wimp_MINITTASK =0x400C2, /* A new application has started */
416 wimp_MCLOSETASK =0x400C3, /* An application has vanished */
417 wimp_MSLOTCHANGE =0x400C4, /* An application's slot changed */
418 wimp_MSETSLOT =0x400C5, /* Task's slot bar was dragged */
419 wimp_MTASKNAMERQ =0x400C6, /* Find out a task's name */
420 wimp_MTASKNAMEIS =0x400C7, /* Reply to TaskNameRq */
421 wimp_MTASKSTARTED =0x400C8, /* `I have initialised properly' */
422
423 /* --- Straylight messages --- */
424
425 wimp_MINTERNAL =0x427FF, /* For internal broadcast messages */
426
427 /* --- Messing about with printers --- */
428
429 wimp_MPrintFile =0x80140, /* Printer's response to DataSave */
430 wimp_MWillPrint =0x80141, /* Response: `I will print it' */
431 wimp_MPrintSave =0x80142, /* Task: `I want to print a file' */
432 wimp_MPrintInit =0x80143, /* Tell other drivers to hari-kiri */
433 wimp_MPrintError =0x80144, /* Printer is busy/something died */
434 wimp_MPrintTypeOdd =0x80145, /* Printer: `How do I print this?' */
435 wimp_MPrintTypeKnown =0x80146, /* Response: `Give it here...' */
436 wimp_MPrinterChange =0x80147 /* Printer driver settings changed */
437 }
438 wimp_msgaction;
439
440 /* --- The message header format --- */
441
442 typedef struct
443 {
444 int size; /* Size of the message (20-256) */
445 wimp_t task; /* Task handle of the sender */
446 int my_ref; /* The sender's reference */
447 int your_ref; /* Which message it's replying to */
448 wimp_msgaction action; /* What sort of message it is */
449 }
450 wimp_msghdr;
451
452 /* --- Lots of structures containing message information --- */
453
454 typedef struct
455 {
456 wimp_w w; /* Window handle to save to */
457 wimp_i i; /* Icon handle to save to */
458 int x,y; /* Position of mouse pointer */
459 int estsize; /* Estimated size of the file */
460 int type; /* Filetype of the file */
461 char leaf[12]; /* Leafname of the file */
462 }
463 wimp_msgdatasave;
464
465 typedef struct
466 {
467 wimp_w w; /* Window handle to save to */
468 wimp_i i; /* Icon handle to save to */
469 int x,y; /* Position of mouse pointer */
470 int estsize; /* Estimated size of the file */
471 int type; /* Filetype of the file */
472 char name[212]; /* The name of the file to save */
473 }
474 wimp_msgdatasaveok;
475
476 typedef struct
477 {
478 wimp_w w; /* Window handle to save to */
479 wimp_i i; /* Icon handle to save to */
480 int x,y; /* Position of mouse pointer */
481 int size; /* Actual size of the file */
482 int type; /* Filetype of the file */
483 char name[212]; /* The name of the file to save */
484 }
485 wimp_msgdataload;
486
487 typedef wimp_msgdataload wimp_msgdataopen;
488
489 typedef struct
490 {
491 char *addr; /* Address in my workspace to fill */
492 int nbytes; /* The size of my buffer */
493 }
494 wimp_msgramfetch;
495
496 typedef struct
497 {
498 char *addr; /* Address in your workspace */
499 int nbyteswritten; /* How much I filled it up */
500 }
501 wimp_msgramtransmit;
502
503 typedef struct
504 {
505 int filehandle; /* RISC OS file handle to write to */
506 }
507 wimp_msgsavedesk;
508
509 typedef struct
510 {
511 int major,minor; /* Device idenitification numbers */
512 char information[228]; /* A string of stuff about it all */
513 }
514 wimp_msgdevice;
515
516 typedef struct
517 {
518 wimp_mousestr m; /* What it wants help about */
519 }
520 wimp_msghelprequest;
521
522 typedef struct
523 {
524 char text[200]; /* What it's all about */
525 }
526 wimp_msghelpreply;
527
528 typedef struct
529 {
530 int filler[5]; /* Nothing really interesting */
531 int type; /* File type of the file to print */
532 char name[212]; /* The full name of the file */
533 }
534 wimp_msgprint;
535
536 typedef struct
537 {
538 int errnum; /* The error number of the error */
539 char errmess[232]; /* The error's textual message */
540 }
541 wimp_msgprinterror;
542
543 /* --- An actual message structure --- */
544
545 typedef struct
546 {
547 wimp_msghdr hdr; /* The message's common header */
548
549 union
550 {
551 /* --- Standard forms --- */
552
553 char chars[236]; /* Information as a char string */
554 int words[59]; /* Information as array of words */
555
556 /* --- Data transfer --- */
557
558 wimp_msgdatasave datasave;
559 wimp_msgdatasaveok datasaveok;
560 wimp_msgdataload dataload;
561 wimp_msgdataopen dataopen;
562 wimp_msgramfetch ramfetch;
563 wimp_msgramtransmit ramtransmit;
564
565 /* --- Help messages --- */
566
567 wimp_msghelprequest helprequest;
568 wimp_msghelpreply helpreply;
569
570 /* --- Printer driver messages --- */
571
572 wimp_msgprint print; /* Printer message common format */
573 wimp_msgprinterror printerror;
574
575 /* --- Other messages --- */
576
577 wimp_msgsavedesk savedesk;
578 wimp_msgdevice device;
579 }
580 data; /* The message's individual data */
581 }
582 wimp_msgstr;
583
584 /*----- Defining WIMP events ----------------------------------------------*/
585
586 /* --- All the different types of event --- */
587
588 typedef enum
589 {
590 wimp_ENULL =0, /* Null_Reason_Code */
591 wimp_EREDRAW, /* Redraw_Window_Request */
592 wimp_EOPEN, /* Open_Window_Request */
593 wimp_ECLOSE, /* Close_Window_Request */
594 wimp_EPTRLEAVE, /* Pointer_Leaving_Window */
595 wimp_EPTRENTER, /* Pointer_Entering_Window */
596 wimp_EBUT, /* Mouse_Clicked */
597 wimp_EUSERDRAG, /* User_Drag_Box */
598 wimp_EKEY, /* Key_Pressed */
599 wimp_EMENU, /* Menu_Selection */
600 wimp_ESCROLL, /* Scroll_Request */
601 wimp_ELOSECARET, /* Lose_Caret */
602 wimp_EGAINCARET, /* Gain_Caret */
603 wimp_ESEND =17, /* User_Message */
604 wimp_ESENDWANTACK =18, /* User_Message_Recorded */
605 wimp_EACK =19 /* User_Message_Acknowledge */
606 }
607 wimp_etype;
608
609 /* --- Wimp event mask --- */
610
611 typedef enum
612 {
613 wimp_EMNULL =(1<<wimp_ENULL),
614 wimp_EMREDRAW =(1<<wimp_EREDRAW),
615 wimp_EMOPEN =(1<<wimp_EOPEN),
616 wimp_EMCLOSE =(1<<wimp_ECLOSE),
617 wimp_EMPTRLEAVE =(1<<wimp_EPTRLEAVE),
618 wimp_EMPTRENTER =(1<<wimp_EPTRENTER),
619 wimp_EMBUT =(1<<wimp_EBUT),
620 wimp_EMUSERDRAG =(1<<wimp_EUSERDRAG),
621 wimp_EMKEY =(1<<wimp_EKEY),
622 wimp_EMMENU =(1<<wimp_EMENU),
623 wimp_EMSCROLL =(1<<wimp_ESCROLL),
624 wimp_EMLOSECARET =(1<<wimp_ELOSECARET),
625 wimp_EMGAINCARET =(1<<wimp_EGAINCARET),
626 wimp_EMSEND =(1<<wimp_ESEND),
627 wimp_EMSENDWANTACK =(1<<wimp_ESENDWANTACK),
628 wimp_EMACK =(1<<wimp_EACK)
629 }
630 wimp_emask;
631
632 /* --- Wimp event data --- */
633
634 typedef union
635 {
636 wimp_openstr o; /* For Redraw, Open, Close, Enter */
637 /* and leave events */
638 struct
639 {
640 wimp_mousestr m; /* The new mouse status */
641 wimp_bbits b; /* The old mouse button status */
642 }
643 but; /* For Mouse_Clicked events */
644
645 wimp_box dragbox; /* For User_Drag_Box events */
646
647 struct
648 {
649 wimp_caretstr c; /* The current caret location */
650 int chcode; /* The key pressed (Wimp keymap) */
651 }
652 key; /* For Key_Pressed events */
653
654 int menu[10]; /* For Menu_Selection events */
655
656 struct
657 {
658 wimp_openstr o; /* Where the window is right now */
659 int x,y; /* Scroll offsets to apply */
660 }
661 scroll; /* For Scroll_Request events */
662
663 wimp_caretstr c; /* For Lose_ and Gain_Caret events */
664 /* It's a shame they don't work */
665
666 wimp_msgstr msg; /* For all the User_Message events */
667 }
668 wimp_eventdata;
669
670 typedef struct
671 {
672 wimp_etype e; /* What the event's all about */
673 wimp_eventdata data; /* And all the information for it */
674 }
675 wimp_eventstr;
676
677 /*----- Menu definitions --------------------------------------------------*/
678
679 /* --- Menu item flags --- */
680
681 typedef enum
682 {
683 wimp_MTICK =(1<<0), /* The item is shown ticked */
684 wimp_MSEPARATE =(1<<1), /* Item has a rule-off after it */
685 wimp_MWRITABLE =(1<<2), /* Item is writable (yuk) */
686 wimp_MSUBLINKMSG =(1<<3), /* Generate submenu warnings */
687 wimp_MOPENSUB =(1<<4), /* Open submenu even when shaded */
688 wimp_MLAST =(1<<7) /* This is the last item here */
689 }
690 wimp_menuflags;
691
692 typedef struct wimp_menustr *wimp_menuptr;
693
694 /* --- A menu item --- */
695
696 typedef struct
697 {
698 wimp_menuflags flags; /* Flags for this menu item */
699 wimp_menuptr submenu; /* Pointer to the item's submenu */
700 wimp_iconflags iconflags; /* Icon flags for the menu item */
701 wimp_icondata data; /* Icon data for the menu item */
702 }
703 wimp_menuitem;
704
705 /* --- A menu header --- */
706
707 typedef struct
708 {
709 char title[12]; /* The menu's title string */
710 char tit_fcol; /* Title foreground colour (7) */
711 char tit_bcol; /* Title background colour (2) */
712 char work_fcol; /* Work area foreground colour (7) */
713 char work_bcol; /* Work area background colour (0) */
714 int width,height; /* Dimensions of the menu items */
715 int gap; /* Gap between items (0, please!) */
716 }
717 wimp_menuhdr;
718
719 /* --- A whole menu --- *
720 *
721 * Curiouser and curiouser -- the whole thing is set up to allow a circular
722 * reference between wimp_menustr and wimp_menuitem, which is never actually
723 * taken advantage. I'd love to put a wimp_menuitem items[1] on the end of
724 * wimp_menustr, but my hands are tied by Compatibility Problems.
725 */
726
727 typedef struct wimp_menustr
728 {
729 wimp_menuhdr hdr; /* The menu header */
730 }
731 wimp_menustr;
732
733 /*----- A mixed bag of other structures -----------------------------------*/
734
735 /* --- Types of drag operations --- */
736
737 typedef enum
738 {
739 /* --- System drag types --- */
740
741 wimp_MOVE_WIND =1, /* Drag the window's position */
742 wimp_SIZE_WIND =2, /* Drag the window's size */
743 wimp_DRAG_HBAR =3, /* Drag the horizontal scroll bar */
744 wimp_DRAG_VBAR =4, /* Drag the vertical scroll bar */
745 wimp_DRAG_SCROLL =12, /* Drag both scroll bars at once */
746
747 /* --- User types --- */
748
749 wimp_USER_FIXED =5, /* Drag a fixed-size box around */
750 wimp_USER_RUBBER =6, /* Drag a rubbery box around */
751 wimp_USER_HIDDEN =7 /* Drag an invisible point around */
752
753 /* --- Other types omitted --- *
754 *
755 * On the grounds that the actual code has to be in the RMA, we omit the
756 * support for types 8-11.
757 */
758 }
759 wimp_dragtype;
760
761 /* --- Dragging boxes around --- */
762
763 typedef struct
764 {
765 wimp_w window; /* Window handle for system drags */
766 wimp_dragtype type; /* The type of the drag to do */
767 wimp_box box; /* The actual box to drag around */
768 wimp_box parent; /* The box to drag it around in */
769 }
770 wimp_dragstr;
771
772 /* --- Wimp_WhichIcon parameter block --- *
773 *
774 * I can't see what's wrong with just passing the arguments to
775 * wimp_which_icon, but then again I lack Acorn's great Wisdom, and am
776 * merely a humble Infidel, who comprehends not the great Subtleties and
777 * Mysteries of the great Edifice which is RISC_OSLib's wimp interface.
778 *
779 * I can't actually see why Wimp_WhichIcon is useful at all, since just
780 * skimming through the icon definitions is probably faster anyway.
781 */
782
783 typedef struct
784 {
785 wimp_w window; /* Which window do we search? */
786 int bit_mask; /* BIC mask for all the icon flags */
787 int bit_set; /* Compare mask for the icon flags */
788 }
789 wimp_which_block;
790
791 /* --- Setting pointer shapes --- *
792 *
793 * There is no excuse for using this call. *Please* don't. It's really
794 * not very nice.
795 */
796
797 typedef struct
798 {
799 int shape_num;
800 char *shape_data;
801 int width,height;
802 int activex,activey;
803 }
804 wimp_pshapestr;
805
806 /* --- A font reference count array --- */
807
808 typedef struct
809 {
810 char f[256];
811 }
812 wimp_font_array;
813
814 /* --- For loading templates --- */
815
816 typedef struct
817 {
818 int reserved; /* A pointless waste of space left */
819 /* so that the structure doesn't */
820 /* change size */
821
822 wimp_wind *buf; /* Pointer to window def to fill */
823 char *work_free; /* Pointer to indirected data area */
824 char *work_end; /* Limit of indirected data area */
825 wimp_font_array *font; /* Pointer to font ref count array */
826 char *name; /* Pointer to name to find */
827 int index; /* Index to search from in file */
828 }
829 wimp_template;
830
831 /* --- A palette information word --- */
832
833 typedef union
834 {
835 struct
836 {
837 char gcol; /* Actual colour number used */
838 char red,green,blue; /* The real colour for the entry */
839 }
840 bytes; /* The colour split up nicely */
841
842 int word; /* The colour as an integer */
843 }
844 wimp_paletteword;
845
846 /* --- A whole palette --- */
847
848 typedef struct
849 {
850 wimp_paletteword c[16]; /* The main 16 WIMP colours used */
851 wimp_paletteword screenborder; /* The colour of the screen border */
852 wimp_paletteword mouse1; /* The `outer' pointer colour */
853 wimp_paletteword mouse2; /* The `inner' pointer colour */
854 wimp_paletteword mouse3; /* The `don't use' pointer colour */
855 }
856 wimp_palettestr;
857
858 /* --- Flags for error boxes --- */
859
860 typedef enum
861 {
862 wimp_EOK =(1<<0), /* Put in an `OK' box */
863 wimp_ECANCEL =(1<<1), /* Put in a `Cancel' box */
864 wimp_EHICANCEL =(1<<2), /* Highlight `Cancel', not `OK' */
865 wimp_ENOPROMPT =(1<<3), /* Don't prompt in textual message */
866 wimp_ENOPREFIX =(1<<4), /* Don't put `Error from' in title */
867 wimp_ERETURN =(1<<5), /* Return immediately if no click */
868 wimp_ESELECT =(1<<6), /* Select `OK' or `Cancel' */
869 wimp_ENOBEEP =(1<<7) /* Don't make a beepy noise */
870 }
871 wimp_errflags;
872
873 /* --- Command window actions --- *
874 *
875 * They've outdone themselves this time. I wonder if it's intentional.
876 */
877
878 typedef enum
879 {
880 wimp_command_TITLE =0, /* Set up the window title */
881 wimp_command_ACTIVE =1, /* Just mark CommandWindow as on */
882 wimp_command_CLOSE_PROMPT =2, /* Close the window and prompt */
883 wimp_command_CLOSE_NOPROMPT =3 /* Close the window straight away */
884 }
885 wimp_command_tag;
886
887 /* --- Actually getting anything done in a CommandWindow --- */
888
889 typedef struct
890 {
891 wimp_command_tag tag; /* What to do */
892 char *title; /* The title to do it with */
893 }
894 wimp_commandwind;
895
896 /* --- ReadSysInfo numbers --- */
897
898 typedef enum
899 {
900 wimp_ITASKS, /* The number of tasks running */
901 wimp_IWIMPMODE, /* The current Wimp mode */
902 wimp_ISUFFIX, /* The filename mode suffix */
903 wimp_ICMDMODE, /* 0 for command mode, 1 for desk */
904 wimp_IWRITEDIR, /* 0 == left-to-right */
905 wimp_IHANDLE, /* R0 == handle, R1 == Wimp version*/
906 wimp_IDUNNO, /* Not implemented, oddly enough */
907 wimp_IWIMPVERSION, /* Current WIMP version */
908 wimp_IFONTHANDLE /* The font handle for icons */
909 }
910 wimp_sysinfo;
911
912 /*----- That's it then ----------------------------------------------------*/
913
914 #endif