00001 // Filename: winGraphicsWindow.I 00002 // Created by: drose (20Dec02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: WinGraphicsWindow::handle_keypress 00022 // Access: Private 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE void WinGraphicsWindow:: 00026 handle_keypress(ButtonHandle key, int x, int y) { 00027 _input_devices[0].set_pointer_in_window(x, y); 00028 if (key != ButtonHandle::none()) { 00029 _input_devices[0].button_down(key); 00030 } 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: WinGraphicsWindow::handle_keyresume 00035 // Access: Private 00036 // Description: Indicates we detected a key was already down when the 00037 // focus is restored to the window. Mainly useful for 00038 // tracking the state of modifier keys. 00039 //////////////////////////////////////////////////////////////////// 00040 INLINE void WinGraphicsWindow:: 00041 handle_keyresume(ButtonHandle key) { 00042 if (key != ButtonHandle::none()) { 00043 _input_devices[0].button_resume_down(key); 00044 } 00045 } 00046 00047 //////////////////////////////////////////////////////////////////// 00048 // Function: WinGraphicsWindow::handle_keyrelease 00049 // Access: Private 00050 // Description: 00051 //////////////////////////////////////////////////////////////////// 00052 INLINE void WinGraphicsWindow:: 00053 handle_keyrelease(ButtonHandle key) { 00054 if (key != ButtonHandle::none()) { 00055 _input_devices[0].button_up(key); 00056 } 00057 } 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: WinGraphicsWindow::translate_mouse 00061 // Access: Private 00062 // Description: Translates the mouse pixel coordinate (either x or y) 00063 // as returned by the Windows message to the signed 00064 // number expected by Panda. 00065 //////////////////////////////////////////////////////////////////// 00066 INLINE int WinGraphicsWindow:: 00067 translate_mouse(int pos) const { 00068 if (pos & 0x8000) { 00069 pos -= 0x10000; 00070 } 00071 return pos; 00072 } 00073 00074 //////////////////////////////////////////////////////////////////// 00075 // Function: WinGraphicsWindow::set_cursor_in_window 00076 // Access: Private 00077 // Description: Called during the window thread in response to the 00078 // various Windows messages to indicate whether we 00079 // believe the mouse is presently within the window's 00080 // client rectangle or not. This in turn will determine 00081 // whether we should call update_cursor_window() to hide 00082 // or show the cursor (or otherwise change its 00083 // properties) as it moves between the various 00084 // GraphicsWindows that we control. 00085 //////////////////////////////////////////////////////////////////// 00086 INLINE void WinGraphicsWindow:: 00087 set_cursor_in_window() { 00088 if (_cursor_window != this) { 00089 update_cursor_window(this); 00090 } 00091 } 00092 00093 //////////////////////////////////////////////////////////////////// 00094 // Function: WinGraphicsWindow::set_cursor_out_of_window 00095 // Access: Private 00096 // Description: Called during the window thread in response to the 00097 // various Windows messages to indicate whether we 00098 // believe the mouse is presently within the window's 00099 // client rectangle or not. This in turn will determine 00100 // whether we should call update_cursor_window() to hide 00101 // or show the cursor (or otherwise change its 00102 // properties) as it moves between the various 00103 // GraphicsWindows that we control. 00104 //////////////////////////////////////////////////////////////////// 00105 INLINE void WinGraphicsWindow:: 00106 set_cursor_out_of_window() { 00107 if (_cursor_window == this) { 00108 update_cursor_window(NULL); 00109 } 00110 }