home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 125.lha / WKeys_2.33 / wKeys.h < prev    next >
C/C++ Source or Header  |  1986-11-20  |  4KB  |  108 lines

  1. /*
  2.  *  wKeys.h    Structure definitions for wKeys program, which moves
  3.  *             and activates windows and screens via keystrokes.
  4.  *
  5.  *             Copyright (c) 1987,1988 by Davide P. Cervone
  6.  *  You may use this code provided this copyright notice is left intact.
  7.  */
  8.  
  9.  
  10. /*
  11.  *  HotKey is the structure that holds the information needed to bind a
  12.  *  key to a function.  Each HotKey is a pair of longwords, the first
  13.  *  represents a combination of the key-code and qualifier mask for the
  14.  *  key to be bound to a function.  Using a single longword for this makes
  15.  *  it easy to compare against the currently pressed key.
  16.  *
  17.  *  The second longword represents the qualifier mask that specifies the 
  18.  *  qualifier flags that are important to distinguish this key binding from
  19.  *  other bindings with the same scan-code but different qualifiers.  It is
  20.  *  the logical OR of all the qualifiers used by any key definition with
  21.  *  the same scan-code as this one.  This longword contains 0xFF in the 
  22.  *  same position where the first one has the scan-code, so ANDing this mask
  23.  *  against a KeyCode longword does not mask out the key code.
  24.  *
  25.  *  The second longword also contains a byte that represents the action that
  26.  *  the key will perform when it is pressed.
  27.  */
  28.  
  29. struct HotKey
  30. {
  31.    union
  32.    {
  33.       struct
  34.       {
  35.          UBYTE Code;                /* the InputEvent ie_Code field */
  36.          UBYTE Flags;               /* SHIFT, AMIGA, and ALT (0 otherwise) */
  37.          UWORD Qualifiers;          /* the InputEvent ie_Qualfiers field */
  38.       } PartCode;
  39.       long FullCode;                /* KeyCode longword */
  40.    } Key;
  41.    union
  42.    {
  43.       struct
  44.       {
  45.          UBYTE FF;                  /* always 0xFF */
  46.          UBYTE Action;              /* the action to be performed by this key */
  47.          UWORD Mask;                /* the qualifier mask */
  48.       } PartMask;
  49.       long FullMask;                /* the KeyMask longword */
  50.    } Mask;
  51. };
  52.  
  53. #define hk_Code     Key.PartCode.Code
  54. #define hk_Flags    Key.PartCode.Flags
  55. #define hk_Qual     Key.PartCode.Qualifiers
  56. #define hk_KeyCode  Key.FullCode
  57. #define hk_FF       Mask.PartMask.FF
  58. #define hk_Action   Mask.PartMask.Action
  59. #define hk_Mask     Mask.PartMask.Mask
  60. #define hk_KeyMask  Mask.FullMask
  61.  
  62.  
  63. /*
  64.  *  This is the structure used in the linked list when building the key
  65.  *  definition array.  It is the same as a HotKey except it contains pointers
  66.  *  to the next and previous items so that it can be sorted by mSort().
  67.  */
  68.  
  69. struct HotKeyItem
  70. {
  71.    struct HotKeyItem *Next;
  72.    struct HotKeyItem *Prev;
  73.    struct HotKey HotKey;
  74. };
  75.  
  76. #define hki_Code     HotKey.hk_Code
  77. #define hki_Flags    HotKey.hk_Flags
  78. #define hki_Qual     HotKey.hk_Qual
  79. #define hki_KeyCode  HotKey.hk_KeyCode
  80. #define hki_FF       HotKey.hk_FF
  81. #define hki_Action   HotKey.hk_Action
  82. #define hki_Mask     HotKey.hk_Mask
  83. #define hki_KeyMask  HotKey.hk_KeyMask
  84.  
  85.  
  86. /*
  87.  *  These are the actions that can be perfomed.  They must correspond to the
  88.  *  Action[] array in the input handler.  You can add functions to the end
  89.  *  of this list provided you add them into the Action[] array in 
  90.  *  wKeys-Handler.c, and the Action[] array in BindWKeys.c.
  91.  */
  92.  
  93. #define SCREENTOFRONT     1
  94. #define SCREENTOBACK      2
  95. #define ACTIVATEPREVIOUS  3
  96. #define ACTIVATENEXT      4
  97. #define WINDOWTOBACK      5
  98. #define WINDOWTOFRONT     6
  99. #define BACKTOFRONT       7
  100. #define FRONTTOBACK       8
  101. #define CLOSETHEWINDOW    9
  102. #define WINDOWTOICON      10
  103. #define ICONTOWINDOW      11
  104. #define SELECTNEXTICON    12
  105.  
  106. #define KEYCODE(qual,key)       (((key)<<24)|(qual))
  107. #define KEY(e)                  KEYCODE((e)->ie_Qualifier,(e)->ie_Code)
  108.