Panda3D

graphicsWindowInputDevice.I

00001 // Filename: graphicsWindowInputDevice.I
00002 // Created by:  drose (24May00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 ////////////////////////////////////////////////////////////////////
00016 //     Function: GraphicsWindowInputDevice::Default Constructor
00017 //       Access: Public
00018 //  Description:
00019 ////////////////////////////////////////////////////////////////////
00020 INLINE GraphicsWindowInputDevice::
00021 GraphicsWindowInputDevice() {
00022   LightMutexHolder holder(_lock);
00023   _flags = 0;
00024 }
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //     Function: GraphicsWindowInputDevice::get_name
00028 //       Access: Public
00029 //  Description:
00030 ////////////////////////////////////////////////////////////////////
00031 INLINE string GraphicsWindowInputDevice::
00032 get_name() const {
00033   LightMutexHolder holder(_lock);
00034   return _name;
00035 }
00036 
00037 ////////////////////////////////////////////////////////////////////
00038 //     Function: GraphicsWindowInputDevice::has_pointer
00039 //       Access: Public
00040 //  Description:
00041 ////////////////////////////////////////////////////////////////////
00042 INLINE bool GraphicsWindowInputDevice::
00043 has_pointer() const {
00044   LightMutexHolder holder(_lock);
00045   return ((_flags & IDF_has_pointer) != 0);
00046 }
00047 
00048 ////////////////////////////////////////////////////////////////////
00049 //     Function: GraphicsWindowInputDevice::has_keyboard
00050 //       Access: Public
00051 //  Description:
00052 ////////////////////////////////////////////////////////////////////
00053 INLINE bool GraphicsWindowInputDevice::
00054 has_keyboard() const {
00055   LightMutexHolder holder(_lock);
00056   return ((_flags & IDF_has_keyboard) != 0);
00057 }
00058 
00059 ////////////////////////////////////////////////////////////////////
00060 //     Function: GraphicsWindowInputDevice::get_pointer
00061 //       Access: Public
00062 //  Description: Returns the MouseData associated with the input
00063 //               device's pointer.
00064 ////////////////////////////////////////////////////////////////////
00065 INLINE  MouseData GraphicsWindowInputDevice::
00066 get_pointer() const {
00067   LightMutexHolder holder(_lock);
00068   return _mouse_data;
00069 }
00070 
00071 ////////////////////////////////////////////////////////////////////
00072 //     Function: GraphicsWindowInputDevice::get_raw_pointer
00073 //       Access: Public
00074 //  Description: Returns the MouseData associated with the input
00075 //               device's pointer, in raw form (ie, prior to any
00076 //               pointer_mode interpretation).
00077 ////////////////////////////////////////////////////////////////////
00078 INLINE  MouseData GraphicsWindowInputDevice::
00079 get_raw_pointer() const {
00080   LightMutexHolder holder(_lock);
00081   return _true_mouse_data;
00082 }
00083 
00084 ////////////////////////////////////////////////////////////////////
00085 //     Function: GraphicsWindowInputDevice::set_device_index
00086 //       Access: Public
00087 //  Description: Set the device index.  This is reported in pointer 
00088 //               events.  The device index will be equal to the position
00089 //               of the GraphicsWindowInputDevice in the window's list.
00090 ////////////////////////////////////////////////////////////////////
00091 INLINE void GraphicsWindowInputDevice::
00092 set_device_index(int index) {
00093   LightMutexHolder holder(_lock);
00094   _device_index = index;
00095 }
00096 
00097 ////////////////////////////////////////////////////////////////////
00098 //     Function: GraphicsWindowInputDevice::enable_pointer_events
00099 //       Access: Public
00100 //  Description: Enables the generation of mouse-movement events.
00101 ////////////////////////////////////////////////////////////////////
00102 INLINE void GraphicsWindowInputDevice::
00103 enable_pointer_events() {
00104   LightMutexHolder holder(_lock);
00105   _enable_pointer_events = true;
00106 }
00107 
00108 ////////////////////////////////////////////////////////////////////
00109 //     Function: GraphicsWindowInputDevice::disable_pointer_events
00110 //       Access: Public
00111 //  Description: Disables the generation of mouse-movement events.
00112 ////////////////////////////////////////////////////////////////////
00113 INLINE void GraphicsWindowInputDevice::
00114 disable_pointer_events() {
00115   LightMutexHolder holder(_lock);
00116   _enable_pointer_events = false;
00117   _pointer_events.clear();
00118 }
00119 
00120 ////////////////////////////////////////////////////////////////////
00121 //     Function: GraphicsWindowInputDevice::set_pointer_in_window
00122 //       Access: Public
00123 //  Description: To be called by a particular kind of GraphicsWindow
00124 //               to indicate that the pointer is within the window, at
00125 //               the given pixel coordinates.
00126 ////////////////////////////////////////////////////////////////////
00127 INLINE void GraphicsWindowInputDevice::
00128 set_pointer_in_window(int x, int y, double time) {
00129  // mutex is handled in set pointer .. convience function
00130   set_pointer(true, x, y, time);
00131 }
00132 
00133 ////////////////////////////////////////////////////////////////////
00134 //     Function: GraphicsWindowInputDevice::set_pointer_out_of_window
00135 //       Access: Public
00136 //  Description: To be called by a particular kind of GraphicsWindow
00137 //               to indicate that the pointer is no longer within the
00138 //               window.
00139 ////////////////////////////////////////////////////////////////////
00140 INLINE void GraphicsWindowInputDevice::
00141 set_pointer_out_of_window(double time) {
00142  // mutex is handled in set pointer .. convience function
00143   set_pointer(false, _mouse_data._xpos, _mouse_data._ypos, time);
00144 }
00145 
00146 ////////////////////////////////////////////////////////////////////
00147 //     Function: GraphicsWindowInputDevice::operator ==
00148 //       Access: Public
00149 //  Description:
00150 ////////////////////////////////////////////////////////////////////
00151 INLINE bool GraphicsWindowInputDevice::
00152 operator == (const GraphicsWindowInputDevice &) const {
00153   return true;
00154 }
00155 
00156 ////////////////////////////////////////////////////////////////////
00157 //     Function: GraphicsWindowInputDevice::operator !=
00158 //       Access: Public
00159 //  Description:
00160 ////////////////////////////////////////////////////////////////////
00161 INLINE bool GraphicsWindowInputDevice::
00162 operator != (const GraphicsWindowInputDevice &) const {
00163   return false;
00164 }
00165 
00166 ////////////////////////////////////////////////////////////////////
00167 //     Function: GraphicsWindowInputDevice::operator <
00168 //       Access: Public
00169 //  Description:
00170 ////////////////////////////////////////////////////////////////////
00171 INLINE bool GraphicsWindowInputDevice::
00172 operator < (const GraphicsWindowInputDevice &) const {
00173   return false;
00174 }
 All Classes Functions Variables Enumerations