home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / desklib / !DeskLib / h / Wimp < prev    next >
Encoding:
Text File  |  1994-05-22  |  20.9 KB  |  882 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Wimp.h
  12.     Author:  Copyright © 1992 John Winters and Jason Williams
  13.     Version: 1.11 (14 Jul 1993)
  14.     Purpose: Type/structure definitions for Wimp SWI interface
  15. */
  16.  
  17.  
  18. #ifndef __dl_wimp_h
  19. #define __dl_wimp_h
  20.  
  21. #ifndef __dl_core_h
  22. #include "Core.h"
  23. #endif
  24.  
  25.  
  26.  
  27. /* The size of wimp names (icon text fields, sprite names, etc) */
  28. #define wimp_MAXNAME 12
  29.  
  30.  
  31. typedef struct
  32. {
  33.   int x, y;
  34. } wimp_point;
  35.  
  36. typedef wimp_point wimp_coord;
  37.  
  38.  
  39. typedef struct
  40. {
  41.   wimp_point min;
  42.   wimp_point max;
  43. } wimp_rect;
  44.  
  45. typedef wimp_rect wimp_box;
  46.  
  47. typedef int window_handle;
  48. typedef int icon_handle;
  49. typedef int task_handle;
  50.  
  51.  
  52. /* -------------------------------------------------------------------------
  53.    Wimp colours and palettes
  54.    ------------------------------------------------------------------------- */
  55.  
  56. #define colour_WHITE        0
  57. #define colour_GREY0        0
  58. #define colour_GREY1        1
  59. #define colour_GREY2        2
  60. #define colour_GREY3        3
  61. #define colour_GREY4        4
  62. #define colour_GREY5        5
  63. #define colour_GREY6        6
  64. #define colour_GREY7        7
  65. #define colour_BLACK        7
  66. #define colour_DARK_BLUE    8
  67. #define colour_YELLOW       9
  68. #define colour_GREEN       10
  69. #define colour_RED         11
  70. #define colour_CREAM       12
  71. #define colour_ARMY_GREEN  13
  72. #define colour_ORANGE      14
  73. #define colour_LIGHT_BLUE  15
  74.  
  75. #define colour_TRANSPARENT 255 
  76.  
  77. typedef union
  78. {
  79.   int value;
  80.   struct
  81.   {
  82.     unsigned int wimpcolour : 4;
  83.     unsigned int gcolaction : 3;
  84.     unsigned int foreback   : 1;
  85.     unsigned int padding    : 24;
  86.   } data;
  87. } wimp_colour;
  88.  
  89.  
  90. typedef union
  91. {
  92.   int value;
  93.   struct
  94.   {
  95.     char gcol;
  96.     char red;
  97.     char green;
  98.     char blue;
  99.   } data;
  100. } palette_entry;
  101.  
  102.  
  103. typedef struct
  104. {
  105.   palette_entry colour[16];
  106.   palette_entry border;
  107.   palette_entry mouse1;
  108.   palette_entry mouse2;
  109.   palette_entry mouse3;
  110. } palette_block;
  111.                 
  112.  
  113. /* -------------------------------------------------------------------------
  114.    Wimp icon data:
  115.    ------------------------------------------------------------------------- */
  116.  
  117. #define iconbtype_NEVER            0
  118. #define iconbtype_ALWAYS           1
  119. #define iconbtype_AUTOREPEAT       2
  120. #define iconbtype_CLICK            3
  121. #define iconbtype_RELEASE          4
  122. #define iconbtype_DOUBLECLICK      5
  123. #define iconbtype_CLICKDRAG        6
  124. #define iconbtype_RELEASEDRAG      7
  125. #define iconbtype_DOUBLEDRAG       8
  126. #define iconbtype_MENU             9
  127. #define iconbtype_DOUBLECLICKDRAG 10
  128. #define iconbtype_RADIO           11
  129. #define iconbtype_RESERVED1       12
  130. #define iconbtype_RESERVED2       13
  131. #define iconbtype_WRITECLICKDRAG  14
  132. #define iconbtype_WRITABLE        15
  133.  
  134.  
  135. /*  Icon bar icon positions, and
  136.  *  the window handle of the iconbar when returned by the Wimp
  137.  */
  138. #define iconbar_RIGHT -1
  139. #define iconbar_LEFT  -2
  140. #define window_ICONBAR -2
  141.  
  142. /* Icon flag bits */
  143. #define icon_TEXT        0x00000001      /* icon contains text               */
  144. #define icon_SPRITE      0x00000002      /* icon is a sprite                 */
  145. #define icon_BORDER      0x00000004      /* icon has a border                */
  146. #define icon_HCENTRE     0x00000008      /* text is horizontally centred     */
  147. #define icon_VCENTRE     0x00000010      /* text is vertically centred       */
  148. #define icon_FILLED      0x00000020      /* icon has a filled background     */
  149. #define icon_FONT        0x00000040      /* text is an anti-aliased font     */
  150. #define icon_NEEDSHELP   0x00000080      /* redraw needs application's help  */
  151. #define icon_INDIRECTED  0x00000100      /* icon data is 'indirected'        */
  152. #define icon_RJUSTIFY    0x00000200      /* text right justified in box      */
  153. #define icon_ALLOWADJUST 0x00000400      /* Allow multiple select with adjust*/
  154. #define icon_HALVESPRITE 0x00000800      /* plot sprites half-size           */
  155. #define icon_BUTTONTYPE  0x00001000      /* 4-bit field: button type         */
  156. #define icon_SELECTED    0x00200000      /* icon selected by user (inverted) */
  157. #define icon_SHADED      0x00400000      /* icon cannot be selected (shaded) */
  158. #define icon_DELETED     0x00800000      /* icon has been deleted            */
  159.  
  160. #define icon_FORECOLOUR  0x01000000      /* 4-bit field: foreground colour   */
  161. #define icon_BACKCOLOUR  0x10000000      /* 4-bit field: background colour   */
  162.  
  163. #define iconvalid_ALLOW           'A'
  164. #define iconvalid_BORDERTYPE      'R'
  165. #define iconvalid_DISPLAY         'D'
  166. #define iconvalid_FONTCOLOURS     'F'
  167. #define iconvalid_LINESPACE       'L'
  168. #define iconvalid_SPRITENAME      'S'
  169.  
  170. #define iconborder_PLINTH          0
  171. #define iconborder_SURROUND        1
  172. #define iconborder_OKBUTTON        2
  173. #define iconborder_INDENT          3
  174.  
  175. typedef union
  176. {
  177.   unsigned int value;
  178.  
  179.   struct
  180.   {
  181.     unsigned int garbage1      : 6;    /* New struct to allow easy access to */
  182.     unsigned int font          : 1;    /* the font handle of an icon. NOTE   */
  183.     unsigned int garbage2      : 17;   /* that handle is ONLY valid IF       */
  184.     unsigned int handle        : 8;    /* 'font' is TRUE.                    */
  185.   } font;
  186.  
  187.   struct
  188.   {
  189.     unsigned int text          : 1;
  190.     unsigned int sprite        : 1;
  191.     unsigned int border        : 1;
  192.     unsigned int hcentre       : 1;
  193.     unsigned int vcentre       : 1;
  194.     unsigned int filled        : 1;
  195.     unsigned int font          : 1;
  196.     unsigned int needshelp     : 1;
  197.     unsigned int indirected    : 1;
  198.     unsigned int rightjustify  : 1;
  199.     unsigned int allowadjust   : 1;
  200.     unsigned int halfsize      : 1;
  201.     unsigned int buttontype    : 4;
  202.     unsigned int esg           : 5;
  203.     unsigned int selected      : 1;
  204.     unsigned int shaded        : 1;
  205.     unsigned int deleted       : 1;
  206.     unsigned int foreground    : 4;
  207.     unsigned int background    : 4;
  208.   } data;
  209. } icon_flags;
  210.  
  211.  
  212. typedef struct
  213. {
  214.   char         *buffer;
  215.   char         *validstring;
  216.   unsigned int bufflen;
  217. } icon_indtext;
  218.  
  219.  
  220. typedef struct
  221. {
  222.   const char   *name;
  223.   unsigned int *spritearea;
  224.   unsigned int nameisname;
  225. } icon_indsprite;
  226.  
  227.  
  228. typedef union
  229. {
  230.   char           text[wimp_MAXNAME];
  231.   icon_indtext   indirecttext;
  232.   char           spritename[wimp_MAXNAME];
  233.   icon_indsprite indirectsprite;
  234. } icon_data;
  235.  
  236.  
  237. typedef struct
  238. {
  239.   wimp_box   workarearect;
  240.   icon_flags flags;
  241.   icon_data  data;
  242. } icon_block;
  243.  
  244.  
  245. typedef struct
  246. {
  247.   window_handle window;
  248.   icon_block    icondata;
  249. } icon_createblock;
  250.  
  251.  
  252. /* -------------------------------------------------------------------------
  253.    Window data:
  254.    ------------------------------------------------------------------------- */
  255.  
  256. typedef union
  257. {
  258.   struct
  259.   {
  260.     unsigned int hastitle      : 1;  /* these are "old-style" flags  */
  261.     unsigned int moveable      : 1;  /* You should not be using them */
  262.     unsigned int hasvscroll    : 1;  /* " */
  263.     unsigned int hashscroll    : 1;  /* " */
  264.     unsigned int autoredraw    : 1;  /* " */
  265.     unsigned int pane          : 1;  /* " */
  266.     unsigned int nobounds      : 1;  /* " */
  267.     unsigned int nobackclose   : 1;  /* " */
  268.   
  269.     unsigned int scrollrq      : 1;
  270.     unsigned int scrollrqdebounced : 1;
  271.     unsigned int realcolours   : 1;
  272.     unsigned int backwindow    : 1;
  273.     unsigned int hotkeys       : 1;
  274.     unsigned int dummy13       : 1;
  275.     unsigned int dummy14       : 1;
  276.     unsigned int dummy15       : 1;
  277.     unsigned int open          : 1;
  278.     unsigned int top           : 1;
  279.     unsigned int fullsize      : 1;
  280.     unsigned int istoggling    : 1;
  281.     unsigned int focus         : 1;
  282.     unsigned int dummy21       : 1;
  283.     unsigned int dummy22       : 1;
  284.     unsigned int dummy23       : 1;
  285.     unsigned int backicon      : 1;
  286.     unsigned int closeicon     : 1;
  287.     unsigned int titlebar      : 1;
  288.     unsigned int toggleicon    : 1;
  289.     unsigned int vscroll       : 1;
  290.     unsigned int adjusticon    : 1;
  291.     unsigned int hscroll       : 1;
  292.     unsigned int newflags      : 1;  /* This should always be TRUE */
  293.   } data;
  294.   int value;
  295. } window_flags;
  296.  
  297.  
  298. typedef struct                /* Minimum width/height of window. Used to be: */
  299. {                             /*   unsigned short minwidth, minheight;       */
  300.   int x : 16;                 /* This has been changed for compatability     */
  301.   int y : 16;                 /* with compilers other than Desktop C         */
  302. } window_minsize;
  303.  
  304.  
  305. typedef enum
  306. {
  307.   windowcol_TITLEFORE = 0,
  308.   windowcol_TITLEBACK,
  309.   windowcol_WORKFORE,
  310.   windowcol_WORKBACK,
  311.   windowcol_SCROLLBACK,
  312.   windowcol_SCROLLFORE,
  313.   windowcol_TITLEHILITE
  314. } window_colourindices;
  315.  
  316.  
  317. typedef struct
  318. {
  319.   wimp_box       screenrect;
  320.   wimp_point     scroll;
  321.   window_handle  behind;
  322.   window_flags   flags;
  323.   char           colours[8];
  324.   wimp_box       workarearect;
  325.   icon_flags     titleflags;
  326.   icon_flags     workflags;
  327.   void           *spritearea;
  328.   window_minsize minsize;
  329.   icon_data      title;
  330.   unsigned int   numicons;
  331.   /*
  332.    *  What we really want here is :
  333.   icon_block        icons [0];
  334.    *  but unfortunately 'C' (stupidly) doesn't allow it.  Just think it.
  335.    */
  336. } window_block;
  337.  
  338.  
  339. typedef struct
  340. {
  341.   window_handle window;
  342.   wimp_box      screenrect;
  343.   wimp_point    scroll;
  344.   window_handle behind;
  345. } window_openblock;
  346.  
  347.  
  348. typedef struct
  349. {
  350.   window_openblock openblock;
  351.   window_flags     flags;
  352. } window_state;
  353.  
  354.  
  355. typedef struct
  356. {
  357.   window_handle window;
  358.   window_block  block;
  359. } window_info;
  360.  
  361.  
  362. typedef struct
  363. {
  364.   window_handle window;
  365.   wimp_box      rect;
  366.   wimp_point    scroll;
  367.   wimp_box      cliprect;
  368. } window_redrawblock;
  369.  
  370.  
  371. typedef struct
  372. {
  373.   window_handle window;
  374.   wimp_box      screenrect;
  375. } window_outline;
  376.  
  377.  
  378. /* -------------------------------------------------------------------------
  379.    Mouse/Pointer information:
  380.    ------------------------------------------------------------------------- */
  381.  
  382. #define button_ADJUST      0x00000001
  383. #define button_MENU        0x00000002
  384. #define button_SELECT      0x00000004
  385. #define button_DRAGADJUST  0x00000010
  386. #define button_DRAGSELECT  0x00000040
  387. #define button_CLICKADJUST 0x00000100
  388. #define button_CLICKSELECT 0x00000400
  389.  
  390. typedef union
  391. {
  392.   unsigned int value;
  393.   struct
  394.   {
  395.     unsigned int adjust       : 1;
  396.     unsigned int menu         : 1;
  397.     unsigned int select       : 1;
  398.     unsigned int dummy3       : 1;
  399.     unsigned int dragadjust   : 1;
  400.     unsigned int dummy5       : 1;
  401.     unsigned int dragselect   : 1;
  402.     unsigned int dummy7       : 1;
  403.     unsigned int clickadjust  : 1;
  404.     unsigned int dummy9       : 1;
  405.     unsigned int clickselect  : 1;
  406.   } data;
  407. } button_state;
  408.  
  409.  
  410. typedef struct
  411. {
  412.   wimp_point    pos;
  413.   button_state  button;
  414.   window_handle window;
  415.   icon_handle   icon;
  416. } mouse_block;
  417.  
  418.  
  419. typedef struct
  420. {
  421.   int           shapenumber;
  422.   char          *shapedata;
  423.   unsigned int  width;
  424.   unsigned int  height;
  425.   wimp_point    active;
  426. } pointer_shapeblock;
  427.  
  428.  
  429. /* -------------------------------------------------------------------------
  430.    Wimp drag data:
  431.    ------------------------------------------------------------------------- */
  432.  
  433. typedef enum
  434. {
  435.   drag_MOVEWINDOW    = 1,
  436.   drag_RESIZEWINDOW,
  437.   drag_SCROLLX,
  438.   drag_SCROLLY,
  439.   drag_FIXEDBOX,
  440.   drag_RUBBERBOX,
  441.   drag_INVISIBLE,
  442.   drag_USERFIXEDBBOX,
  443.   drag_USERRUBBERBOX,
  444.   drag_USERFIXEDNC,
  445.   drag_USERRUBBERNC
  446. } drag_type;
  447.  
  448.  
  449. typedef struct
  450. {
  451.   window_handle window;
  452.   drag_type     type;
  453.   wimp_box      screenrect;
  454.   wimp_box      parent;
  455. } drag_block;
  456.  
  457.  
  458. /* -------------------------------------------------------------------------
  459.    Wimp errors:
  460.    ------------------------------------------------------------------------- */
  461.  
  462. typedef union
  463. {
  464.   unsigned int value;
  465.   struct
  466.   {
  467.     unsigned int ok               : 1;
  468.     unsigned int cancel           : 1;
  469.     unsigned int highlightcancel  : 1;
  470.     unsigned int noprompt         : 1;
  471.     unsigned int noprefix         : 1;
  472.     unsigned int nowait           : 1;
  473.     unsigned int closebox         : 1;
  474.   } data;
  475. } error_flags;
  476.  
  477.  
  478. /* -------------------------------------------------------------------------
  479.    Menus
  480.    ------------------------------------------------------------------------- */
  481.  
  482. typedef struct menu_block *menu_ptr;
  483.  
  484.  
  485. typedef union
  486. {
  487.   unsigned int value;
  488.   struct
  489.   {
  490.     unsigned int ticked     : 1;
  491.     unsigned int dotted     : 1;
  492.     unsigned int writable   : 1;
  493.     unsigned int notifysub  : 1;
  494.     unsigned int dummy3     : 3;
  495.     unsigned int last       : 1;
  496.     unsigned int dummy14    : 14;
  497.     unsigned int shaded     : 1;
  498.     unsigned int dummy1     : 1;
  499.     unsigned int foreground : 4;
  500.     unsigned int background : 4;
  501.   } data;
  502. } menu_flags;
  503.  
  504.  
  505. typedef union
  506. {
  507.   menu_ptr      menu;
  508.   window_handle window;
  509.   int           value;
  510. } menu_submenu;
  511.  
  512.  
  513. typedef struct
  514. {
  515.   menu_flags   menuflags;
  516.   menu_submenu submenu;
  517.   icon_flags   iconflags;
  518.   icon_data    icondata;
  519. } menu_item;
  520.  
  521.  
  522. typedef struct menu_block
  523. {
  524.   char     title [wimp_MAXNAME];
  525.   char     titlefore, titleback, workfore, workback;
  526.   unsigned int width;
  527.   unsigned int height;
  528.   unsigned int gap;
  529.   /*  Followed immediately by menu items */
  530. } menu_block;
  531.  
  532.  
  533. /* -------------------------------------------------------------------------
  534.    Caret/Keypress data:
  535.    ------------------------------------------------------------------------- */
  536.  
  537. typedef int key_press;
  538.  
  539. typedef struct
  540. {
  541.   window_handle window;
  542.   icon_handle   icon;
  543.   wimp_point    offset;
  544.   int           height;
  545.   int           index;
  546. } caret_block;
  547.  
  548.  
  549. typedef struct
  550. {
  551.   caret_block caret;
  552.   key_press   code;
  553. } key_block;
  554.  
  555.  
  556. typedef struct
  557. {
  558.   int address;
  559.   int contents;
  560. } pollword_block;
  561.  
  562.  
  563. /* -------------------------------------------------------------------------
  564.    Wimp message data:
  565.    ------------------------------------------------------------------------- */
  566.  
  567. typedef enum
  568. {
  569.   message_QUIT           = 0,
  570.   message_CLOSEDOWN      = 0,
  571.   message_DATASAVE       = 1,
  572.   message_DATASAVEACK    = 2,
  573.   message_DATASAVEOK     = 2,
  574.   message_DATALOAD       = 3,
  575.   message_DATALOADACK    = 4,
  576.   message_DATALOADOK     = 4,
  577.   message_DATAOPEN,
  578.   message_RAMFETCH,
  579.   message_RAMTRANSMIT,
  580.   message_PREQUIT,
  581.   message_PALETTECHANGE,
  582.   message_SAVEDESK,
  583.   message_DEVICECLAIM,
  584.   message_DEVICEINUSE,
  585.   message_DATASAVED,
  586.  
  587.   message_FILEROPENDIR   = 0x400,
  588.   message_FILERCLOSEDIR,
  589.  
  590.   message_HELPREQUEST    = 0x502,
  591.   message_HELPREPLY,
  592.  
  593.   message_NOTIFY         = 0x40040,
  594.   message_MENUWARNING    = 0x400C0,
  595.   message_MENUWARN       = 0x400C0,
  596.   message_MODECHANGE,
  597.   message_TASKINITIALISE = 0x400C2,
  598.   message_INITTASK       = 0x400C2,
  599.   message_TASKCLOSEDOWN  = 0x400C3,
  600.   message_CLOSETASK      = 0x400C3,
  601.   message_SLOTSIZE       = 0x400C4,
  602.   message_SLOTCHANGE     = 0x400C4,
  603.   message_SETSLOT        = 0x400C5,
  604.   message_TASKNAMERQ,
  605.   message_TASKNAMEIS,
  606.   message_TASKSTARTED,
  607.   message_MENUSDELETED,              /* RO3 Menu closed warning    */
  608.   message_WINDOWINFO     = 0x400CC,  /* RO3 For window iconisation */
  609.  
  610.   message_POPUPRQ        = 0x46D40,  /* PopUp messages - cf PopUp.h */
  611.   message_POPUPREQUEST   = 0x46D40,
  612.   message_POPUPSTATE,
  613.   message_POPUPCLOSED,
  614.  
  615.   message_PRINTFILE      = 0x80140,
  616.   message_WILLPRINT,
  617.   message_PRINTTYPEODD   = 0x80145,
  618.   message_PRINTTYPEKNOWN,
  619.   message_PRINTERCHANGE
  620. } message_action;
  621.  
  622.  
  623. typedef int message_destinee;  /* Window or Task handle */
  624.  
  625.  
  626. typedef struct
  627. {
  628.   unsigned int   size;
  629.   task_handle    sender;
  630.   unsigned int   myref;
  631.   unsigned int   yourref;
  632.   message_action action;
  633. } message_header;
  634.  
  635.  
  636. typedef struct
  637. {
  638.   window_handle window;
  639.   icon_handle   icon;
  640.   wimp_point    pos;
  641.   int           estsize;
  642.   int           filetype;
  643.   char          leafname[12];
  644. } message_datasave;
  645.  
  646.  
  647. typedef struct
  648. {
  649.   window_handle window;   /* window, icon, pos, estsize, filetype all copied */
  650.   icon_handle   icon;     /* from the initiating datasave message            */
  651.   wimp_point    pos;
  652.   int           estsize;
  653.   int           filetype;
  654.   char          filename[212];
  655. } message_datasaveack;
  656.  
  657.  
  658. typedef struct
  659. {
  660.   window_handle window;
  661.   icon_handle   icon;
  662.   wimp_point    pos;
  663.   int           size;
  664.   int           filetype;
  665.   char          filename[212];
  666. } message_dataload;
  667.  
  668. /*
  669.  * typedef struct
  670.  * {
  671.  *   -- Nothing in here - no data needed in DataLoadAck -- 
  672.  * } message_dataloadack;
  673.  */
  674.  
  675.  
  676. typedef message_dataload message_dataopen;
  677.  
  678.  
  679. typedef struct
  680. {
  681.   char *buffer;
  682.   int  buffsize;
  683. } message_ramfetch;
  684.  
  685.  
  686. typedef struct
  687. {
  688.   char *buffer;   /* copied directly from initiating RamFetch */
  689.   int  byteswritten;
  690. } message_ramtransmit;
  691.  
  692.  
  693. typedef struct
  694. {
  695.   mouse_block where;  /* Where is help needed for? */
  696. } message_helprequest;
  697.  
  698.  
  699. typedef struct
  700. {
  701.   char text[200];
  702. } message_helpreply;
  703.  
  704.  
  705. typedef struct
  706. {
  707.   int filler[5];
  708.   int filetype;
  709.   char filename[212];
  710. } message_print;
  711.  
  712. typedef struct
  713. {
  714.   int        id;                      /* The number given to Wimp_CreateMenu */
  715.   wimp_point openpos;                 /* Position to open window/menu at     */
  716.   int        selection[10];           /* -1 terminated list of menu hits     */
  717. } message_menuwarn;
  718.  
  719.  
  720. typedef struct
  721. {
  722.   message_header  header;
  723.   union
  724.   {
  725.     char                 bytes [236];
  726.     int                  words [59];
  727.     message_datasave     datasave;
  728.     message_datasaveack  datasaveack;
  729.     message_dataload     dataload;
  730.     message_dataopen     dataopen;
  731.     message_ramfetch     ramfetch;
  732.     message_ramtransmit  ramtransmit;
  733.     message_helprequest  helprequest;
  734.     message_helpreply    helpreply;
  735.     message_print        print;
  736.     message_menuwarn     menuwarn;
  737.  
  738. #if FALSE
  739.     message_popuprequest popuprequest;    /* If PopUps in use, also include */
  740.     message_popupstate   popupstate;      /* the relevant PopUp messages    */
  741. #endif
  742.  
  743.   } data;
  744. } message_block;
  745.  
  746.  
  747. /* -------------------------------------------------------------------------
  748.    Wimp events:
  749.    ------------------------------------------------------------------------- */
  750.  
  751. #define wimp_NUMBEROFEVENTS 20
  752. /*
  753.  *  N.B.  There aren't 20, but you need an array this big to store them
  754.  *  due to the way they are numbered.
  755.  */
  756.  
  757.  
  758. typedef enum
  759. {
  760.   event_ANY                 = -99,  /*  see event.c: this is used to denote
  761.                                      *  any event type, any window handle,
  762.                                      *  or any icon handle ... thus -99.
  763.                                      */
  764.   event_NULL                = 0,
  765.   event_REDRAW,
  766.   event_OPEN,
  767.   event_CLOSE,
  768.   event_PTRLEAVE,
  769.   event_PTRENTER,
  770.   event_CLICK = 6,
  771.   event_BUTTON = 6,
  772.   event_USERDRAG,
  773.   event_KEY,
  774.   event_MENU,
  775.   event_SCROLL,
  776.   event_LOSECARET,
  777.   event_GAINCARET,
  778.   event_NONZEROPOLLWORD,
  779.   event_USERMESSAGE         = 17,
  780.   event_SEND                = 17,
  781.   event_USERMESSAGERECORDED = 18,
  782.   event_SENDWANTACK         = 18,
  783.   event_USERMESSAGEACK      = 19,
  784.   event_ACK                 = 19
  785. } event_type;
  786.  
  787.  
  788. typedef union
  789. {
  790.   unsigned int value;
  791.   struct
  792.   {
  793.     unsigned int null                : 1;
  794.     unsigned int redraw              : 1;
  795.     unsigned int open                : 1;
  796.     unsigned int close               : 1;
  797.     unsigned int ptrleave            : 1;
  798.     unsigned int ptrenter            : 1;
  799.     unsigned int click               : 1;
  800.     unsigned int userdrag            : 1;
  801.     unsigned int key                 : 1;
  802.     unsigned int menu                : 1;
  803.     unsigned int scroll              : 1;
  804.     unsigned int losecaret           : 1;
  805.     unsigned int gaincaret           : 1;
  806.     unsigned int nonzeropollword     : 1;
  807.     unsigned int dummy14             : 1;
  808.     unsigned int dummy15             : 1;
  809.     unsigned int dummy16             : 1;
  810.     unsigned int usermessage         : 1;
  811.     unsigned int usermessagerecorded : 1;
  812.     unsigned int usermessageack      : 1;
  813.     unsigned int dummy20             : 1;
  814.     unsigned int dummy21             : 1;
  815.     unsigned int r3ispollwordptr     : 1;
  816.     unsigned int highprioritypoll    : 1;
  817.     unsigned int keepfpregisters     : 1;
  818.   } data;
  819. } event_pollmask;
  820.  
  821.  
  822. typedef struct
  823. {
  824.   window_openblock openblock;
  825.   wimp_point       direction;
  826. } scroll_rq;
  827.  
  828.  
  829. typedef union
  830. {
  831.   caret_block      caret;
  832.   key_block        key;
  833.   pollword_block   pollword;
  834.   window_openblock openblock;
  835.   message_block    message;
  836.   mouse_block      mouse;
  837.   wimp_box         screenrect;
  838.   int              selection[10];
  839.   scroll_rq        scroll;
  840.   char             bytes [256];
  841.   int              words [64];
  842. } event_data;
  843.  
  844.  
  845. typedef struct
  846. {
  847.   event_type type;
  848.   event_data data;
  849. } event_pollblock;
  850.  
  851.  
  852. /* -------------------------------------------------------------------------
  853.    Miscellanea
  854.    ------------------------------------------------------------------------- */
  855.  
  856.  
  857. /* See Font.h for a description of this */
  858. typedef struct
  859. {
  860.   char fonts[256];
  861. } font_array;
  862.  
  863.  
  864. typedef struct
  865. {
  866.   window_block   *buffer;
  867.   char           *workfree;
  868.   char           *workend;
  869.   font_array     *font;
  870.   char           *name;
  871.   unsigned int   index;
  872. } template_block;
  873.  
  874.  
  875. typedef struct
  876. {
  877.   wimp_point mul;
  878.   wimp_point div;
  879. } scale_block;
  880.  
  881. #endif
  882.