Files
create/src/Gui/View3DViewerPy.h
Stefan Tröger cf167ec60a add View3DInventorViewer python interface
As quarter is not wrapped by SWIG we need to expose our own python interface class.
This is a start with the most important functions to access the render and event
manager. Furthermore all extra functions available next to the swig wrapper functions
are exposed. Everything else can be added when needed.
2014-09-23 10:11:12 +02:00

78 lines
3.2 KiB
C++

/***************************************************************************
* Copyright (c) Stefan Tröger (stefantroeger@gmx.net) 2014 *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_VIEW3DVIEWERPY_H
#define GUI_VIEW3DVIEWERPY_H
#include <Base/PyObjectBase.h>
#include <CXX/Extensions.hxx>
namespace Gui {
class View3DInventorViewer;
/**
* @brief Python interface for View3DInventorViewer
*
* The interface does not offer all methods the c++ View3DInventorViewer counterpart has, respectivly
* also not everything the QuarterWidget and the SoQtQuarterAdaptor offers. It only exposes
* methods with additioanl functionality in comparison to the View3DInventorPy class. Everything that
* can be done from there has no interface here.
*/
class View3DInventorViewerPy : public Py::PythonExtension<View3DInventorViewerPy>
{
public:
static void init_type(void); // announce properties and methods
View3DInventorViewerPy(View3DInventorViewer *vi);
~View3DInventorViewerPy();
Py::Object repr();
Py::Object getattr(const char *);
int setattr(const char *, const Py::Object &);
//exposed methods
Py::Object getSoEventManager(const Py::Tuple&);
Py::Object getSoRenderManager(const Py::Tuple&);
Py::Object seekToPoint(const Py::Tuple&);
Py::Object setFocalDistance(const Py::Tuple& args);
Py::Object getFocalDistance(const Py::Tuple& args);
private:
private:
typedef PyObject* (*method_varargs_handler)(PyObject *_self, PyObject *_args);
static method_varargs_handler pycxx_handler;
static PyObject *method_varargs_ext_handler(PyObject *_self, PyObject *_args);
private:
std::list<PyObject*> callbacks;
View3DInventorViewer* _viewer;
friend class View3DInventorViewer;
};
} // namespace Gui
#endif //GUI_VIEW3DPY_H