home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / Emulation_Include_Files / keybd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  8.6 KB  |  260 lines

  1. //      Copyright (c) 1995-1998 Microsoft Corporation
  2. //      @doc    EXTERNAL
  3.  
  4. /*      @module keybd.h       |
  5.  
  6. Non Win32 defines and structs for WinCE keyboard.
  7.  
  8. */
  9. #ifndef __KEYBD_H__
  10. #define __KEYBD_H__
  11.  
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15.  
  16.  
  17. /*        @doc    EXTERNAL DRIVERS
  18.         @type   KEY_STATE_FLAGS | Flags for keyboard events and shift state.
  19.  
  20. @comm These flags perform a number of functions:
  21.  
  22. @comm The low order bits are used to keep track of a key state.  This
  23. allows using 256 UINT8's for the key state array just like windows does
  24. already.
  25.  
  26. @comm The upper bits keep track of shift state on a per key basis.  Since
  27. we are not maintaining a complete key state array for each task, this
  28. gives us some extra info fairly cheaply.
  29.  
  30. @comm The KeyStateDownFlag does double duty internal to the driver to
  31. identify key up or key down events.
  32.  
  33. @comm KeyShiftDeadFlag is set by the <f KeybdDriverVKeyToUnicode> function
  34. to signify that the character generated is a dead character.
  35.  
  36. @comm KeyShiftNoCharacterFlag is set by the <f KeybdDriverVKeyToUnicode>
  37. function to signify that there is no valid character to generate for the
  38. given virtual key event.  This may be the case on a key up event or a key
  39. which only changes the shift state.
  40.  
  41. @comm The control, alt, shift and capital flags are set by the <f
  42. KeybdDriverVKeyToUnicode> function to encapsulate the shift state when the
  43. character was generated.
  44.  
  45. @xref
  46.     <tab><f KeybdDriverVKeyToUnicode><nl>
  47.     <tab><f KeybdEventCallback><nl>
  48.  
  49. */
  50. typedef UINT32  KEY_STATE_FLAGS;
  51.  
  52. #define KeyStateToggledFlag            0x0001    //    Key is toggled.
  53. #define KeyStateGetAsyncDownFlag    0x0002    //    Key went down since last GetAsyncKey call.
  54. #define KeyStateReserved4            0x0004
  55. #define KeyStateReserved8            0x0008
  56. #define KeyStateReserved10            0x0010
  57. #define KeyStateReserved20            0x0020
  58. #define KeyStatePrevDownFlag        0x0040    //    Key was previously down.
  59. #define KeyStateDownFlag            0x0080    //    Key is currently down.
  60.  
  61. #define KeyStateKeyEventFlag        0x80000000    //    Internal
  62. #define KeyShiftAnyCtrlFlag            0x40000000  //  L or R control is down.
  63. #define KeyShiftAnyShiftFlag        0x20000000  //  L or R shift is down.
  64. #define KeyShiftAnyAltFlag            0x10000000  //  L or R alt is down.
  65. #define KeyShiftCapitalFlag            0x08000000  //  VK_CAPITAL is toggled.
  66. #define KeyShiftLeftCtrlFlag        0x04000000  //  L control is down.
  67. #define KeyShiftLeftShiftFlag        0x02000000  //  L shift is down.
  68. #define KeyShiftLeftAltFlag            0x01000000  //  L alt is down.
  69. #define KeyShiftLeftWinFlag            0x00800000  //  L Win key is down.
  70. #define KeyShiftRightCtrlFlag        0x00400000  //  R control is down.
  71. #define KeyShiftRightShiftFlag        0x00200000  //  R shift is down.
  72. #define KeyShiftRightAltFlag        0x00100000  //  R alt is down.
  73. #define KeyShiftRightWinFlag        0x00080000  //  R Win key is down.
  74. #define KeyShiftReserved40000        0x00040000  //  Reserved.
  75. #define KeyShiftDeadFlag            0x00020000  //  Corresponding char is dead char.
  76. #define KeyShiftNoCharacterFlag        0x00010000  //  No corresponding char.
  77.  
  78. #define    KeyShiftLanguageFlag1        0x00008000  //  Use for language specific shifts.
  79. #define KeyShiftKeybdEventFlag        0x00004000    //    Not for external use.
  80.  
  81. #define KeyShiftUseVKNullFlag        0x00002000  //  Not for external use.
  82. #define KeyShiftNumLockFlag            0x00001000  //  NumLock toggled state.
  83. #define KeyShiftReserved800            0x00000800  //  Reserved.
  84. #define KeyShiftReserved400            0x00000400  //  Reserved.
  85. #define KeyShiftReserved200            0x00000200  //  Reserved.
  86. #define KeyShiftReserved100            0x00000100  //  Reserved.
  87.  
  88. // Japanese keyboard
  89. #define    KeyShiftKanaFlag            KeyShiftLanguageFlag1  //  Kana lock is toggled.
  90.  
  91.  
  92. #define KeyStateIsDown(Flags)           (Flags&KeyStateDownFlag)
  93. #define KeyStateIsPrevDown(Flags)       (Flags&KeyStatePrevDownFlag)
  94. #define KeyStateIsToggled(Flags)        (Flags&KeyStateToggledFlag)
  95. #define KeyStateIsDownTransition(Flags) ( KeyStateIsDown(Flags) && !KeyStateIsPrevDown(Flags) )
  96.  
  97.  
  98. #define COUNT_VKEYS     256
  99.  
  100.  
  101. /*        @doc    EXTERNAL DRIVERS
  102.         @type   KEY_STATE       | Array of virtual key states.
  103.  
  104. */
  105. typedef UINT8   KEY_STATE[COUNT_VKEYS];
  106.  
  107.  
  108.  
  109.  
  110. //
  111. // KeyboardDriverGetDeviceInfo query capability definitions
  112. //
  113.  
  114.  
  115. /*        @doc    EXTERNAL DRIVERS
  116.         @const    ULONG | KBDI_VKEY_TO_UNICODE_INFO_ID |
  117.  
  118. Id for <f KeybdDriverGetInfo> to get Unicode conversion info.
  119.  
  120. @xref
  121.     <tab><f KeybdDriverGetInfo><nl>
  122.     <tab><t KBDI_VKEY_TO_UNICODE_INFO><nl>
  123.     <tab><f KeybdDriverVKeyToUnicode>
  124.  
  125. */
  126. #define KBDI_VKEY_TO_UNICODE_INFO_ID    0
  127.  
  128.  
  129. /*      @doc    EXTERNAL DRIVERS KEYBD_DRIVER
  130.         @struct    KBDI_VKEY_TO_UNICODE_INFO |
  131.  
  132. Info required to set up for Unicode conversion.
  133.  
  134. @xref
  135.     <tab><f KeybdDriverGetInfo><nl>
  136.     <tab><c KBDI_VKEY_TO_UNICODE_INFO_ID><nl>
  137.     <tab><f KeybdDriverVKeyToUnicode><nl>
  138.     <tab><t TO_UNICODE_STATE>
  139.  
  140. @comm cbToUnicodeState is the number of bytes necessary to store the
  141. driver specific state which is required to generate characters from a
  142. virtual key.  For example, a French keyboard driver may need to remember
  143. that an accent key was previously pressed in order to decide on a specific
  144. Unicode character to generate for a virtual key.  This value may be 0 if
  145. no other state besides <t KEY_STATE> is required to generate characters,
  146. e.g., English keyboard drivers.
  147.  
  148. @comm cMaxToUnicodeCharacters is the maximum number of characters that may
  149. be generated by a call to KeybdDriverVKeyToUnicode.  For example, if a
  150. user presses the '^' key and then the 'b' key, a French keyboard driver
  151. would generate the two characters, '^' 'b', when the second key is
  152. pressed.  Note that this is not the count of bytes required to store the
  153. characters, it is just the number of characters.
  154.  
  155. */
  156. struct KBDI_VKEY_TO_UNICODE_INFO
  157.     {
  158.     UINT32  cbToUnicodeState;                // @FIELD     Count of bytes required
  159.                                             //            for state info for Unicode
  160.                                             //            character generation.
  161.     UINT32  cMaxToUnicodeCharacters;        // @FIELD    Maximum number of characters
  162.                                             //            generated for a single virtual key.
  163.     };
  164.  
  165.  
  166.  
  167.  
  168. /*        @doc    EXTERNAL DRIVERS
  169.         @const    ULONG | KBDI_AUTOREPEAT_INFO_ID |
  170.  
  171. Id for <f KeybdDriverGetInfo> to get keyboard auto-repeat info.
  172.  
  173. @xref
  174.     <tab><f KeybdDriverGetInfo><nl>
  175.     <tab><t KBDI_AUTOREPEAT_INFO><nl>
  176.     <tab><c KBDI_AUTOREPEAT_SELECTIONS_INFO_ID>
  177.  
  178. */
  179. #define KBDI_AUTOREPEAT_INFO_ID    1
  180.  
  181.  
  182.  
  183. /*      @doc    EXTERNAL DRIVERS
  184.         @struct    KBDI_AUTOREPEAT_INFO |
  185.  
  186. Info about the keyboard autorepeat capabilities and settings.
  187.  
  188. @xref
  189.     <tab><f KeybdDriverGetInfo><nl>
  190.     <tab><c KBDI_AUTOREPEAT_INFO_ID><nl>
  191.     <tab><c KBDI_AUTOREPEAT_SELECTIONS_INFO_ID>
  192.  
  193. @comm cInitialDelaysSelectable gives the number of initial delays which
  194. may be set.  Query again using <c KBDI_AUTOREPEAT_SELECTIONS_INFO_ID> to
  195. get the actual values available.
  196.  
  197. @comm cRepeatRatesSelectable is similar to cInitialDelaysSelectable except
  198. that it gives the number of repeat rates available.
  199.  
  200. */
  201.  
  202. struct KBDI_AUTOREPEAT_INFO
  203.     {
  204.     INT32    CurrentInitialDelay;        // @FIELD    Current initial delay in milliseconds.
  205.     INT32    CurrentRepeatRate;            // @FIELD    Current repeat rate in keys per second.
  206.     INT32    cInitialDelaysSelectable;    // @FIELD    Number of initial delays selectable.
  207.     INT32    cRepeatRatesSelectable;        // @FIELD    Number of repeat rates supported.
  208.     };
  209.  
  210.  
  211. /*        @doc    EXTERNAL DRIVERS
  212.         @const    ULONG | KBDI_AUTOREPEAT_SELECTIONS_INFO_ID |
  213.  
  214. Id for <f KeybdDriverGetInfo> to get keyboard auto-repeat selections info.
  215.  
  216. @xref
  217.     <tab><f KeybdDriverGetInfo><nl>
  218.     <tab><c KBDI_AUTOREPEAT_INFO_ID><nl>
  219.     <tab><t KBDI_AUTOREPEAT_INFO><nl>
  220.  
  221. @comm When <f KeybdDriverGetInfo> is called with this value, the lpOutput
  222. parameter should be a pointer to an array of INT32's to hold the selection
  223. info.  The initial delays will be put at the beginning of the array
  224. followed by the repeat rate selections.  The number of initial delay
  225. values is determined by calling <f KeybdDriverGetInfo> using <c
  226. KBDI_AUTOREPEAT_INFO_ID> and looking at the returned
  227. cInitialDelaysSelectable field.  If this value is -1, there will be two
  228. (2) values, the min and max and the initial delay may be set to any value
  229. in this range.  This value may be 0 if the initial delay is not settable.
  230. Similarly, if cRepeatRatesSelectable is 0, there will be no repeat rate
  231. information.  If it is -1, there will be two (2) values, the min and max.
  232.  
  233. Initial delay values are in milliseconds.  Repeat rates are in keys per
  234. second.
  235.  
  236. */
  237. #define KBDI_AUTOREPEAT_SELECTIONS_INFO_ID    2
  238.  
  239. // INTERNATIONAL
  240. #define KBDI_KEYBOARD_STATUS_ID 3
  241.  
  242.  
  243. #define KBDI_KEYBOARD_PRESENT    0x0001    
  244. #define KBDI_KEYBOARD_ENABLED    0x0002
  245. #define KBDI_KEYBOARD_ENTER_ESC    0x0004
  246. #define KBDI_KEYBOARD_ALPHA_NUM    0x0008
  247.  
  248.  
  249. // INTERNATIONAL
  250.  
  251. #ifdef __cplusplus
  252. }
  253. #endif
  254.  
  255.  
  256.  
  257. #endif
  258.  
  259.  
  260.