15 #ifndef WINGRAPHICSWINDOW_H
16 #define WINGRAPHICSWINDOW_H
18 #include "pandabase.h"
19 #include "graphicsWindow.h"
20 #ifndef WIN32_LEAN_AND_MEAN
21 #define WIN32_LEAN_AND_MEAN 1
27 #define PM_ACTIVE (WM_APP+123)
29 #define PM_INACTIVE (WM_APP+124)
31 #define MAX_TOUCHES 20
73 void receive_windows_message(
unsigned int msg,
int wparam,
int lparam);
74 virtual LONG window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
75 static LONG WINAPI static_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
76 virtual bool handle_mouse_motion(
int x,
int y);
77 virtual void handle_mouse_exit();
79 INLINE HWND get_ime_hwnd();
83 virtual void clear_window_procs();
92 virtual void close_window();
93 virtual bool open_window();
97 virtual bool do_reshape_request(
int x_origin,
int y_origin,
bool has_origin,
98 int x_size,
int y_size);
100 virtual void handle_reshape();
101 virtual bool do_fullscreen_resize(
int x_size,
int y_size);
103 virtual bool do_fullscreen_switch();
104 virtual bool do_windowed_switch();
105 virtual bool do_fullscreen_enable();
106 virtual bool do_fullscreen_disable();
108 virtual bool calculate_metrics(
bool fullscreen, DWORD style,
111 virtual DWORD make_style(
bool fullscreen);
113 virtual void reconsider_fullscreen_size(DWORD &x_size, DWORD &y_size,
116 virtual void support_overlay_window(
bool flag);
119 bool open_graphic_window(
bool fullscreen);
120 void adjust_z_order();
121 void adjust_z_order(WindowProperties::ZOrder last_z_order,
122 WindowProperties::ZOrder this_z_order);
123 void initialize_input_devices();
124 void handle_raw_input(HRAWINPUT hraw);
125 void track_mouse_leaving(HWND hwnd);
129 static void process_1_event();
131 void handle_keypress(
ButtonHandle key,
int x,
int y,
double time);
134 void handle_raw_keypress(
ButtonHandle key,
double time);
135 void handle_raw_keyrelease(
ButtonHandle key,
double time);
139 INLINE
int translate_mouse(
int pos)
const;
140 INLINE
void set_cursor_in_window();
141 INLINE
void set_cursor_out_of_window();
143 INLINE
static double get_message_time();
145 void resend_lost_keypresses();
146 void release_all_buttons();
148 static void hide_or_show_cursor(
bool hide_cursor);
150 static bool find_acceptable_display_mode(DWORD dwWidth, DWORD dwHeight,
151 DWORD bpp, DEVMODE &dm);
152 static void show_error_message(DWORD message_id = 0);
162 bool _tracking_mouse_leaving;
163 bool _bCursor_in_WindowClientArea;
164 HANDLE _input_device_handle[32];
166 DEVMODE _fullscreen_display_mode;
168 bool _lost_keypresses;
187 #ifdef HAVE_WIN_TOUCHINPUT
189 TOUCHINPUT _touches[MAX_TOUCHES];
194 typedef map<HWND, WinGraphicsWindow *> WindowHandles;
195 static WindowHandles _window_handles;
211 static bool _cursor_hidden;
212 static bool _got_saved_params;
213 static int _saved_mouse_trails;
214 static BOOL _saved_cursor_shadow;
215 static BOOL _saved_mouse_vanish;
218 static RECT _mouse_unconfined_cliprect;
227 static HICON get_icon(
const Filename &filename);
228 static HCURSOR get_cursor(
const Filename &filename);
237 INLINE
bool operator < (
const WindowClass &other)
const;
245 static int _window_class_index;
247 static const WindowClass ®ister_window_class(
const WindowProperties &props);
260 virtual void receive_windows_message(
unsigned int msg,
int wparam,
int lparam);
270 static void init_type() {
271 WindowHandle::init_type();
272 register_type(_type_handle,
"WinWindowHandle",
273 WindowHandle::get_class_type());
276 return get_class_type();
278 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
288 static void init_type() {
289 GraphicsWindow::init_type();
290 register_type(_type_handle,
"WinGraphicsWindow",
291 GraphicsWindow::get_class_type());
292 WinWindowHandle::init_type();
295 return get_class_type();
297 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
303 #define PRINT_LAST_ERROR 0
304 extern EXPCL_PANDAWIN
void PrintErrorMessage(DWORD msgID);
305 extern EXPCL_PANDAWIN
void ClearToBlack(HWND hWnd,
const WindowProperties &props);
306 extern EXPCL_PANDAWIN
void get_client_rect_screen(HWND hwnd, RECT *view_rect);
308 #include "winGraphicsWindow.I"
virtual bool supports_window_procs() const
Returns whether this window supports adding of Windows proc handlers.
This specialization on CallbackData is passed when the callback is initiated from from an implementat...
virtual void process_events()
Do whatever processing is necessary to ensure that the window responds to user events.
This is our own Panda specialization on the default STL map.
virtual void close_ime()
Forces the ime window to close if any.
This object represents a window on the desktop, not necessarily a Panda window.
virtual bool move_pointer(int device, int x, int y)
Forces the pointer to the indicated position within the window, if possible.
virtual int get_num_touches()
Returns the current number of touches on this window.
virtual void set_properties_now(WindowProperties &properties)
Applies the requested set of properties to the window, if possible, for instance to request a change ...
virtual ButtonMap * get_keyboard_map() const
Returns a ButtonMap containing the association between raw buttons and virtual buttons.
A window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
A container for the various kinds of properties we might ask to have on a graphics window before we o...
An abstract base class for glGraphicsWindow and dxGraphicsWindow (and, in general, graphics windows that interface with the Microsoft Windows API).
Stores information for a single touch event.
The name of a file, such as a texture file or an Egg file.
An object to create GraphicsOutputs that share a particular 3-D API.
This is a base class for the various different classes that represent the result of a frame of render...
Defines an interface for storing platform-specific window processor methods.
virtual TouchInfo get_touch_info(int index)
Returns the TouchInfo object describing the specified touch.
This is an abstract base class for wglGraphicsPipe and wdxGraphicsPipe; that is, those graphics pipes...
virtual void begin_flip()
This function will be called within the draw thread after end_frame() has been called on all windows...
Encapsulates all the communication with a particular instance of a given rendering backend...
This class is the main interface to controlling the render process.
virtual bool is_touch_event(GraphicsWindowProcCallbackData *callbackData)
Returns whether the specified event msg is a touch message.
TypeHandle is the identifier used to differentiate C++ class types.
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...