pythonGraphicsWindowProc.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. #ifndef PYTHONGRAPHICSWINDOWPROC_H
  15. #define PYTHONGRAPHICSWINDOWPROC_H
  16. #include "pandabase.h"
  17. #include "graphicsWindowProc.h"
  18. #include "pythonCallbackObject.h"
  19. ////////////////////////////////////////////////////////////////////
  20. // Class : PythonGraphicsWindowProc
  21. // Description : Extends GraphicsWindowProc to provde callback functionality
  22. // to a python program.
  23. ////////////////////////////////////////////////////////////////////
  24. class PythonGraphicsWindowProc: public GraphicsWindowProc, public PythonCallbackObject{
  25. public:
  26. PythonGraphicsWindowProc(PyObject *function, PyObject* name);
  27. virtual ~PythonGraphicsWindowProc();
  28. ALLOC_DELETED_CHAIN(PythonGraphicsWindowProc);
  29. #ifdef WIN32
  30. virtual LONG wnd_proc(GraphicsWindow* graphicsWindow, HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
  31. #endif
  32. PyObject* get_name();
  33. private:
  34. PyObject* _name;
  35. public:
  36. static TypeHandle get_class_type() {
  37. return _type_handle;
  38. }
  39. static void init_type() {
  40. TypedReferenceCount::init_type();
  41. register_type(_type_handle, "PythonGraphicsWindowProc",
  42. TypedReferenceCount::get_class_type());
  43. }
  44. virtual TypeHandle get_type() const {
  45. return get_class_type();
  46. }
  47. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  48. private:
  49. static TypeHandle _type_handle;
  50. };
  51. #endif //PYTHONGRAPHICSWINDOWPROC_H