keyeventi.inc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. Function TPTCKeyEvent.GetType : TPTCEventType;
  18. Begin
  19. Result := PTCKeyEvent;
  20. End;
  21. Constructor TPTCKeyEvent.Create;
  22. Begin
  23. FCode := Integer(PTCKEY_UNDEFINED);
  24. FUnicode := -1;
  25. FAlt := False;
  26. FShift := False;
  27. FControl := False;
  28. FPress := True;
  29. End;
  30. Constructor TPTCKeyEvent.Create(ACode : Integer);
  31. Begin
  32. FCode := ACode;
  33. FUnicode := -1;
  34. FAlt := False;
  35. FShift := False;
  36. FControl := False;
  37. FPress := True;
  38. End;
  39. Constructor TPTCKeyEvent.Create(ACode, AUnicode : Integer);
  40. Begin
  41. FCode := ACode;
  42. FUnicode := AUnicode;
  43. FAlt := False;
  44. FShift := False;
  45. FControl := False;
  46. FPress := True;
  47. End;
  48. Constructor TPTCKeyEvent.Create(ACode, AUnicode : Integer; APress : Boolean);
  49. Begin
  50. FCode := ACode;
  51. FUnicode := AUnicode;
  52. FAlt := False;
  53. FShift := False;
  54. FControl := False;
  55. FPress := APress;
  56. End;
  57. Constructor TPTCKeyEvent.Create(ACode : Integer; AAlt, AShift, AControl : Boolean);
  58. Begin
  59. FCode := ACode;
  60. FUnicode := -1;
  61. FAlt := AAlt;
  62. FShift := AShift;
  63. FControl := AControl;
  64. FPress := True;
  65. End;
  66. Constructor TPTCKeyEvent.Create(ACode : Integer; AAlt, AShift, AControl, APress : Boolean);
  67. Begin
  68. FCode := ACode;
  69. FUnicode := -1;
  70. FAlt := AAlt;
  71. FShift := AShift;
  72. FControl := AControl;
  73. FPress := APress;
  74. End;
  75. Constructor TPTCKeyEvent.Create(ACode, AUnicode : Integer; AAlt, AShift, AControl : Boolean);
  76. Begin
  77. FCode := ACode;
  78. FUnicode := AUnicode;
  79. FAlt := AAlt;
  80. FShift := AShift;
  81. FControl := AControl;
  82. FPress := True;
  83. End;
  84. Constructor TPTCKeyEvent.Create(ACode, AUnicode : Integer;
  85. AAlt, AShift, AControl, APress : Boolean);
  86. Begin
  87. FCode := ACode;
  88. FUnicode := AUnicode;
  89. FAlt := AAlt;
  90. FShift := AShift;
  91. FControl := AControl;
  92. FPress := APress;
  93. End;
  94. Constructor TPTCKeyEvent.Create(Const AKey : TPTCKeyEvent);
  95. Begin
  96. FCode := AKey.Code;
  97. FUnicode := AKey.Unicode;
  98. FAlt := AKey.Alt;
  99. FShift := AKey.Shift;
  100. FControl := AKey.Control;
  101. FPress := AKey.Press;
  102. End;
  103. Procedure TPTCKeyEvent.Assign(Const AKey : TPTCKeyEvent);
  104. Begin
  105. FCode := AKey.Code;
  106. FUnicode := AKey.Unicode;
  107. FAlt := AKey.Alt;
  108. FShift := AKey.Shift;
  109. FControl := AKey.Control;
  110. FPress := AKey.Press;
  111. End;
  112. Function TPTCKeyEvent.Equals(Const AKey : TPTCKeyEvent) : Boolean;
  113. Begin
  114. Result := (FCode = AKey.FCode) And
  115. (FUnicode = AKey.FUnicode) And
  116. (FAlt = AKey.FAlt) And
  117. (FShift = AKey.FShift) And
  118. (FControl = AKey.FControl) And
  119. (FPress = AKey.FPress);
  120. End;
  121. Function TPTCKeyEvent.GetRelease : Boolean;
  122. Begin
  123. Result := Not FPress;
  124. End;