Panda3D

Loading...
Searching...
No Matches
winGraphicsWindow.I
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 winGraphicsWindow.I
10 * @author drose
11 * @date 2002-12-20
12 */
13
14/**
15 * Translates the mouse pixel coordinate (either x or y) as returned by the
16 * Windows message to the signed number expected by Panda.
17 */
18INLINE int WinGraphicsWindow::
19translate_mouse(int pos) const {
20 if (pos & 0x8000) {
21 pos -= 0x10000;
22 }
23 return pos;
24}
25
26/**
27 * Called during the window thread in response to the various Windows messages
28 * to indicate whether we believe the mouse is presently within the window's
29 * client rectangle or not. This in turn will determine whether we should
30 * call update_cursor_window() to hide or show the cursor (or otherwise change
31 * its properties) as it moves between the various GraphicsWindows that we
32 * control.
33 */
34INLINE void WinGraphicsWindow::
35set_cursor_in_window() {
36 if (_cursor_window != this) {
37 update_cursor_window(this);
38 }
39}
40
41/**
42 * Called during the window thread in response to the various Windows messages
43 * to indicate whether we believe the mouse is presently within the window's
44 * client rectangle or not. This in turn will determine whether we should
45 * call update_cursor_window() to hide or show the cursor (or otherwise change
46 * its properties) as it moves between the various GraphicsWindows that we
47 * control.
48 */
49INLINE void WinGraphicsWindow::
50set_cursor_out_of_window() {
51 if (_cursor_window == this) {
52 update_cursor_window(nullptr);
53 }
54}
55
56/**
57 * May be called only during the servicing of a Windows message. This returns
58 * the time the message was added to the Windows message queue (as reported
59 * via GetMessageTime()), converted into global clock units.
60 */
61INLINE double WinGraphicsWindow::
62get_message_time() {
63 DWORD now_ticks = GetTickCount();
64 double now_time = ClockObject::get_global_clock()->get_real_time();
65 DWORD elapsed_ticks = now_ticks - GetMessageTime();
66 return now_time - (double)elapsed_ticks / 1000.0;
67}
68
69/**
70 * Return the IME_window handle if open
71 */
72INLINE HWND WinGraphicsWindow::
73 get_ime_hwnd() {
74 if (_ime_active)
75 return _ime_hWnd;
76 else
77 return nullptr;
78}
79
80/**
81 *
82 */
83INLINE WinGraphicsWindow::WindowClass::
84WindowClass(const WindowProperties &props) :
85 _icon(0)
86{
87 if (props.has_icon_filename()) {
88 _icon = get_icon(props.get_icon_filename());
89 }
90}
91
92/**
93 *
94 */
95INLINE bool WinGraphicsWindow::WindowClass::
96operator < (const WinGraphicsWindow::WindowClass &other) const {
97 return _icon < other._icon;
98}
ClockObject::get_real_time
get_real_time
Returns the actual number of seconds elapsed since the ClockObject was created, or since it was last ...
Definition clockObject.h:92
ClockObject::get_global_clock
static ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
Definition clockObject.I:215
WinGraphicsWindow::get_ime_hwnd
HWND get_ime_hwnd()
Return the IME_window handle if open.
Definition winGraphicsWindow.I:73
WindowProperties
A container for the various kinds of properties we might ask to have on a graphics window before we o...
Definition windowProperties.h:29
WindowProperties::has_icon_filename
has_icon_filename
Returns true if set_icon_filename() has been specified.
Definition windowProperties.h:174