pointerEvent.I 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. // Filename: pointerEvent.I
  2. // Created by: jyelon (20Sep2007)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. ////////////////////////////////////////////////////////////////////
  15. // Function: PointerEvent::Default Constructor
  16. // Access: Public
  17. // Description:
  18. ////////////////////////////////////////////////////////////////////
  19. INLINE PointerEvent::
  20. PointerEvent() :
  21. _in_window(false),
  22. _xpos(0),
  23. _ypos(0),
  24. _dx(0),
  25. _dy(0),
  26. _length(0.0),
  27. _direction(0.0),
  28. _rotation(0.0),
  29. _sequence(0),
  30. _time(0.0)
  31. {
  32. }
  33. ////////////////////////////////////////////////////////////////////
  34. // Function: PointerEvent::Copy Constructor
  35. // Access: Public
  36. // Description:
  37. ////////////////////////////////////////////////////////////////////
  38. INLINE PointerEvent::
  39. PointerEvent(const PointerEvent &copy) :
  40. _in_window(copy._in_window),
  41. _xpos(copy._xpos),
  42. _ypos(copy._ypos),
  43. _dx(copy._dx),
  44. _dy(copy._dy),
  45. _length(copy._length),
  46. _direction(copy._direction),
  47. _rotation(copy._rotation),
  48. _sequence(copy._sequence),
  49. _time(copy._time)
  50. {
  51. }
  52. ////////////////////////////////////////////////////////////////////
  53. // Function: PointerEvent::Copy Assignment Operator
  54. // Access: Public
  55. // Description:
  56. ////////////////////////////////////////////////////////////////////
  57. INLINE void PointerEvent::
  58. operator = (const PointerEvent &copy) {
  59. _in_window = copy._in_window;
  60. _xpos = copy._xpos;
  61. _ypos = copy._ypos;
  62. _dx = copy._dx;
  63. _dy = copy._dy;
  64. _sequence = copy._sequence;
  65. _length = copy._length;
  66. _direction = copy._direction;
  67. _rotation = copy._rotation;
  68. _time = copy._time;
  69. }
  70. ////////////////////////////////////////////////////////////////////
  71. // Function: PointerEvent::Equality Operator
  72. // Access: Public
  73. // Description: The equality operator does not consider time
  74. // significant.
  75. ////////////////////////////////////////////////////////////////////
  76. INLINE bool PointerEvent::
  77. operator == (const PointerEvent &other) const {
  78. return (_in_window == other._in_window &&
  79. _xpos == other._xpos &&
  80. _ypos == other._ypos &&
  81. _dx == other._dx &&
  82. _dy == other._dy &&
  83. _sequence == other._sequence &&
  84. _length == other._length &&
  85. _direction == other._direction &&
  86. _rotation == other._rotation);
  87. }
  88. ////////////////////////////////////////////////////////////////////
  89. // Function: PointerEvent::Inequality Operator
  90. // Access: Public
  91. // Description:
  92. ////////////////////////////////////////////////////////////////////
  93. INLINE bool PointerEvent::
  94. operator != (const PointerEvent &other) const {
  95. return !operator == (other);
  96. }
  97. ////////////////////////////////////////////////////////////////////
  98. // Function: PointerEvent::Ordering Operator
  99. // Access: Public
  100. // Description:
  101. ////////////////////////////////////////////////////////////////////
  102. INLINE bool PointerEvent::
  103. operator < (const PointerEvent &other) const {
  104. if (_sequence != other._sequence) {
  105. return _sequence < other._sequence;
  106. }
  107. if (_xpos != other._xpos) {
  108. return _xpos < other._xpos;
  109. }
  110. if (_ypos != other._ypos) {
  111. return _ypos < other._ypos;
  112. }
  113. if (_dx != other._dx) {
  114. return _dx < other._dx;
  115. }
  116. if (_dy != other._dy) {
  117. return _dy < other._dy;
  118. }
  119. if (_length != other._length) {
  120. return _length < other._length;
  121. }
  122. if (_direction != other._direction) {
  123. return _direction < other._direction;
  124. }
  125. if (_rotation != other._rotation) {
  126. return _rotation < other._rotation;
  127. }
  128. return _in_window < other._in_window;
  129. }