00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef PYTHONCALLBACKOBJECT_H
00016 #define PYTHONCALLBACKOBJECT_H
00017
00018 #include "pandabase.h"
00019
00020 #ifdef HAVE_PYTHON
00021
00022 #include "callbackObject.h"
00023
00024
00025
00026
00027
00028
00029
00030 class EXPCL_PANDA_PUTIL PythonCallbackObject : public CallbackObject {
00031 PUBLISHED:
00032 PythonCallbackObject(PyObject *function = Py_None);
00033 virtual ~PythonCallbackObject();
00034 ALLOC_DELETED_CHAIN(PythonCallbackObject);
00035
00036 void set_function(PyObject *function);
00037 PyObject *get_function();
00038
00039 public:
00040 virtual void do_callback(CallbackData *cbdata);
00041
00042 private:
00043 void do_python_callback(CallbackData *cbdata);
00044
00045 PyObject *_function;
00046
00047 public:
00048 static TypeHandle get_class_type() {
00049 return _type_handle;
00050 }
00051 static void init_type() {
00052 CallbackObject::init_type();
00053 register_type(_type_handle, "PythonCallbackObject",
00054 CallbackObject::get_class_type());
00055 }
00056 virtual TypeHandle get_type() const {
00057 return get_class_type();
00058 }
00059 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00060
00061 private:
00062 static TypeHandle _type_handle;
00063 };
00064
00065 #include "pythonCallbackObject.I"
00066
00067 #endif // HAVE_PYTHON
00068
00069 #endif