14 #ifndef WINGRAPHICSWINDOW_H 15 #define WINGRAPHICSWINDOW_H 19 #ifndef WIN32_LEAN_AND_MEAN 20 #define WIN32_LEAN_AND_MEAN 1 26 #define PM_ACTIVE (WM_APP+123) 28 #define PM_INACTIVE (WM_APP+124) 30 #define MAX_TOUCHES 20 41 typedef struct tagTOUCHINPUT {
49 ULONG_PTR dwExtraInfo;
52 } TOUCHINPUT, *PTOUCHINPUT;
67 const std::string &name,
84 void receive_windows_message(
unsigned int msg,
int wparam,
int lparam);
85 virtual LONG window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
86 static LONG WINAPI static_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
87 virtual bool handle_mouse_motion(
int x,
int y);
88 virtual void handle_mouse_exit();
90 INLINE HWND get_ime_hwnd();
94 virtual void clear_window_procs();
103 virtual void close_window();
104 virtual bool open_window();
108 virtual bool do_reshape_request(
int x_origin,
int y_origin,
bool has_origin,
109 int x_size,
int y_size);
111 virtual void handle_reshape();
112 virtual bool do_fullscreen_resize(
int x_size,
int y_size);
114 virtual bool do_fullscreen_switch();
115 virtual bool do_windowed_switch();
116 virtual bool do_fullscreen_enable();
117 virtual bool do_fullscreen_disable();
119 virtual bool calculate_metrics(
bool fullscreen, DWORD style,
120 WINDOW_METRICS &metrics,
bool &has_origin);
124 virtual void reconsider_fullscreen_size(DWORD &x_size, DWORD &y_size,
127 virtual void support_overlay_window(
bool flag);
130 bool open_graphic_window();
131 void adjust_z_order();
132 void adjust_z_order(WindowProperties::ZOrder last_z_order,
133 WindowProperties::ZOrder this_z_order);
134 void initialize_input_devices();
135 void handle_raw_input(HRAWINPUT hraw);
136 void track_mouse_leaving(HWND hwnd);
140 static void process_1_event();
142 void handle_keypress(
ButtonHandle key,
int x,
int y,
double time);
145 void handle_raw_keypress(
ButtonHandle key,
double time);
146 void handle_raw_keyrelease(
ButtonHandle key,
double time);
150 INLINE
int translate_mouse(
int pos)
const;
151 INLINE
void set_cursor_in_window();
152 INLINE
void set_cursor_out_of_window();
154 INLINE
static double get_message_time();
156 void resend_lost_keypresses();
157 void release_all_buttons();
159 static void hide_or_show_cursor(
bool hide_cursor);
161 static bool find_acceptable_display_mode(DWORD dwWidth, DWORD dwHeight,
162 DWORD bpp, DEVMODE &dm);
163 static void show_error_message(DWORD message_id = 0);
173 bool _tracking_mouse_leaving;
174 bool _bCursor_in_WindowClientArea;
175 HANDLE _input_device_handle[32];
177 DEVMODE _fullscreen_display_mode;
179 bool _lost_keypresses;
199 TOUCHINPUT _touches[MAX_TOUCHES];
203 typedef std::map<HWND, WinGraphicsWindow *> WindowHandles;
204 static WindowHandles _window_handles;
220 static bool _cursor_hidden;
221 static bool _got_saved_params;
222 static int _saved_mouse_trails;
223 static BOOL _saved_cursor_shadow;
224 static BOOL _saved_mouse_vanish;
227 static RECT _mouse_unconfined_cliprect;
236 static HICON get_icon(
const Filename &filename);
237 static HCURSOR get_cursor(
const Filename &filename);
246 INLINE
bool operator < (
const WindowClass &other)
const;
254 static int _window_class_index;
256 static const WindowClass ®ister_window_class(
const WindowProperties &props);
269 virtual void receive_windows_message(
unsigned int msg,
int wparam,
int lparam);
279 static void init_type() {
280 WindowHandle::init_type();
282 WindowHandle::get_class_type());
285 return get_class_type();
287 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
297 static void init_type() {
298 GraphicsWindow::init_type();
300 GraphicsWindow::get_class_type());
301 WinWindowHandle::init_type();
304 return get_class_type();
306 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
312 #define PRINT_LAST_ERROR 0 313 extern EXPCL_PANDAWIN
void PrintErrorMessage(DWORD msgID);
314 extern EXPCL_PANDAWIN
void ClearToBlack(HWND hWnd,
const WindowProperties &props);
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.
BEGIN_PUBLISH typedef PointerData MouseData
Deprecated alias for PointerData.
virtual MouseData get_pointer(int device) const
See GraphicsWindowInputDevice::enable_pointer_mode.
virtual void set_properties_now(WindowProperties &properties)
Applies the requested set of properties to the window, if possible, for instance to request a change ...
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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,...
Stores information for a single touch event.
The name of a file, such as a texture file or an Egg file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An object to create GraphicsOutputs that share a particular 3-D API.
virtual bool supports_window_procs() const
Returns whether this window supports adding of Windows proc handlers.
EXPCL_PANDAWIN void get_client_rect_screen(HWND hwnd, RECT *view_rect)
Fills view_rect with the coordinates of the client area of the indicated window, converted to screen ...
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,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Encapsulates all the communication with a particular instance of a given rendering backend.
virtual ButtonMap * get_keyboard_map() const
Returns a ButtonMap containing the association between raw buttons and virtual buttons.
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...