Panda3D
pythonGraphicsWindowProc.h
1 // Filename: customGgraphicswindowProc.h
2 // Created by: Walt Destler (May 2010)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef PYTHONGRAPHICSWINDOWPROC_H
16 #define PYTHONGRAPHICSWINDOWPROC_H
17 
18 #include "pandabase.h"
19 #include "graphicsWindowProc.h"
20 #include "pythonCallbackObject.h"
21 
22 #ifdef HAVE_PYTHON
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : PythonGraphicsWindowProc
26 // Description : Extends GraphicsWindowProc to provde callback functionality
27 // to a python program.
28 ////////////////////////////////////////////////////////////////////
29 class PythonGraphicsWindowProc: public GraphicsWindowProc,
30  public PythonCallbackObject {
31 public:
32  PythonGraphicsWindowProc(PyObject *function, PyObject* name);
33  virtual ~PythonGraphicsWindowProc();
34  ALLOC_DELETED_CHAIN(PythonGraphicsWindowProc);
35 
36 #ifdef WIN32
37  virtual LONG wnd_proc(GraphicsWindow* graphicsWindow, HWND hwnd,
38  UINT msg, WPARAM wparam, LPARAM lparam);
39 #endif
40 
41  PyObject *get_name();
42 
43 private:
44  PyObject *_name;
45 
46 public:
47  static TypeHandle get_class_type() {
48  return _type_handle;
49  }
50  static void init_type() {
51  TypedReferenceCount::init_type();
52  register_type(_type_handle, "PythonGraphicsWindowProc",
53  TypedReferenceCount::get_class_type());
54  }
55  virtual TypeHandle get_type() const {
56  return get_class_type();
57  }
58  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
59 
60 private:
61  static TypeHandle _type_handle;
62 };
63 
64 #endif // HAVE_PYTHON
65 
66 #endif // PYTHONGRAPHICSWINDOWPROC_H
A window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
Defines an interface for storing platform-specific window processor methods.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85