| 1 |
/*************************************************************************** |
| 2 |
* Copyright (c) 2014 Stefan Tröger <[email protected]> * |
| 3 |
* * |
| 4 |
* This file is part of the FreeCAD CAx development system. * |
| 5 |
* * |
| 6 |
* This library is free software; you can redistribute it and/or * |
| 7 |
* modify it under the terms of the GNU Library General Public * |
| 8 |
* License as published by the Free Software Foundation; either * |
| 9 |
* version 2 of the License, or (at your option) any later version. * |
| 10 |
* * |
| 11 |
* This library is distributed in the hope that it will be useful, * |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 |
* GNU Library General Public License for more details. * |
| 15 |
* * |
| 16 |
* You should have received a copy of the GNU Library General Public * |
| 17 |
* License along with this library; see the file COPYING.LIB. If not, * |
| 18 |
* write to the Free Software Foundation, Inc., 59 Temple Place, * |
| 19 |
* Suite 330, Boston, MA 02111-1307, USA * |
| 20 |
* * |
| 21 |
***************************************************************************/ |
| 22 |
|
| 23 |
#ifndef GUI_VIEW3DVIEWERPY_H |
| 24 |
#define GUI_VIEW3DVIEWERPY_H |
| 25 |
|
| 26 |
#include <CXX/Extensions.hxx> |
| 27 |
#include <list> |
| 28 |
|
| 29 |
|
| 30 |
namespace Gui |
| 31 |
{ |
| 32 |
|
| 33 |
class View3DInventorViewer; |
| 34 |
|
| 35 |
/** |
| 36 |
* @brief Python interface for View3DInventorViewer |
| 37 |
* |
| 38 |
* The interface does not offer all methods the c++ View3DInventorViewer counterpart has, |
| 39 |
* respectively also not everything the QuarterWidget and the SoQtQuarterAdaptor offers. It only |
| 40 |
* exposes methods with additional functionality in comparison to the View3DInventorPy class. |
| 41 |
* Everything that can be done from there has no interface here. |
| 42 |
*/ |
| 43 |
class View3DInventorViewerPy: public Py::PythonExtension<View3DInventorViewerPy> |
| 44 |
{ |
| 45 |
public: |
| 46 |
static void init_type(); // announce properties and methods |
| 47 |
|
| 48 |
explicit View3DInventorViewerPy(View3DInventorViewer* vi); |
| 49 |
~View3DInventorViewerPy() override; |
| 50 |
|
| 51 |
Py::Object repr() override; |
| 52 |
Py::Object getattr(const char*) override; |
| 53 |
int setattr(const char*, const Py::Object&) override; |
| 54 |
|
| 55 |
// exposed methods |
| 56 |
Py::Object getSoEventManager(const Py::Tuple&); |
| 57 |
Py::Object getSoRenderManager(const Py::Tuple&); |
| 58 |
Py::Object getSceneGraph(const Py::Tuple&); |
| 59 |
Py::Object setSceneGraph(const Py::Tuple&); |
| 60 |
|
| 61 |
Py::Object seekToPoint(const Py::Tuple&); |
| 62 |
Py::Object setFocalDistance(const Py::Tuple& args); |
| 63 |
Py::Object getFocalDistance(const Py::Tuple& args); |
| 64 |
Py::Object getPointOnFocalPlane(const Py::Tuple& args); |
| 65 |
Py::Object getPickRadius(const Py::Tuple& args); |
| 66 |
Py::Object setPickRadius(const Py::Tuple& args); |
| 67 |
|
| 68 |
Py::Object setupEditingRoot(const Py::Tuple& args); |
| 69 |
Py::Object resetEditingRoot(const Py::Tuple& args); |
| 70 |
|
| 71 |
Py::Object setGradientBackground(const Py::Tuple& args); |
| 72 |
Py::Object setGradientBackgroundColor(const Py::Tuple& args); |
| 73 |
Py::Object setBackgroundColor(const Py::Tuple& args); |
| 74 |
Py::Object setRedirectToSceneGraph(const Py::Tuple& args); |
| 75 |
Py::Object isRedirectedToSceneGraph(const Py::Tuple& args); |
| 76 |
Py::Object grabFramebuffer(const Py::Tuple& args); |
| 77 |
|
| 78 |
Py::Object setOverrideMode(const Py::Tuple& args); |
| 79 |
|
| 80 |
// NaviCube handling |
| 81 |
Py::Object setEnabledNaviCube(const Py::Tuple& args); |
| 82 |
Py::Object isEnabledNaviCube(const Py::Tuple& args); |
| 83 |
Py::Object setNaviCubeCorner(const Py::Tuple& args); |
| 84 |
|
| 85 |
Py::Object getNavigationStyle(const Py::Tuple&); |
| 86 |
|
| 87 |
private: |
| 88 |
using method_varargs_handler = PyObject* (*)(PyObject * _self, PyObject* _args); |
| 89 |
static method_varargs_handler pycxx_handler; |
| 90 |
static PyObject* method_varargs_ext_handler(PyObject* _self, PyObject* _args); |
| 91 |
|
| 92 |
private: |
| 93 |
std::list<PyObject*> callbacks; |
| 94 |
View3DInventorViewer* _viewer; |
| 95 |
friend class View3DInventorViewer; |
| 96 |
}; |
| 97 |
|
| 98 |
} // namespace Gui |
| 99 |
|
| 100 |
#endif // GUI_VIEW3DPY_H |