Panda3D
graphicsWindowProcCallbackData.h
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 graphicsWindowProcCallbackData.h
10  * @author Walt Destler
11  * @date 2010-06
12  */
13 
14 #ifndef GRAPHICSWINDOWPROCCALLBACKDATA_H
15 #define GRAPHICSWINDOWPROCCALLBACKDATA_H
16 
17 #include "pandabase.h"
18 #include "callbackData.h"
19 #include "touchInfo.h"
20 
21 class GraphicsWindow;
22 
23 /**
24  * This specialization on CallbackData is passed when the callback is
25  * initiated from from an implementation of the GraphicsWindowProc class, such
26  * as PythonGraphicsWindowProc.
27  */
28 class EXPCL_PANDA_DISPLAY GraphicsWindowProcCallbackData : public CallbackData {
29 public:
30  INLINE GraphicsWindowProcCallbackData(GraphicsWindow* graphicsWindow);
31 
32  INLINE GraphicsWindow* get_graphics_window() const;
33 
34 #ifdef WIN32
35  INLINE void set_hwnd(uintptr_t hwnd);
36  INLINE void set_msg(int msg);
37  INLINE void set_wparam(int wparam);
38  INLINE void set_lparam(int lparam);
39 #endif
40 
41 PUBLISHED:
42  virtual void output(std::ostream &out) const;
43 
44 #ifdef WIN32
45  INLINE uintptr_t get_hwnd() const;
46  INLINE int get_msg() const;
47  INLINE int get_wparam() const;
48  INLINE int get_lparam() const;
49 #endif
50 
51  bool is_touch_event();
52  int get_num_touches();
53  TouchInfo get_touch_info(int index);
54 
55 private:
56  GraphicsWindow* _graphicsWindow;
57 #ifdef WIN32
58  uintptr_t _hwnd;
59  int _msg;
60  int _wparam;
61  int _lparam;
62 #endif
63 
64 public:
65  static TypeHandle get_class_type() {
66  return _type_handle;
67  }
68  static void init_type() {
69  CallbackData::init_type();
70  register_type(_type_handle, "GraphicsWindowProcCallbackData",
71  CallbackData::get_class_type());
72  }
73  virtual TypeHandle get_type() const {
74  return get_class_type();
75  }
76  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
77 
78 private:
79  static TypeHandle _type_handle;
80 };
81 
83 
84 #endif // GRAPHICSWINDOWPROCCALLBACKDATA_H
This specialization on CallbackData is passed when the callback is initiated from from an implementat...
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(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a generic data block that is passed along to a CallbackObject when a callback is made.
Definition: callbackData.h:29
A window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Stores information for a single touch event.
Definition: touchInfo.h:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81