Panda3D
|
An abstract base class for glGraphicsWindow and dxGraphicsWindow (and, in general, graphics windows that interface with the Microsoft Windows API). More...
#include "winGraphicsWindow.h"
Classes | |
class | WindowClass |
class | WinWindowHandle |
Public Member Functions | |
WinGraphicsWindow (GraphicsEngine *engine, GraphicsPipe *pipe, const string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, GraphicsStateGuardian *gsg, GraphicsOutput *host) | |
virtual void | add_window_proc (const GraphicsWindowProc *wnd_proc_object) |
Adds the specified Windows proc event handler to be called whenever a Windows event occurs. | |
virtual void | begin_flip () |
This function will be called within the draw thread after end_frame() has been called on all windows, to initiate the exchange of the front and back buffers. | |
virtual void | clear_window_procs () |
Removes all Windows proc event handlers. | |
virtual void | close_ime () |
Forces the ime window to close, if any. | |
virtual TypeHandle | force_init_type () |
HWND | get_ime_hwnd () |
Return the IME_window handle if open. | |
virtual int | get_num_touches () |
Returns the current number of touches on this window. | |
virtual TouchInfo | get_touch_info (int index) |
Returns the TouchInfo object describing the specified touch. | |
virtual TypeHandle | get_type () const |
virtual void | handle_mouse_exit () |
virtual bool | handle_mouse_motion (int x, int y) |
virtual bool | is_touch_event (GraphicsWindowProcCallbackData *callbackData) |
Returns whether the specified event msg is a touch message. | |
virtual bool | move_pointer (int device, int x, int y) |
Forces the pointer to the indicated position within the window, if possible. | |
virtual void | process_events () |
Do whatever processing is necessary to ensure that the window responds to user events. | |
void | receive_windows_message (unsigned int msg, int wparam, int lparam) |
This is called to receive a keyboard event generated by proxy by another window in a parent process. | |
virtual void | remove_window_proc (const GraphicsWindowProc *wnd_proc_object) |
Removes the specified Windows proc event handler. | |
virtual void | set_properties_now (WindowProperties &properties) |
Applies the requested set of properties to the window, if possible, for instance to request a change in size or minimization status. | |
virtual bool | supports_window_procs () const |
Returns whether this window supports adding of windows proc handlers. | |
virtual LONG | window_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) |
This is the nonstatic window_proc function. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
static LONG WINAPI | static_window_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) |
This is attached to the window class for all WinGraphicsWindow windows; it is called to handle window events. | |
Protected Member Functions | |
virtual bool | calculate_metrics (bool fullscreen, DWORD style, WINDOW_METRICS &metrics, bool &has_origin) |
Calculates the metrics for the specified mode, be it windowed or fullscreen. | |
virtual void | close_window () |
Closes the window right now. | |
virtual bool | do_fullscreen_disable () |
This is a low-level function that just gets Windows out of fullscreen mode. | |
virtual bool | do_fullscreen_enable () |
This is a low-level function that just puts Windows in fullscreen mode. | |
virtual bool | do_fullscreen_resize (int x_size, int y_size) |
Called in the window thread to resize a fullscreen window. | |
virtual bool | do_fullscreen_switch () |
Called in the set_properties_now function to switch to fullscreen. | |
virtual bool | do_reshape_request (int x_origin, int y_origin, bool has_origin, int x_size, int y_size) |
Called from the window thread in response to a request from within the code (via request_properties()) to change the size and/or position of the window. | |
virtual bool | do_windowed_switch () |
Called in the set_properties_now function to switch to windowed mode. | |
virtual void | fullscreen_minimized (WindowProperties &properties) |
This is a hook for derived classes to do something special, if necessary, when a fullscreen window has been minimized. | |
virtual void | fullscreen_restored (WindowProperties &properties) |
This is a hook for derived classes to do something special, if necessary, when a fullscreen window has been restored after being minimized. | |
virtual void | handle_reshape () |
Called in the window thread when the window size or location is changed, this updates the properties structure accordingly. | |
virtual DWORD | make_style (bool fullscreen) |
Constructs a dwStyle for the specified mode, be it windowed or fullscreen. | |
virtual bool | open_window () |
Opens the window right now. | |
virtual void | reconsider_fullscreen_size (DWORD &x_size, DWORD &y_size, DWORD &bitdepth) |
Called before creating a fullscreen window to give the driver a chance to adjust the particular resolution request, if necessary. | |
virtual void | support_overlay_window (bool flag) |
Some windows graphics contexts (e.g. | |
void | trigger_flip () |
To be called at the end of the frame, after the window has successfully been drawn and is ready to be flipped (if appropriate). | |
Protected Attributes | |
HWND | _hparent |
HWND | _hWnd |
An abstract base class for glGraphicsWindow and dxGraphicsWindow (and, in general, graphics windows that interface with the Microsoft Windows API).
This class includes all the code for manipulating windows themselves: opening them, closing them, responding to user keyboard and mouse input, and so on. It does not make any 3-D rendering calls into the window; that is the province of the GraphicsStateGuardian.
Definition at line 54 of file winGraphicsWindow.h.
void WinGraphicsWindow::add_window_proc | ( | const GraphicsWindowProc * | wnd_proc_object | ) | [virtual] |
Adds the specified Windows proc event handler to be called whenever a Windows event occurs.
Reimplemented from GraphicsWindow.
Definition at line 2789 of file winGraphicsWindow.cxx.
void WinGraphicsWindow::begin_flip | ( | ) | [virtual] |
This function will be called within the draw thread after end_frame() has been called on all windows, to initiate the exchange of the front and back buffers.
This should instruct the window to prepare for the flip at the next video sync, but it should not wait.
We have the two separate functions, begin_flip() and end_flip(), to make it easier to flip all of the windows at the same time.
Reimplemented from GraphicsOutput.
Reimplemented in wglGraphicsWindow.
Definition at line 209 of file winGraphicsWindow.cxx.
bool WinGraphicsWindow::calculate_metrics | ( | bool | fullscreen, |
DWORD | style, | ||
WINDOW_METRICS & | metrics, | ||
bool & | has_origin | ||
) | [protected, virtual] |
Calculates the metrics for the specified mode, be it windowed or fullscreen.
Definition at line 915 of file winGraphicsWindow.cxx.
References WindowProperties::get_x_origin(), WindowProperties::get_x_size(), WindowProperties::get_y_origin(), WindowProperties::get_y_size(), WindowProperties::has_origin(), and WindowProperties::set_origin().
Referenced by do_fullscreen_switch(), and do_windowed_switch().
void WinGraphicsWindow::clear_window_procs | ( | ) | [virtual] |
Removes all Windows proc event handlers.
Reimplemented from GraphicsWindow.
Definition at line 2811 of file winGraphicsWindow.cxx.
void WinGraphicsWindow::close_ime | ( | ) | [virtual] |
Forces the ime window to close, if any.
Reimplemented from GraphicsWindow.
Definition at line 176 of file winGraphicsWindow.cxx.
void WinGraphicsWindow::close_window | ( | ) | [protected, virtual] |
Closes the window right now.
Called from the window thread.
Reimplemented from GraphicsWindow.
Reimplemented in wdxGraphicsWindow8, wdxGraphicsWindow9, and wglGraphicsWindow.
Definition at line 399 of file winGraphicsWindow.cxx.
References do_fullscreen_disable(), and GraphicsWindow::is_fullscreen().
Referenced by window_proc().
bool WinGraphicsWindow::do_fullscreen_disable | ( | ) | [protected, virtual] |
This is a low-level function that just gets Windows out of fullscreen mode.
Not to confuse with do_windowed_switch().
Definition at line 1142 of file winGraphicsWindow.cxx.
Referenced by close_window(), do_windowed_switch(), and window_proc().
bool WinGraphicsWindow::do_fullscreen_enable | ( | ) | [protected, virtual] |
This is a low-level function that just puts Windows in fullscreen mode.
Not to confuse with do_fullscreen_switch().
Definition at line 1087 of file winGraphicsWindow.cxx.
References WindowProperties::get_x_size(), WindowProperties::get_y_size(), reconsider_fullscreen_size(), WindowProperties::set_origin(), and WindowProperties::set_size().
Referenced by do_fullscreen_switch().
bool WinGraphicsWindow::do_fullscreen_resize | ( | int | x_size, |
int | y_size | ||
) | [protected, virtual] |
Called in the window thread to resize a fullscreen window.
Reimplemented in wdxGraphicsWindow8, and wdxGraphicsWindow9.
Definition at line 745 of file winGraphicsWindow.cxx.
References WindowProperties::set_size(), and GraphicsOutput::set_size_and_recalc().
Referenced by wdxGraphicsWindow8::do_fullscreen_resize(), wdxGraphicsWindow9::do_fullscreen_resize(), and do_reshape_request().
bool WinGraphicsWindow::do_fullscreen_switch | ( | ) | [protected, virtual] |
Called in the set_properties_now function to switch to fullscreen.
Definition at line 801 of file winGraphicsWindow.cxx.
References calculate_metrics(), do_fullscreen_enable(), and make_style().
Referenced by set_properties_now().
bool WinGraphicsWindow::do_reshape_request | ( | int | x_origin, |
int | y_origin, | ||
bool | has_origin, | ||
int | x_size, | ||
int | y_size | ||
) | [protected, virtual] |
Called from the window thread in response to a request from within the code (via request_properties()) to change the size and/or position of the window.
Returns true if the window is successfully changed, or false if there was a problem.
Reimplemented from GraphicsWindow.
Definition at line 648 of file winGraphicsWindow.cxx.
References do_fullscreen_resize(), handle_reshape(), GraphicsWindow::is_fullscreen(), and WindowProperties::set_origin().
bool WinGraphicsWindow::do_windowed_switch | ( | ) | [protected, virtual] |
Called in the set_properties_now function to switch to windowed mode.
Definition at line 828 of file winGraphicsWindow.cxx.
References calculate_metrics(), do_fullscreen_disable(), and make_style().
Referenced by set_properties_now().
void WinGraphicsWindow::fullscreen_minimized | ( | WindowProperties & | properties | ) | [protected, virtual] |
This is a hook for derived classes to do something special, if necessary, when a fullscreen window has been minimized.
The given WindowProperties struct will be applied to this window's properties after this function returns.
Definition at line 622 of file winGraphicsWindow.cxx.
Referenced by window_proc().
void WinGraphicsWindow::fullscreen_restored | ( | WindowProperties & | properties | ) | [protected, virtual] |
This is a hook for derived classes to do something special, if necessary, when a fullscreen window has been restored after being minimized.
The given WindowProperties struct will be applied to this window's properties after this function returns.
Reimplemented in wdxGraphicsWindow8, and wdxGraphicsWindow9.
Definition at line 635 of file winGraphicsWindow.cxx.
Referenced by window_proc().
HWND WinGraphicsWindow::get_ime_hwnd | ( | ) | [inline] |
Return the IME_window handle if open.
Definition at line 91 of file winGraphicsWindow.I.
int WinGraphicsWindow::get_num_touches | ( | ) | [virtual] |
Returns the current number of touches on this window.
Reimplemented from GraphicsWindow.
Definition at line 2847 of file winGraphicsWindow.cxx.
TouchInfo WinGraphicsWindow::get_touch_info | ( | int | index | ) | [virtual] |
Returns the TouchInfo object describing the specified touch.
Reimplemented from GraphicsWindow.
Definition at line 2862 of file winGraphicsWindow.cxx.
void WinGraphicsWindow::handle_reshape | ( | ) | [protected, virtual] |
Called in the window thread when the window size or location is changed, this updates the properties structure accordingly.
Reimplemented in wdxGraphicsWindow8, and wdxGraphicsWindow9.
Definition at line 714 of file winGraphicsWindow.cxx.
References WindowProperties::get_x_origin(), WindowProperties::get_x_size(), WindowProperties::get_y_origin(), WindowProperties::get_y_size(), WindowProperties::set_origin(), WindowProperties::set_size(), and GraphicsWindow::system_changed_properties().
Referenced by do_reshape_request(), and window_proc().
bool WinGraphicsWindow::is_touch_event | ( | GraphicsWindowProcCallbackData * | callbackData | ) | [virtual] |
Returns whether the specified event msg is a touch message.
Reimplemented from GraphicsWindow.
Definition at line 2832 of file winGraphicsWindow.cxx.
DWORD WinGraphicsWindow::make_style | ( | bool | fullscreen | ) | [protected, virtual] |
Constructs a dwStyle for the specified mode, be it windowed or fullscreen.
Definition at line 883 of file winGraphicsWindow.cxx.
References WindowProperties::get_fixed_size(), and WindowProperties::get_undecorated().
Referenced by do_fullscreen_switch(), and do_windowed_switch().
bool WinGraphicsWindow::move_pointer | ( | int | device, |
int | x, | ||
int | y | ||
) | [virtual] |
Forces the pointer to the indicated position within the window, if possible.
Returns true if successful, false on failure. This may fail if the mouse is not currently within the window, or if the API doesn't support this operation.
Reimplemented from GraphicsWindow.
Definition at line 135 of file winGraphicsWindow.cxx.
References WindowProperties::get_foreground().
bool WinGraphicsWindow::open_window | ( | ) | [protected, virtual] |
Opens the window right now.
Called from the window thread. Returns true if the window is successfully opened, or false if there was a problem.
Reimplemented from GraphicsWindow.
Reimplemented in wdxGraphicsWindow8, wdxGraphicsWindow9, and wglGraphicsWindow.
Definition at line 423 of file winGraphicsWindow.cxx.
References WindowProperties::get_cursor_filename(), WindowProperties::get_foreground(), WindowProperties::get_minimized(), WindowProperties::has_cursor_filename(), WindowProperties::has_foreground(), WindowProperties::has_minimized(), and GraphicsWindow::is_fullscreen().
Referenced by wglGraphicsWindow::open_window(), wdxGraphicsWindow9::open_window(), and wdxGraphicsWindow8::open_window().
void WinGraphicsWindow::process_events | ( | ) | [virtual] |
Do whatever processing is necessary to ensure that the window responds to user events.
Also, honor any requests recently made via request_properties()
This function is called only within the window thread.
Reimplemented from GraphicsWindow.
Definition at line 223 of file winGraphicsWindow.cxx.
void WinGraphicsWindow::receive_windows_message | ( | unsigned int | msg, |
int | wparam, | ||
int | lparam | ||
) |
This is called to receive a keyboard event generated by proxy by another window in a parent process.
This hacky system is used in the web plugin system to allow the Panda window to receive keyboard events on Vista, which doesn't allow the Panda window to set keyboard focus to itself.
Definition at line 1284 of file winGraphicsWindow.cxx.
References window_proc().
void WinGraphicsWindow::reconsider_fullscreen_size | ( | DWORD & | x_size, |
DWORD & | y_size, | ||
DWORD & | bitdepth | ||
) | [protected, virtual] |
Called before creating a fullscreen window to give the driver a chance to adjust the particular resolution request, if necessary.
Definition at line 859 of file winGraphicsWindow.cxx.
Referenced by do_fullscreen_enable().
void WinGraphicsWindow::remove_window_proc | ( | const GraphicsWindowProc * | wnd_proc_object | ) | [virtual] |
Removes the specified Windows proc event handler.
Reimplemented from GraphicsWindow.
Definition at line 2800 of file winGraphicsWindow.cxx.
void WinGraphicsWindow::set_properties_now | ( | WindowProperties & | properties | ) | [virtual] |
Applies the requested set of properties to the window, if possible, for instance to request a change in size or minimization status.
The window properties are applied immediately, rather than waiting until the next frame. This implies that this method may *only* be called from within the window thread.
The properties that have been applied are cleared from the structure by this function; so on return, whatever remains in the properties structure are those that were unchanged for some reason (probably because the underlying interface does not support changing that property on an open window).
Reimplemented from GraphicsWindow.
Definition at line 272 of file winGraphicsWindow.cxx.
References WindowProperties::clear_cursor_filename(), WindowProperties::clear_cursor_hidden(), WindowProperties::clear_foreground(), WindowProperties::clear_fullscreen(), WindowProperties::clear_minimized(), WindowProperties::clear_title(), WindowProperties::clear_z_order(), TextEncoder::decode_text(), do_fullscreen_switch(), do_windowed_switch(), WindowProperties::get_cursor_filename(), WindowProperties::get_cursor_hidden(), WindowProperties::get_foreground(), WindowProperties::get_fullscreen(), WindowProperties::get_minimized(), WindowProperties::get_title(), WindowProperties::get_z_order(), WindowProperties::has_cursor_filename(), WindowProperties::has_cursor_hidden(), WindowProperties::has_foreground(), WindowProperties::has_fullscreen(), WindowProperties::has_minimized(), WindowProperties::has_title(), WindowProperties::has_z_order(), WindowProperties::is_any_specified(), GraphicsWindow::is_fullscreen(), WindowProperties::set_cursor_filename(), WindowProperties::set_cursor_hidden(), WindowProperties::set_foreground(), WindowProperties::set_fullscreen(), WindowProperties::set_minimized(), WindowProperties::set_title(), and WindowProperties::set_z_order().
LONG WINAPI WinGraphicsWindow::static_window_proc | ( | HWND | hwnd, |
UINT | msg, | ||
WPARAM | wparam, | ||
LPARAM | lparam | ||
) | [static] |
This is attached to the window class for all WinGraphicsWindow windows; it is called to handle window events.
Definition at line 2103 of file winGraphicsWindow.cxx.
References window_proc().
void WinGraphicsWindow::support_overlay_window | ( | bool | flag | ) | [protected, virtual] |
Some windows graphics contexts (e.g.
DirectX) require special support to enable the displaying of an overlay window (particularly the IME window) over the fullscreen graphics window. This is a hook for the window to enable or disable that mode when necessary.
Definition at line 873 of file winGraphicsWindow.cxx.
Referenced by window_proc().
bool WinGraphicsWindow::supports_window_procs | ( | ) | const [virtual] |
Returns whether this window supports adding of windows proc handlers.
Reimplemented from GraphicsWindow.
Definition at line 2821 of file winGraphicsWindow.cxx.
void WinGraphicsWindow::trigger_flip | ( | ) | [protected] |
To be called at the end of the frame, after the window has successfully been drawn and is ready to be flipped (if appropriate).
Reimplemented from GraphicsOutput.
Definition at line 375 of file winGraphicsWindow.cxx.
References GraphicsWindow::get_unexposed_draw().
Referenced by wglGraphicsWindow::end_frame(), wdxGraphicsWindow9::end_frame(), and wdxGraphicsWindow8::end_frame().
LONG WinGraphicsWindow::window_proc | ( | HWND | hwnd, |
UINT | msg, | ||
WPARAM | wparam, | ||
LPARAM | lparam | ||
) | [virtual] |
This is the nonstatic window_proc function.
It is called to handle window events for this particular window.
Definition at line 1301 of file winGraphicsWindow.cxx.
References MouseButton::button(), close_window(), do_fullscreen_disable(), fullscreen_minimized(), fullscreen_restored(), GraphicsWindow::get_close_request_event(), ClockObject::get_global_clock(), ClockObject::get_real_time(), handle_reshape(), GraphicsWindow::is_fullscreen(), WindowProperties::set_foreground(), WindowProperties::set_minimized(), WindowProperties::set_open(), support_overlay_window(), GraphicsWindow::system_changed_properties(), MouseButton::wheel_down(), and MouseButton::wheel_up().
Referenced by receive_windows_message(), and static_window_proc().