keyi.inc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. m_code := Integer(PTCKEY_UNDEFINED);
  24. m_unicode := -1;
  25. m_alt := False;
  26. m_shift := False;
  27. m_control := False;
  28. m_press := True;
  29. End;
  30. Constructor TPTCKeyEvent.Create(_code : Integer);
  31. Begin
  32. m_code := _code;
  33. m_unicode := -1;
  34. m_alt := False;
  35. m_shift := False;
  36. m_control := False;
  37. m_press := True;
  38. End;
  39. Constructor TPTCKeyEvent.Create(_code, _unicode : Integer);
  40. Begin
  41. m_code := _code;
  42. m_unicode := _unicode;
  43. m_alt := False;
  44. m_shift := False;
  45. m_control := False;
  46. m_press := True;
  47. End;
  48. Constructor TPTCKeyEvent.Create(_code, _unicode : Integer; _press : Boolean);
  49. Begin
  50. m_code := _code;
  51. m_unicode := _unicode;
  52. m_alt := False;
  53. m_shift := False;
  54. m_control := False;
  55. m_press := _press;
  56. End;
  57. Constructor TPTCKeyEvent.Create(_code : Integer; _alt, _shift, _control : Boolean);
  58. Begin
  59. m_code := _code;
  60. m_unicode := -1;
  61. m_alt := _alt;
  62. m_shift := _shift;
  63. m_control := _control;
  64. m_press := True;
  65. End;
  66. Constructor TPTCKeyEvent.Create(_code : Integer; _alt, _shift, _control, _press : Boolean);
  67. Begin
  68. m_code := _code;
  69. m_unicode := -1;
  70. m_alt := _alt;
  71. m_shift := _shift;
  72. m_control := _control;
  73. m_press := _press;
  74. End;
  75. Constructor TPTCKeyEvent.Create(_code, _unicode : Integer; _alt, _shift, _control : Boolean);
  76. Begin
  77. m_code := _code;
  78. m_unicode := _unicode;
  79. m_alt := _alt;
  80. m_shift := _shift;
  81. m_control := _control;
  82. m_press := True;
  83. End;
  84. Constructor TPTCKeyEvent.Create(_code, _unicode : Integer;
  85. _alt, _shift, _control, _press : Boolean);
  86. Begin
  87. m_code := _code;
  88. m_unicode := _unicode;
  89. m_alt := _alt;
  90. m_shift := _shift;
  91. m_control := _control;
  92. m_press := _press;
  93. End;
  94. Constructor TPTCKeyEvent.Create(Const key : TPTCKeyEvent);
  95. Begin
  96. ASSign(key);
  97. End;
  98. Destructor TPTCKeyEvent.Destroy;
  99. Begin
  100. Inherited Destroy;
  101. End;
  102. Procedure TPTCKeyEvent.Assign(Const key : TPTCKeyEvent);
  103. Begin
  104. If Self = key Then
  105. Raise TPTCError.Create('self assignment is not allowed');
  106. m_code := key.code;
  107. m_unicode := key.unicode;
  108. m_alt := key.alt;
  109. m_shift := key.shift;
  110. m_control := key.control;
  111. m_press := key.press;
  112. End;
  113. Function TPTCKeyEvent.Equals(Const key : TPTCKeyEvent) : Boolean;
  114. Begin
  115. Equals := (m_code = key.m_code) And (m_unicode = key.m_unicode) And
  116. (m_alt = key.m_alt) And (m_shift = key.m_shift) And
  117. (m_control = key.m_control) And (m_press = key.m_press);
  118. End;
  119. Function TPTCKeyEvent.GetRelease : Boolean;
  120. Begin
  121. GetRelease := Not m_press;
  122. End;