00001 /*************************************************************************** 00002 * Copyright (c) Jürgen Riegel (juergen.riegel@web.de) 2005 * 00003 * * 00004 * This file is part of the FreeCAD CAx development system. * 00005 * * 00006 * This library is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Library General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2 of the License, or (at your option) any later version. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU Library General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Library General Public * 00017 * License along with this library; see the file COPYING.LIB. If not, * 00018 * write to the Free Software Foundation, Inc., 59 Temple Place, * 00019 * Suite 330, Boston, MA 02111-1307, USA * 00020 * * 00021 ***************************************************************************/ 00022 00023 00024 #ifndef GUI_VIEW3DPY_H 00025 #define GUI_VIEW3DPY_H 00026 00027 #include <Base/PyObjectBase.h> 00028 #include <CXX/Extensions.hxx> 00029 00030 class SoEventCallback; 00031 00032 namespace Gui { 00033 00034 class View3DInventor; 00035 00036 class View3DInventorPy : public Py::PythonExtension<View3DInventorPy> 00037 { 00038 public: 00039 static void init_type(void); // announce properties and methods 00040 00041 View3DInventorPy(View3DInventor *vi); 00042 ~View3DInventorPy(); 00043 00044 Py::Object repr(); 00045 Py::Object getattr(const char *); 00046 int setattr(const char *, const Py::Object &); 00047 00048 Py::Object message(const Py::Tuple&); 00049 Py::Object fitAll(const Py::Tuple&); 00050 Py::Object viewBottom(const Py::Tuple&); 00051 Py::Object viewFront(const Py::Tuple&); 00052 Py::Object viewLeft(const Py::Tuple&); 00053 Py::Object viewRear(const Py::Tuple&); 00054 Py::Object viewRight(const Py::Tuple&); 00055 Py::Object viewTop(const Py::Tuple&); 00056 Py::Object viewAxometric(const Py::Tuple&); 00057 Py::Object viewPosition(const Py::Tuple&); 00058 Py::Object startAnimating(const Py::Tuple&); 00059 Py::Object stopAnimating(const Py::Tuple&); 00060 Py::Object setAnimationEnabled(const Py::Tuple&); 00061 Py::Object isAnimationEnabled(const Py::Tuple&); 00062 Py::Object dump(const Py::Tuple&); 00063 Py::Object dumpNode(const Py::Tuple&); 00064 Py::Object setStereoType(const Py::Tuple&); 00065 Py::Object getStereoType(const Py::Tuple&); 00066 Py::Object listStereoTypes(const Py::Tuple&); 00067 Py::Object saveImage(const Py::Tuple&); 00068 Py::Object saveVectorGraphic(const Py::Tuple&); 00069 Py::Object getCamera(const Py::Tuple&); 00070 Py::Object getViewDirection(const Py::Tuple&); 00071 Py::Object setCamera(const Py::Tuple&); 00072 Py::Object setCameraOrientation(const Py::Tuple&); 00073 Py::Object getCameraType(const Py::Tuple&); 00074 Py::Object setCameraType(const Py::Tuple&); 00075 Py::Object getCameraNode(const Py::Tuple&); 00076 Py::Object listCameraTypes(const Py::Tuple&); 00077 Py::Object getCursorPos(const Py::Tuple&); 00078 Py::Object getObjectInfo(const Py::Tuple&); 00079 Py::Object getObjectsInfo(const Py::Tuple&); 00080 Py::Object getSize(const Py::Tuple&); 00081 Py::Object getPoint(const Py::Tuple&); 00082 Py::Object addEventCallback(const Py::Tuple&); 00083 Py::Object removeEventCallback(const Py::Tuple&); 00084 Py::Object setAnnotation(const Py::Tuple&); 00085 Py::Object removeAnnotation(const Py::Tuple&); 00086 Py::Object getSceneGraph(const Py::Tuple&); 00087 Py::Object getViewer(const Py::Tuple&); 00088 Py::Object addEventCallbackPivy(const Py::Tuple&); 00089 Py::Object removeEventCallbackPivy(const Py::Tuple&); 00090 Py::Object listNavigationTypes(const Py::Tuple&); 00091 Py::Object getNavigationType(const Py::Tuple&); 00092 Py::Object setNavigationType(const Py::Tuple&); 00093 00094 private: 00095 static void eventCallback(void * ud, SoEventCallback * n); 00096 static void eventCallbackPivy(void * ud, SoEventCallback * n); 00097 static void eventCallbackPivyEx(void * ud, SoEventCallback * n); 00098 00099 private: 00100 typedef PyObject* (*method_varargs_handler)(PyObject *_self, PyObject *_args); 00101 static method_varargs_handler pycxx_handler; 00102 static PyObject *method_varargs_ext_handler(PyObject *_self, PyObject *_args); 00103 00104 private: 00105 std::list<PyObject*> callbacks; 00106 View3DInventor* _view; 00107 friend class View3DInventor; 00108 }; 00109 00110 } // namespace Gui 00111 00112 #endif //GUI_VIEW3DPY_H