Panda3D
Loading...
Searching...
No Matches
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
16TypeHandle WindowHandle::_type_handle;
17TypeHandle WindowHandle::OSHandle::_type_handle;
18
19/**
20 *
21 */
22WindowHandle::
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 */
33send_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 */
44get_int_handle() const {
45 if (_os_handle != nullptr) {
46 return _os_handle->get_int_handle();
47 }
48 return 0;
49}
50
51/**
52 *
53 */
54void WindowHandle::
55output(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 */
70
71/**
72 * Called on a parent handle to indicate a child window's intention to detach
73 * itself.
74 */
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 */
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 */
96receive_windows_message(unsigned int msg, int wparam, int lparam) {
97 nout << "receive_windows_message(" << msg << ", " << wparam << ", " << lparam << ")\n";
98}
99
100/**
101 *
102 */
103WindowHandle::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 */
112get_int_handle() const {
113 return 0;
114}
115
116/**
117 *
118 */
119void WindowHandle::OSHandle::
120output(std::ostream &out) const {
121 out << "(no type)";
122}
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
virtual size_t get_int_handle() const
Returns the OS-specific handle converted to an integer, if this is possible for the particular repres...
This object represents a window on the desktop, not necessarily a Panda window.
virtual void detach_child(WindowHandle *child)
Called on a parent handle to indicate a child window's intention to detach itself.
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,...
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 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.
virtual void attach_child(WindowHandle *child)
Called on a parent handle to indicate a child window's intention to attach itself.
virtual void request_keyboard_focus(WindowHandle *child)
Called on a parent handle to indicate a child window's wish to receive keyboard button events.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.