Panda3D

Loading...
Searching...
No Matches
pythonGraphicsWindowProc.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 pythonGraphicsWindowProc.h
10 * @author Walt Destler
11 * @date 2010-05
12 */
13
14#ifndef PYTHONGRAPHICSWINDOWPROC_H
15#define PYTHONGRAPHICSWINDOWPROC_H
16
17#include "pandabase.h"
18#include "graphicsWindowProc.h"
19#include "pythonCallbackObject.h"
20
21#ifdef HAVE_PYTHON
22
23/**
24 * Extends GraphicsWindowProc to provide callback functionality to a Python
25 * program.
26 */
27 class PythonGraphicsWindowProc: public GraphicsWindowProc,
28 public PythonCallbackObject {
29 public:
30 PythonGraphicsWindowProc(PyObject *function, PyObject* name);
31 virtual ~PythonGraphicsWindowProc();
32 ALLOC_DELETED_CHAIN(PythonGraphicsWindowProc);
33
34#ifdef WIN32
35 virtual LONG wnd_proc(GraphicsWindow* graphicsWindow, HWND hwnd,
36 UINT msg, WPARAM wparam, LPARAM lparam);
37#endif
38
39 PyObject *get_name();
40
41 private:
42 PyObject *_name;
43
44 public:
45 static TypeHandle get_class_type() {
46 return _type_handle;
47 }
48 static void init_type() {
49 TypedReferenceCount::init_type();
50 register_type(_type_handle, "PythonGraphicsWindowProc",
51 TypedReferenceCount::get_class_type());
52 }
53 virtual TypeHandle get_type() const {
54 return get_class_type();
55 }
56 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
57
58 private:
59 static TypeHandle _type_handle;
60};
61
62#endif // HAVE_PYTHON
63
64#endif // PYTHONGRAPHICSWINDOWPROC_H
GraphicsWindowProc
Defines an interface for storing platform-specific window processor methods.
Definition graphicsWindowProc.h:32
graphicsWindowProc.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pythonCallbackObject.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
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