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)
41typedef 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 bool do_fullscreen_switch(
int x_size,
int y_size);
115 virtual bool do_fullscreen_switch();
116 virtual bool do_windowed_switch();
117 bool do_fullscreen_enable(
int x_size,
int y_size);
118 virtual bool do_fullscreen_enable();
119 virtual bool do_fullscreen_disable();
121 virtual bool calculate_metrics(
bool fullscreen, DWORD style,
122 WINDOW_METRICS &metrics,
bool &has_origin);
126 virtual void reconsider_fullscreen_size(DWORD &x_size, DWORD &y_size,
129 virtual void support_overlay_window(
bool flag);
132 bool open_graphic_window();
133 void adjust_z_order();
134 void adjust_z_order(WindowProperties::ZOrder last_z_order,
135 WindowProperties::ZOrder this_z_order);
136 void initialize_input_devices();
137 void handle_raw_input(HRAWINPUT hraw);
138 void track_mouse_leaving(HWND hwnd);
139 bool confine_cursor();
142 static void process_1_event();
144 void handle_keypress(
ButtonHandle key,
int x,
int y,
double time);
147 void handle_raw_keypress(
ButtonHandle key,
double time);
148 void handle_raw_keyrelease(
ButtonHandle key,
double time);
152 INLINE
int translate_mouse(
int pos)
const;
153 INLINE
void set_cursor_in_window();
154 INLINE
void set_cursor_out_of_window();
156 INLINE
static double get_message_time();
158 void resend_lost_keypresses();
159 void release_all_buttons();
161 static void hide_or_show_cursor(
bool hide_cursor);
163 static bool find_acceptable_display_mode(DWORD dwWidth, DWORD dwHeight,
164 DWORD bpp, DEVMODE &dm);
165 static void show_error_message(DWORD message_id = 0);
175 bool _tracking_mouse_leaving;
176 bool _bCursor_in_WindowClientArea;
177 HANDLE _input_device_handle[32];
179 DEVMODE _fullscreen_display_mode;
181 bool _lost_keypresses;
201 TOUCHINPUT _touches[MAX_TOUCHES];
205 typedef std::map<HWND, WinGraphicsWindow *> WindowHandles;
206 static WindowHandles _window_handles;
222 static bool _cursor_hidden;
223 static bool _got_saved_params;
224 static int _saved_mouse_trails;
225 static BOOL _saved_cursor_shadow;
226 static BOOL _saved_mouse_vanish;
229 static RECT _mouse_unconfined_cliprect;
238 static HICON get_icon(
const Filename &filename);
239 static HCURSOR get_cursor(
const Filename &filename);
248 INLINE
bool operator < (
const WindowClass &other)
const;
256 static int _window_class_index;
258 static const WindowClass ®ister_window_class(
const WindowProperties &props);
271 virtual void receive_windows_message(
unsigned int msg,
int wparam,
int lparam);
281 static void init_type() {
282 WindowHandle::init_type();
284 WindowHandle::get_class_type());
287 return get_class_type();
289 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
299 static void init_type() {
300 GraphicsWindow::init_type();
302 GraphicsWindow::get_class_type());
303 WinWindowHandle::init_type();
306 return get_class_type();
308 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
314#define PRINT_LAST_ERROR 0
315extern EXPCL_PANDAWIN
void PrintErrorMessage(DWORD msgID);
316extern EXPCL_PANDAWIN
void ClearToBlack(HWND hWnd,
const WindowProperties &props);
The name of a file, such as a texture file or an Egg file.
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
This class is the main interface to controlling the render process.
This is a base class for the various different classes that represent the result of a frame of render...
virtual void begin_flip()
This function will be called within the draw thread after end_frame() has been called on all windows,...
An object to create GraphicsOutputs that share a particular 3-D API.
Encapsulates all the communication with a particular instance of a given rendering backend.
This specialization on CallbackData is passed when the callback is initiated from from an implementat...
Defines an interface for storing platform-specific window processor methods.
A window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
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 MouseData get_pointer(int device) const
See GraphicsWindowInputDevice::enable_pointer_mode.
virtual void close_ime()
Forces the ime window to close if any.
virtual int get_num_touches()
Returns the current number of touches on this window.
virtual void process_events()
Do whatever processing is necessary to ensure that the window responds to user events.
virtual bool supports_window_procs() const
Returns whether this window supports adding of Windows proc handlers.
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 TouchInfo get_touch_info(int index)
Returns the TouchInfo object describing the specified touch.
virtual ButtonMap * get_keyboard_map() const
Returns a ButtonMap containing the association between raw buttons and virtual buttons.
Stores information for a single touch event.
TypeHandle is the identifier used to differentiate C++ class types.
This is an abstract base class for wglGraphicsPipe and wdxGraphicsPipe; that is, those graphics pipes...
An abstract base class for glGraphicsWindow and dxGraphicsWindow (and, in general,...
This object represents a window on the desktop, not necessarily a Panda window.
A container for the various kinds of properties we might ask to have on a graphics window before we o...
This is our own Panda specialization on the default STL map.
This is our own Panda specialization on the default STL set.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
BEGIN_PUBLISH typedef PointerData MouseData
Deprecated alias for PointerData.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
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 ...