Panda3D
windowHandle.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file windowHandle.cxx
10  * @author drose
11  * @date 2009-09-30
12  */
13 
14 #include "windowHandle.h"
15 
16 TypeHandle WindowHandle::_type_handle;
17 TypeHandle WindowHandle::OSHandle::_type_handle;
18 
19 /**
20  *
21  */
22 WindowHandle::
23 ~WindowHandle() {
24 }
25 
26 /**
27  * Call this method on a parent WindowHandle to deliver a Windows message to
28  * the current child window, if any. This is used in the web plugin system to
29  * deliver button events detected directly by the browser system into Panda,
30  * which is particularly necessary on Vista.
31  */
32 void WindowHandle::
33 send_windows_message(unsigned int msg, int wparam, int lparam) {
34  if (_keyboard_window != nullptr) {
35  _keyboard_window->receive_windows_message(msg, wparam, lparam);
36  }
37 }
38 
39 /**
40  * Returns the OS-specific handle converted to an integer, if this is possible
41  * for the particular representation. Returns 0 if it is not.
42  */
43 size_t WindowHandle::
44 get_int_handle() const {
45  if (_os_handle != nullptr) {
46  return _os_handle->get_int_handle();
47  }
48  return 0;
49 }
50 
51 /**
52  *
53  */
54 void WindowHandle::
55 output(std::ostream &out) const {
56  if (_os_handle == nullptr) {
57  out << "(null)";
58  } else {
59  out << *_os_handle;
60  }
61 }
62 
63 /**
64  * Called on a parent handle to indicate a child window's intention to attach
65  * itself.
66  */
67 void WindowHandle::
69 }
70 
71 /**
72  * Called on a parent handle to indicate a child window's intention to detach
73  * itself.
74  */
75 void WindowHandle::
77  if (_keyboard_window == child) {
78  _keyboard_window = nullptr;
79  }
80 }
81 
82 /**
83  * Called on a parent handle to indicate a child window's wish to receive
84  * keyboard button events.
85  */
86 void WindowHandle::
88  _keyboard_window = child;
89 }
90 
91 /**
92  * Called on a child handle to deliver a keyboard button event generated in
93  * the parent window.
94  */
95 void WindowHandle::
96 receive_windows_message(unsigned int msg, int wparam, int lparam) {
97  nout << "receive_windows_message(" << msg << ", " << wparam << ", " << lparam << ")\n";
98 }
99 
100 /**
101  *
102  */
103 WindowHandle::OSHandle::
104 ~OSHandle() {
105 }
106 
107 /**
108  * Returns the OS-specific handle converted to an integer, if this is possible
109  * for the particular representation. Returns 0 if it is not.
110  */
112 get_int_handle() const {
113  return 0;
114 }
115 
116 /**
117  *
118  */
119 void WindowHandle::OSHandle::
120 output(std::ostream &out) const {
121  out << "(no type)";
122 }
virtual void receive_windows_message(unsigned int msg, int wparam, int lparam)
Called on a child handle to deliver a keyboard button event generated in the parent window.
This object represents a window on the desktop, not necessarily a Panda window.
Definition: windowHandle.h:34
virtual void request_keyboard_focus(WindowHandle *child)
Called on a parent handle to indicate a child window's wish to receive keyboard button events.
virtual void detach_child(WindowHandle *child)
Called on a parent handle to indicate a child window's intention to detach itself.
size_t get_int_handle() const
Returns the OS-specific handle converted to an integer, if this is possible for the particular repres...
void send_windows_message(unsigned int msg, int wparam, int lparam)
Call this method on a parent WindowHandle to deliver a Windows message to the current child window,...
virtual size_t get_int_handle() const
Returns the OS-specific handle converted to an integer, if this is possible for the particular repres...
virtual void attach_child(WindowHandle *child)
Called on a parent handle to indicate a child window's intention to attach itself.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.