keyd.inc 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. {
  2. Free Pascal port of the OpenPTC C++ library.
  3. Copyright (C) 2001-2003 Nikolay Nikolov ([email protected])
  4. Original C++ version by Glenn Fiedler ([email protected])
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. }
  17. Type
  18. TPTCKey=Class(TObject)
  19. Private
  20. m_code : Integer;
  21. m_unicode : Integer;
  22. m_alt : Boolean;
  23. m_shift : Boolean;
  24. m_control : Boolean;
  25. m_press : Boolean;
  26. Function GetRelease : Boolean;
  27. Public
  28. Constructor Create;
  29. Constructor Create(_code : Integer);
  30. Constructor Create(_code, _unicode : Integer);
  31. Constructor Create(_code, _unicode : Integer; _press : Boolean);
  32. Constructor Create(_code : Integer; _alt, _shift, _control : Boolean);
  33. Constructor Create(_code : Integer; _alt, _shift, _control, _press : Boolean);
  34. Constructor Create(_code, _unicode : Integer;
  35. _alt, _shift, _control : Boolean);
  36. Constructor Create(_code, _unicode : Integer;
  37. _alt, _shift, _control, _press : Boolean);
  38. Constructor Create(Const key : TPTCKey);
  39. Destructor Destroy; Override;
  40. Procedure Assign(Const key : TPTCKey);
  41. Function Equals(Const key : TPTCKey) : Boolean;
  42. Property code : Integer read m_code;
  43. Property unicode : Integer read m_unicode;
  44. Property alt : Boolean read m_alt;
  45. Property shift : Boolean read m_shift;
  46. Property control : Boolean read m_control;
  47. Property press : Boolean read m_press;
  48. Property release : Boolean read GetRelease;
  49. End;
  50. Const
  51. PTCKEY_UNDEFINED = $00;
  52. PTCKEY_CANCEL = $03;
  53. PTCKEY_BACKSPACE = $08; {'\b'}
  54. PTCKEY_TAB = $09; {'\t'}
  55. PTCKEY_ENTER = $0A; {'\n'}
  56. PTCKEY_CLEAR = $0C;
  57. PTCKEY_SHIFT = $10;
  58. PTCKEY_CONTROL = $11;
  59. PTCKEY_ALT = $12;
  60. PTCKEY_PAUSE = $13;
  61. PTCKEY_CAPSLOCK = $14;
  62. PTCKEY_KANA = $15;
  63. PTCKEY_FINAL = $18;
  64. PTCKEY_KANJI = $19;
  65. PTCKEY_ESCAPE = $1B;
  66. PTCKEY_CONVERT = $1C;
  67. PTCKEY_NONCONVERT = $1D;
  68. PTCKEY_ACCEPT = $1E;
  69. PTCKEY_MODECHANGE = $1F;
  70. PTCKEY_SPACE = $20;
  71. PTCKEY_PAGEUP = $21;
  72. PTCKEY_PAGEDOWN = $22;
  73. PTCKEY_END = $23;
  74. PTCKEY_HOME = $24;
  75. PTCKEY_LEFT = $25;
  76. PTCKEY_UP = $26;
  77. PTCKEY_RIGHT = $27;
  78. PTCKEY_DOWN = $28;
  79. PTCKEY_COMMA = $2C; {','}
  80. PTCKEY_PERIOD = $2E; {'.'}
  81. PTCKEY_SLASH = $2F; {'/'}
  82. PTCKEY_ZERO = $30;
  83. PTCKEY_ONE = $31;
  84. PTCKEY_TWO = $32;
  85. PTCKEY_THREE = $33;
  86. PTCKEY_FOUR = $34;
  87. PTCKEY_FIVE = $35;
  88. PTCKEY_SIX = $36;
  89. PTCKEY_SEVEN = $37;
  90. PTCKEY_EIGHT = $38;
  91. PTCKEY_NINE = $39;
  92. PTCKEY_SEMICOLON = $3B; {';'}
  93. PTCKEY_EQUALS = $3D; {'='}
  94. PTCKEY_A = $41;
  95. PTCKEY_B = $42;
  96. PTCKEY_C = $43;
  97. PTCKEY_D = $44;
  98. PTCKEY_E = $45;
  99. PTCKEY_F = $46;
  100. PTCKEY_G = $47;
  101. PTCKEY_H = $48;
  102. PTCKEY_I = $49;
  103. PTCKEY_J = $4A;
  104. PTCKEY_K = $4B;
  105. PTCKEY_L = $4C;
  106. PTCKEY_M = $4D;
  107. PTCKEY_N = $4E;
  108. PTCKEY_O = $4F;
  109. PTCKEY_P = $50;
  110. PTCKEY_Q = $51;
  111. PTCKEY_R = $52;
  112. PTCKEY_S = $53;
  113. PTCKEY_T = $54;
  114. PTCKEY_U = $55;
  115. PTCKEY_V = $56;
  116. PTCKEY_W = $57;
  117. PTCKEY_X = $58;
  118. PTCKEY_Y = $59;
  119. PTCKEY_Z = $5A;
  120. PTCKEY_OPENBRACKET = $5B; {'['}
  121. PTCKEY_BACKSLASH = $5C; {'\'}
  122. PTCKEY_CLOSEBRACKET = $5D; {']'}
  123. PTCKEY_NUMPAD0 = $60;
  124. PTCKEY_NUMPAD1 = $61;
  125. PTCKEY_NUMPAD2 = $62;
  126. PTCKEY_NUMPAD3 = $63;
  127. PTCKEY_NUMPAD4 = $64;
  128. PTCKEY_NUMPAD5 = $65;
  129. PTCKEY_NUMPAD6 = $66;
  130. PTCKEY_NUMPAD7 = $67;
  131. PTCKEY_NUMPAD8 = $68;
  132. PTCKEY_NUMPAD9 = $69;
  133. PTCKEY_MULTIPLY = $6A; {numpad '*'}
  134. PTCKEY_ADD = $6B; {numpad '+'}
  135. PTCKEY_SEPARATOR = $6C;
  136. PTCKEY_SUBTRACT = $6D; {numpad '-'}
  137. PTCKEY_DECIMAL = $6E; {numpad '.'}
  138. PTCKEY_DIVIDE = $6F; {numpad '/'}
  139. PTCKEY_F1 = $70;
  140. PTCKEY_F2 = $71;
  141. PTCKEY_F3 = $72;
  142. PTCKEY_F4 = $73;
  143. PTCKEY_F5 = $74;
  144. PTCKEY_F6 = $75;
  145. PTCKEY_F7 = $76;
  146. PTCKEY_F8 = $77;
  147. PTCKEY_F9 = $78;
  148. PTCKEY_F10 = $79;
  149. PTCKEY_F11 = $7A;
  150. PTCKEY_F12 = $7B;
  151. PTCKEY_DELETE = $7F;
  152. PTCKEY_NUMLOCK = $90;
  153. PTCKEY_SCROLLLOCK = $91;
  154. PTCKEY_PRINTSCREEN = $9A;
  155. PTCKEY_INSERT = $9B;
  156. PTCKEY_HELP = $9C;
  157. PTCKEY_META = $9D;
  158. PTCKEY_BACKQUOTE = $C0;
  159. PTCKEY_QUOTE = $DE;
  160. (* TPTCKeyCode = (
  161. PTCKEY_UNDEFINED := $00,
  162. PTCKEY_CANCEL := $03,
  163. PTCKEY_BACKSPACE := $08, {'\b'}
  164. PTCKEY_TAB := $09, {'\t'}
  165. PTCKEY_ENTER := $0A, {'\n'}
  166. PTCKEY_CLEAR := $0C,
  167. PTCKEY_SHIFT := $10,
  168. PTCKEY_CONTROL := $11,
  169. PTCKEY_ALT := $12,
  170. PTCKEY_PAUSE := $13,
  171. PTCKEY_CAPSLOCK := $14,
  172. PTCKEY_KANA := $15,
  173. PTCKEY_FINAL := $18,
  174. PTCKEY_KANJI := $19,
  175. PTCKEY_ESCAPE := $1B,
  176. PTCKEY_CONVERT := $1C,
  177. PTCKEY_NONCONVERT := $1D,
  178. PTCKEY_ACCEPT := $1E,
  179. PTCKEY_MODECHANGE := $1F,
  180. PTCKEY_SPACE := $20,
  181. PTCKEY_PAGEUP := $21,
  182. PTCKEY_PAGEDOWN := $22,
  183. PTCKEY_END := $23,
  184. PTCKEY_HOME := $24,
  185. PTCKEY_LEFT := $25,
  186. PTCKEY_UP := $26,
  187. PTCKEY_RIGHT := $27,
  188. PTCKEY_DOWN := $28,
  189. PTCKEY_COMMA := $2C, {','}
  190. PTCKEY_PERIOD := $2E, {'.'}
  191. PTCKEY_SLASH := $2F, {'/'}
  192. PTCKEY_ZERO := $30,
  193. PTCKEY_ONE := $31,
  194. PTCKEY_TWO := $32,
  195. PTCKEY_THREE := $33,
  196. PTCKEY_FOUR := $34,
  197. PTCKEY_FIVE := $35,
  198. PTCKEY_SIX := $36,
  199. PTCKEY_SEVEN := $37,
  200. PTCKEY_EIGHT := $38,
  201. PTCKEY_NINE := $39,
  202. PTCKEY_SEMICOLON := $3B, {';'}
  203. PTCKEY_EQUALS := $3D, {'='}
  204. PTCKEY_A := $41,
  205. PTCKEY_B := $42,
  206. PTCKEY_C := $43,
  207. PTCKEY_D := $44,
  208. PTCKEY_E := $45,
  209. PTCKEY_F := $46,
  210. PTCKEY_G := $47,
  211. PTCKEY_H := $48,
  212. PTCKEY_I := $49,
  213. PTCKEY_J := $4A,
  214. PTCKEY_K := $4B,
  215. PTCKEY_L := $4C,
  216. PTCKEY_M := $4D,
  217. PTCKEY_N := $4E,
  218. PTCKEY_O := $4F,
  219. PTCKEY_P := $50,
  220. PTCKEY_Q := $51,
  221. PTCKEY_R := $52,
  222. PTCKEY_S := $53,
  223. PTCKEY_T := $54,
  224. PTCKEY_U := $55,
  225. PTCKEY_V := $56,
  226. PTCKEY_W := $57,
  227. PTCKEY_X := $58,
  228. PTCKEY_Y := $59,
  229. PTCKEY_Z := $5A,
  230. PTCKEY_OPENBRACKET := $5B, {'['}
  231. PTCKEY_BACKSLASH := $5C, {'\'}
  232. PTCKEY_CLOSEBRACKET := $5D, {']'}
  233. PTCKEY_NUMPAD0 := $60,
  234. PTCKEY_NUMPAD1 := $61,
  235. PTCKEY_NUMPAD2 := $62,
  236. PTCKEY_NUMPAD3 := $63,
  237. PTCKEY_NUMPAD4 := $64,
  238. PTCKEY_NUMPAD5 := $65,
  239. PTCKEY_NUMPAD6 := $66,
  240. PTCKEY_NUMPAD7 := $67,
  241. PTCKEY_NUMPAD8 := $68,
  242. PTCKEY_NUMPAD9 := $69,
  243. PTCKEY_MULTIPLY := $6A, {numpad '*'}
  244. PTCKEY_ADD := $6B, {numpad '+'}
  245. PTCKEY_SEPARATOR := $6C,
  246. PTCKEY_SUBTRACT := $6D, {numpad '-'}
  247. PTCKEY_DECIMAL := $6E, {numpad '.'}
  248. PTCKEY_DIVIDE := $6F, {numpad '/'}
  249. PTCKEY_F1 := $70,
  250. PTCKEY_F2 := $71,
  251. PTCKEY_F3 := $72,
  252. PTCKEY_F4 := $73,
  253. PTCKEY_F5 := $74,
  254. PTCKEY_F6 := $75,
  255. PTCKEY_F7 := $76,
  256. PTCKEY_F8 := $77,
  257. PTCKEY_F9 := $78,
  258. PTCKEY_F10 := $79,
  259. PTCKEY_F11 := $7A,
  260. PTCKEY_F12 := $7B,
  261. PTCKEY_DELETE := $7F,
  262. PTCKEY_NUMLOCK := $90,
  263. PTCKEY_SCROLLLOCK := $91,
  264. PTCKEY_PRINTSCREEN := $9A,
  265. PTCKEY_INSERT := $9B,
  266. PTCKEY_HELP := $9C,
  267. PTCKEY_META := $9D,
  268. PTCKEY_BACKQUOTE := $C0,
  269. PTCKEY_QUOTE := $DE
  270. );*)