home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / OB3.2D3.DMS / in.adf / Interfaces / InputEvent.mod < prev    next >
Encoding:
Text File  |  1993-05-23  |  10.8 KB  |  259 lines

  1. (*-------------------------------------------------------------------------*)
  2. (*                                                                         *)
  3. (*  Amiga Oberon Interface Module:                    Date: 02-Nov-92      *)
  4. (*                                                                         *)
  5. (*   © 1992 by Fridtjof Siebert                                            *)
  6. (*   updated for V39 by hartmut Goebel                                     *)
  7. (*                                                                         *)
  8. (*-------------------------------------------------------------------------*)
  9.  
  10. MODULE InputEvent; (* $Implementation- *)
  11.  
  12. IMPORT e * := Exec,
  13.        t * := Timer,
  14.        u * := Utility,
  15.        g * := Graphics;
  16.  
  17. TYPE
  18.   IEDummyPtr        * = UNTRACED POINTER TO IEDummy;
  19.   PointerPixelPtr   * = UNTRACED POINTER TO PointerPixel;
  20.   NewTabletPtr      * = UNTRACED POINTER TO NewTablet;
  21.   PointerTabletPtr  * = UNTRACED POINTER TO PointerTablet;
  22.   InputEventPtr     * = UNTRACED POINTER TO InputEvent;
  23.   InputEventAdrPtr  * = UNTRACED POINTER TO InputEventAdr;
  24.   InputEventPrevPtr * = UNTRACED POINTER TO InputEventPrev;
  25.  
  26. CONST
  27. (*----- constants --------------------------------------------------*)
  28.  
  29. (*  --- InputEvent.class --- *)
  30.   null           * = 00H; (* A NOP input event                              *)
  31.   rawkey         * = 01H; (* A raw keycode from the keyboard device         *)
  32.   rawmouse       * = 02H; (* The raw mouse report from the game port        *
  33.                            * device                                         *)
  34.   event          * = 03H; (* A private console event                        *)
  35.   pointerpos     * = 04H; (* A Pointer Position report                      *)
  36.   timer          * = 06H; (* A timer event                                  *)
  37.   gadgetdown     * = 07H; (* select button pressed down over a Gadget       *
  38.                            * (address in ie_EventAddress)                   *)
  39.   gadgetup       * = 08H; (* select button released over the same Gadget    *
  40.                            * (address in ie_EventAddress)                   *)
  41.   requester      * = 09H; (* some Requester activity has taken place.  See  *
  42.                            * Codes REQCLEAR and REQSET                      *)
  43.   menulist       * = 0AH; (* this is a Menu Number transmission (Menu       *
  44.                            * number is in ie_Code)                          *)
  45.   closewindow    * = 0BH; (* User has selected the active Window's Close    *
  46.                            * Gadget                                         *)
  47.   sizewindow     * = 0CH; (* this Window has a new size                     *)
  48.   refreshwindow  * = 0DH; (* the Window pointed to by ie_EventAddress needs *
  49.                            * to be refreshed                                *)
  50.   newprefs       * = 0EH; (* new preferences are available                  *)
  51.   diskremoved    * = 0FH; (* the disk has been removed                      *)
  52.   diskinserted   * = 10H; (* the disk has been inserted                     *)
  53.   activewindow   * = 11H; (* the window is about to be been made active     *)
  54.   inactivewindow * = 12H; (* the window is about to be made inactive        *)
  55.   newpointerpos  * = 13H; (* extended-function pointer position report      *
  56.                            * (V36)                                          *)
  57.   menuhelp       * = 14H; (* Help key report during Menu session (V36)      *)
  58.   changewindow   * = 15H; (* the Window has been modified with move, size,  *
  59.                            * zoom, or change (V36)                          *)
  60.  
  61.   classMax       * = 15H; (* the last class                                 *)
  62.  
  63.  
  64. (*  --- InputEvent.subClass --- *)
  65. (*  newpointerpos *)
  66.   compatible   * = 00H;  (* like pointerpos *)
  67.   pixel        * = 01H;  (* InputEvent.eventAddress points to PointerPixel *)
  68.   tablet       * = 02H;  (* InputEvent.eventAddress points to PointerTablet *)
  69.   newTablet    * = 03H;  (* InputEvent.eventAddress points to NewTablet *)
  70.  
  71. TYPE
  72.   IEDummy * = STRUCT END; (* dummy for InputEvent.eventAddress *)
  73.  
  74. (* pointed to by InputEvent.eventAddress for newpointerposs,
  75.  * and InputEvent.subClass=pixel.
  76.  *
  77.  * You specify a screen and pixel coordinates in that screen
  78.  * at which you'd like the mouse to be positioned.
  79.  * Intuition will try to oblige, but there will be restrictions
  80.  * to positioning the pointer over offscreen pixels.
  81.  *
  82.  * IEQUALIFIER_RELATIVEMOUSE is supported for IESUBCLASS_PIXEL.
  83.  *)
  84.   PointerPixel * = STRUCT (dummy: IEDummy)
  85.     screen * : e.APTR;                  (* pointer to an open screen *)
  86.     position * : g.Point;               (* pixel coordinates in iepp_Screen *)
  87.   END;
  88.  
  89. (* pointed to by InputEvent.eventAddress for newpointerpos,
  90.  * and InputEvent.subClass=tablet.
  91.  *
  92.  * You specify a range of values and a value within the range
  93.  * independently for each of X and Y (the minimum value of
  94.  * the ranges is always normalized to 0).
  95.  *
  96.  * Intuition will position the mouse proportionally within its
  97.  * natural mouse position rectangle limits.
  98.  *
  99.  * IEQUALIFIER_RELATIVEMOUSE is not supported for IESUBCLASS_TABLET.
  100.  *)
  101.   PointerTablet * = STRUCT (dummy: IEDummy)
  102.     range * : g.Point;     (* 0 is min, these are max   *)
  103.     value * : g.Point;     (* between 0 and range       *)
  104.     pressure * : INTEGER;  (* -128 to 127 (unused, set to 0)  *)
  105.   END;
  106.  
  107.  
  108. (* The ie_EventAddress of an IECLASS_NEWPOINTERPOS event of subclass
  109.  * IESUBCLASS_NEWTABLET points at an IENewTablet structure.
  110.  *
  111.  *
  112.  * IEQUALIFIER_RELATIVEMOUSE is not supported for IESUBCLASS_NEWTABLET.
  113.  *)
  114.  
  115.   NewTablet * = STRUCT (dummy: IEDummy)
  116.  
  117.     (* Pointer to a hook you wish to be called back through, in
  118.      * order to handle scaling.  You will be provided with the
  119.      * width and height you are expected to scale your tablet
  120.      * to, perhaps based on some user preferences.
  121.      * If NULL, the tablet's specified range will be mapped directly
  122.      * to that width and height for you, and you will not be
  123.      * called back.
  124.      *)
  125.     callBack        * : u.HookPtr;
  126.  
  127.     (* Post-scaling coordinates and fractional coordinates.
  128.      * DO NOT FILL THESE IN AT THE TIME THE EVENT IS WRITTEN!
  129.      * Your driver will be called back and provided information
  130.      * about the width and height of the area to scale the
  131.      * tablet into.  It should scale the tablet coordinates
  132.      * (perhaps based on some preferences controlling aspect
  133.      * ratio, etc.) and place the scaled result into these
  134.      * fields.        The ient_ScaledX and ient_ScaledY fields are
  135.      * in screen-pixel resolution, but the origin ( [0,0]-point )
  136.      * is not defined.        The ient_ScaledXFraction and
  137.      * ient_ScaledYFraction fields represent sub-pixel position
  138.      * information, and should be scaled to fill a UWORD fraction.
  139.      *)
  140.     scaledX         * : INTEGER;
  141.     scaledY         * : INTEGER;
  142.     scaledXFraction * : INTEGER;
  143.     scaledYFraction * : INTEGER;
  144.  
  145.     (* Current tablet coordinates along each axis: *)
  146.     tabletX         * : LONGINT;
  147.     tabletY         * : LONGINT;
  148.  
  149.     (* Tablet range along each axis.  For example, if ient_TabletX
  150.      * can take values 0-999, ient_RangeX should be 1000.
  151.      *)
  152.     rangeX          * : LONGINT;
  153.     rangeY          * : LONGINT;
  154.  
  155.     (* Pointer to tag-list of additional tablet attributes.
  156.      * See <intuition/intuition.h> for the tag values.
  157.      *)
  158.     tagList         * : u.TagListPtr;
  159.   END;
  160.  
  161. CONST
  162.  
  163. (*  --- InputEvent.ie_Code --- *)
  164. (*  IECLASS_RAWKEY *)
  165.   upPrefix             * = 080H;
  166.   keyCodeFirst         * = 000H;
  167.   keyCodeLast          * = 077H;
  168.   commCodeFirst        * = 078H;
  169.   commCodeLast         * = 07FH;
  170.  
  171. (*  IECLASS_ANSI *)
  172.   c0First              * = 000H;
  173.   c0Last               * = 01FH;
  174.   asciiFirst           * = 020H;
  175.   asciiLast            * = 07EH;
  176.   asciiDel             * = 07FH;
  177.   c1First              * = 080H;
  178.   c1Last               * = 09FH;
  179.   latin1First          * = 0A0H;
  180.   latin1Last           * = 0FFH;
  181.  
  182. (*  IECLASS_RAWMOUSE *)
  183.   lButton              * = 068H;  (* also uses IECODE_UP_PREFIX *)
  184.   rButton              * = 069H;
  185.   mButton              * = 06AH;
  186.   noButton             * = 0FFH;
  187.  
  188. (*  IECLASS_EVENT (V36) *)
  189.   newActive            * = 001H;  (* new active input window *)
  190.   newSize              * = 002H;  (* resize of window *)
  191.   refresh              * = 003H;  (* refresh of window *)
  192.  
  193. (*  IECLASS_REQUESTER *)
  194. (*      broadcast when the first Requester (not subsequent ones) opens up in *)
  195. (*      the Window *)
  196.   reqSet               * = 001H;
  197. (*      broadcast when the last Requester clears out of the Window *)
  198.   reqClear             * = 000H;
  199.  
  200.  
  201.  
  202. (*  --- InputEvent.qualifier --- *)
  203.  
  204.   lShift         * = 0;
  205.   rShift         * = 1;
  206.   capsLock       * = 2;
  207.   control        * = 3;
  208.   lAlt           * = 4;
  209.   rAlt           * = 5;
  210.   lCommand       * = 6;
  211.   rCommand       * = 7;
  212.   numericPad     * = 8;
  213.   repeat         * = 9;
  214.   interrupt      * = 10;
  215.   multiBroadCast * = 11;
  216.   midButton      * = 12;
  217.   rightButton    * = 13;
  218.   leftButton     * = 14;
  219.   relativeMouse  * = 15;
  220.  
  221. TYPE
  222.  
  223. (*----- InputEvent -------------------------------------------------*)
  224.  
  225.   InputEvent * = STRUCT
  226.     nextEvent     * : InputEventPtr; (* the chronologically next event *)
  227.     class         * : SHORTINT;      (* the input event class *)
  228.     subClass      * : SHORTINT;      (* optional subclass of the class *)
  229.     code          * : INTEGER;       (* the input event code *)
  230.     qualifier     * : SET;           (* qualifiers in effect for the event*)
  231.     x             * : INTEGER;       (* the pointer position for the event*)
  232.     y             * : INTEGER;
  233.     timeStamp     * : t.TimeVal;     (* the system tick at the event *)
  234.   END;
  235.   InputEventAdr * = STRUCT
  236.     nextEvent     * : InputEventAdrPtr;(* the chronologically next event *)
  237.     class         * : SHORTINT;        (* the input event class *)
  238.     subClass      * : SHORTINT;        (* optional subclass of the class *)
  239.     code          * : INTEGER;         (* the input event code *)
  240.     qualifier     * : SET;             (* qualifiers in effect for the event*)
  241.     addr          * : IEDummyPtr;      (* the event address *)
  242.     timeStamp     * : t.TimeVal;       (* the system tick at the event *)
  243.   END;
  244.   InputEventPrev * = STRUCT
  245.     nextEvent     * : InputEventPrevPtr;(* the chronologically next event *)
  246.     class         * : SHORTINT;         (* the input event class *)
  247.     subClass      * : SHORTINT;         (* optional subclass of the class *)
  248.     code          * : INTEGER;          (* the input event code *)
  249.     qualifier     * : SET;              (* qualifiers in effect for the event*)
  250.     prev1DownCode * : SHORTINT;         (* previous down keys for dead *)
  251.     prev1DownQual * : SHORTSET;         (*   key translation: the ie_Code *)
  252.     prev2DownCode * : SHORTINT;         (*   & low byte of ie_Qualifier for *)
  253.     prev2DownQual * : SHORTSET;         (*   last & second last down keys *)
  254.     timeStamp     * : t.TimeVal;        (* the system tick at the event *)
  255.   END;
  256.  
  257. END InputEvent.
  258.  
  259.