keyi.inc 3.3 KB

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