graphicsWindowInputDevice.I 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. // Filename: graphicsWindowInputDevice.I
  2. // Created by: drose (24May00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. ////////////////////////////////////////////////////////////////////
  19. // Function: GraphicsWindowInputDevice::Default Constructor
  20. // Access: Public
  21. // Description:
  22. ////////////////////////////////////////////////////////////////////
  23. INLINE GraphicsWindowInputDevice::
  24. GraphicsWindowInputDevice() {
  25. _flags = 0;
  26. }
  27. ////////////////////////////////////////////////////////////////////
  28. // Function: GraphicsWindowInputDevice::get_name
  29. // Access: Public
  30. // Description:
  31. ////////////////////////////////////////////////////////////////////
  32. INLINE string GraphicsWindowInputDevice::
  33. get_name() const {
  34. return _name;
  35. }
  36. ////////////////////////////////////////////////////////////////////
  37. // Function: GraphicsWindowInputDevice::has_pointer
  38. // Access: Public
  39. // Description:
  40. ////////////////////////////////////////////////////////////////////
  41. INLINE bool GraphicsWindowInputDevice::
  42. has_pointer() const {
  43. return ((_flags & IDF_has_pointer) != 0);
  44. }
  45. ////////////////////////////////////////////////////////////////////
  46. // Function: GraphicsWindowInputDevice::has_keyboard
  47. // Access: Public
  48. // Description:
  49. ////////////////////////////////////////////////////////////////////
  50. INLINE bool GraphicsWindowInputDevice::
  51. has_keyboard() const {
  52. return ((_flags & IDF_has_keyboard) != 0);
  53. }
  54. ////////////////////////////////////////////////////////////////////
  55. // Function: GraphicsWindowInputDevice::get_pointer
  56. // Access: Public
  57. // Description: Returns the MouseData associated with the input
  58. // device's pointer.
  59. ////////////////////////////////////////////////////////////////////
  60. INLINE const MouseData &GraphicsWindowInputDevice::
  61. get_pointer() const {
  62. return _mouse_data;
  63. }
  64. ////////////////////////////////////////////////////////////////////
  65. // Function: GraphicsWindowInputDevice::get_raw_pointer
  66. // Access: Public
  67. // Description: Returns the MouseData associated with the input
  68. // device's pointer, in raw form (ie, prior to any
  69. // pointer_mode interpretation).
  70. ////////////////////////////////////////////////////////////////////
  71. INLINE const MouseData &GraphicsWindowInputDevice::
  72. get_raw_pointer() const {
  73. return _true_mouse_data;
  74. }
  75. ////////////////////////////////////////////////////////////////////
  76. // Function: GraphicsWindowInputDevice::set_device_index
  77. // Access: Public
  78. // Description: Set the device index. This is reported in pointer
  79. // events. The device index will be equal to the position
  80. // of the GraphicsWindowInputDevice in the window's list.
  81. ////////////////////////////////////////////////////////////////////
  82. INLINE void GraphicsWindowInputDevice::
  83. set_device_index(int index) {
  84. _device_index = index;
  85. }
  86. ////////////////////////////////////////////////////////////////////
  87. // Function: GraphicsWindowInputDevice::enable_pointer_events
  88. // Access: Public
  89. // Description: Enables the generation of mouse-movement events.
  90. ////////////////////////////////////////////////////////////////////
  91. INLINE void GraphicsWindowInputDevice::
  92. enable_pointer_events() {
  93. _enable_pointer_events = true;
  94. }
  95. ////////////////////////////////////////////////////////////////////
  96. // Function: GraphicsWindowInputDevice::disable_pointer_events
  97. // Access: Public
  98. // Description: Disables the generation of mouse-movement events.
  99. ////////////////////////////////////////////////////////////////////
  100. INLINE void GraphicsWindowInputDevice::
  101. disable_pointer_events() {
  102. _enable_pointer_events = false;
  103. _pointer_events.clear();
  104. }
  105. ////////////////////////////////////////////////////////////////////
  106. // Function: GraphicsWindowInputDevice::set_pointer_in_window
  107. // Access: Public
  108. // Description: To be called by a particular kind of GraphicsWindow
  109. // to indicate that the pointer is within the window, at
  110. // the given pixel coordinates.
  111. ////////////////////////////////////////////////////////////////////
  112. INLINE void GraphicsWindowInputDevice::
  113. set_pointer_in_window(int x, int y, double time) {
  114. set_pointer(true, x, y, time);
  115. }
  116. ////////////////////////////////////////////////////////////////////
  117. // Function: GraphicsWindowInputDevice::set_pointer_out_of_window
  118. // Access: Public
  119. // Description: To be called by a particular kind of GraphicsWindow
  120. // to indicate that the pointer is no longer within the
  121. // window.
  122. ////////////////////////////////////////////////////////////////////
  123. INLINE void GraphicsWindowInputDevice::
  124. set_pointer_out_of_window(double time) {
  125. set_pointer(false, _mouse_data._xpos, _mouse_data._ypos, time);
  126. }
  127. ////////////////////////////////////////////////////////////////////
  128. // Function: GraphicsWindowInputDevice::operator ==
  129. // Access: Public
  130. // Description:
  131. ////////////////////////////////////////////////////////////////////
  132. INLINE bool GraphicsWindowInputDevice::
  133. operator == (const GraphicsWindowInputDevice &) const {
  134. return true;
  135. }
  136. ////////////////////////////////////////////////////////////////////
  137. // Function: GraphicsWindowInputDevice::operator !=
  138. // Access: Public
  139. // Description:
  140. ////////////////////////////////////////////////////////////////////
  141. INLINE bool GraphicsWindowInputDevice::
  142. operator != (const GraphicsWindowInputDevice &) const {
  143. return false;
  144. }
  145. ////////////////////////////////////////////////////////////////////
  146. // Function: GraphicsWindowInputDevice::operator <
  147. // Access: Public
  148. // Description:
  149. ////////////////////////////////////////////////////////////////////
  150. INLINE bool GraphicsWindowInputDevice::
  151. operator < (const GraphicsWindowInputDevice &) const {
  152. return false;
  153. }