Panda3D

windowHandle.cxx

00001 // Filename: windowHandle.cxx
00002 // Created by:  drose (30Sep09)
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 #include "windowHandle.h"
00016 
00017 TypeHandle WindowHandle::_type_handle;
00018 TypeHandle WindowHandle::OSHandle::_type_handle;
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: WindowHandle::Destructor
00022 //       Access: Published, Virtual
00023 //  Description:
00024 ////////////////////////////////////////////////////////////////////
00025 WindowHandle::
00026 ~WindowHandle() {
00027 }
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //     Function: WindowHandle::send_windows_message
00031 //       Access: Published
00032 //  Description: Call this method on a parent WindowHandle to deliver
00033 //               a Windows message to the current child window, if any.
00034 //               This is used in the web plugin system to deliver
00035 //               button events detected directly by the browser system
00036 //               into Panda, which is particularly necessary on Vista.
00037 ////////////////////////////////////////////////////////////////////
00038 void WindowHandle::
00039 send_windows_message(unsigned int msg, int wparam, int lparam) {
00040   if (_keyboard_window != NULL) {
00041     _keyboard_window->receive_windows_message(msg, wparam, lparam);
00042   }
00043 }
00044 
00045 ////////////////////////////////////////////////////////////////////
00046 //     Function: WindowHandle::get_int_handle
00047 //       Access: Published
00048 //  Description: Returns the OS-specific handle converted to an
00049 //               integer, if this is possible for the particular
00050 //               representation.  Returns 0 if it is not.
00051 ////////////////////////////////////////////////////////////////////
00052 size_t WindowHandle::
00053 get_int_handle() const {
00054   if (_os_handle != NULL) {
00055     return _os_handle->get_int_handle();
00056   }
00057   return 0;
00058 }
00059 
00060 ////////////////////////////////////////////////////////////////////
00061 //     Function: WindowHandle::output
00062 //       Access: Published
00063 //  Description: 
00064 ////////////////////////////////////////////////////////////////////
00065 void WindowHandle::
00066 output(ostream &out) const {
00067   if (_os_handle == NULL) {
00068     out << "(null)";
00069   } else {
00070     out << *_os_handle;
00071   }
00072 }
00073 
00074 ////////////////////////////////////////////////////////////////////
00075 //     Function: WindowHandle::attach_child
00076 //       Access: Public, Virtual
00077 //  Description: Called on a parent handle to indicate a child
00078 //               window's intention to attach itself.
00079 ////////////////////////////////////////////////////////////////////
00080 void WindowHandle::
00081 attach_child(WindowHandle *child) {
00082 }
00083 
00084 ////////////////////////////////////////////////////////////////////
00085 //     Function: WindowHandle::detach_child
00086 //       Access: Public, Virtual
00087 //  Description: Called on a parent handle to indicate a child
00088 //               window's intention to detach itself.
00089 ////////////////////////////////////////////////////////////////////
00090 void WindowHandle::
00091 detach_child(WindowHandle *child) {
00092   if (_keyboard_window == child) {
00093     _keyboard_window = NULL;
00094   }
00095 }
00096 
00097 ////////////////////////////////////////////////////////////////////
00098 //     Function: WindowHandle::request_keyboard_focus
00099 //       Access: Public, Virtual
00100 //  Description: Called on a parent handle to indicate a child
00101 //               window's wish to receive keyboard button events.
00102 ////////////////////////////////////////////////////////////////////
00103 void WindowHandle::
00104 request_keyboard_focus(WindowHandle *child) {
00105   _keyboard_window = child;
00106 }
00107 
00108 ////////////////////////////////////////////////////////////////////
00109 //     Function: WindowHandle::receive_windows_message
00110 //       Access: Public, Virtual
00111 //  Description: Called on a child handle to deliver a keyboard button
00112 //               event generated in the parent window.
00113 ////////////////////////////////////////////////////////////////////
00114 void WindowHandle::
00115 receive_windows_message(unsigned int msg, int wparam, int lparam) {
00116   nout << "receive_windows_message(" << msg << ", " << wparam << ", " << lparam << ")\n";
00117 }
00118 
00119 ////////////////////////////////////////////////////////////////////
00120 //     Function: WindowHandle::OSHandle::Destructor
00121 //       Access: Published, Virtual
00122 //  Description: 
00123 ////////////////////////////////////////////////////////////////////
00124 WindowHandle::OSHandle::
00125 ~OSHandle() {
00126 }
00127 
00128 ////////////////////////////////////////////////////////////////////
00129 //     Function: WindowHandle::OSHandle::get_int_handle
00130 //       Access: Published, Virtual
00131 //  Description: Returns the OS-specific handle converted to an
00132 //               integer, if this is possible for the particular
00133 //               representation.  Returns 0 if it is not.
00134 ////////////////////////////////////////////////////////////////////
00135 size_t WindowHandle::OSHandle::
00136 get_int_handle() const {
00137   return 0;
00138 }
00139 
00140 ////////////////////////////////////////////////////////////////////
00141 //     Function: WindowHandle::OSHandle::output
00142 //       Access: Published, Virtual
00143 //  Description: 
00144 ////////////////////////////////////////////////////////////////////
00145 void WindowHandle::OSHandle::
00146 output(ostream &out) const {
00147   out << "(no type)";
00148 }
 All Classes Functions Variables Enumerations