Debian Codegraph @

src/Gui/SplitView3DInventor.h

raw
1 /***************************************************************************
2 * Copyright (c) 2006 Werner Mayer <wmayer[at]users.sourceforge.net> *
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_SPLITVIEW3DINVENTOR_H
24 #define GUI_SPLITVIEW3DINVENTOR_H
25
26 #include "MDIView.h"
27 #include "MDIViewPy.h"
28
29 #include <Base/Parameter.h>
30 #include <vector>
31
32
33 namespace Gui
34 {
35 class View3DInventorViewer;
36 class AbstractSplitViewPy;
37 class View3DSettings;
38
39 /** The SplitView3DInventor class allows one to create a window with two or more Inventor views.
40 * \author Werner Mayer
41 */
42 class GuiExport AbstractSplitView: public MDIView
43 {
44 Q_OBJECT
45
46 TYPESYSTEM_HEADER_WITH_OVERRIDE();
47
48 public:
49 AbstractSplitView(
50 Gui::Document* pcDocument,
51 QWidget* parent,
52 Qt::WindowFlags wflags = Qt::WindowFlags()
53 );
54 ~AbstractSplitView() override;
55
56 const char* getName() const override;
57
58 /// Message handler
59 bool onMsg(const char* pMsg, const char** ppReturn) override;
60 bool onHasMsg(const char* pMsg) const override;
61 void onUpdate() override;
62 void deleteSelf() override;
63 void viewAll() override;
64
65 View3DInventorViewer* getViewer(unsigned int) const;
66 void setOverrideCursor(const QCursor&) override;
67 bool containsViewProvider(const ViewProvider*) const override;
68
69 PyObject* getPyObject() override;
70 void setPyObject(PyObject*) override;
71 int getSize();
72
73 protected:
74 void setDocumentOfViewers(Gui::Document* document);
75 void setupSettings();
76
77 protected:
78 std::vector<View3DInventorViewer*> _viewer;
79 PyObject* _viewerPy;
80 std::unique_ptr<View3DSettings> viewSettings;
81 };
82
83 class AbstractSplitViewPy: public Py::PythonExtension<AbstractSplitViewPy>
84 {
85 public:
86 using BaseType = Py::PythonExtension<AbstractSplitViewPy>;
87 static void init_type(); // announce properties and methods
88
89 AbstractSplitViewPy(AbstractSplitView* vi);
90 ~AbstractSplitViewPy() override;
91 AbstractSplitView* getSplitViewPtr();
92
93 Py::Object repr() override;
94 Py::Object getattr(const char*) override;
95 Py::Object cast_to_base(const Py::Tuple&);
96
97 Py::Object fitAll(const Py::Tuple&);
98 Py::Object viewBottom(const Py::Tuple&);
99 Py::Object viewFront(const Py::Tuple&);
100 Py::Object viewLeft(const Py::Tuple&);
101 Py::Object viewRear(const Py::Tuple&);
102 Py::Object viewRight(const Py::Tuple&);
103 Py::Object viewTop(const Py::Tuple&);
104 Py::Object viewIsometric(const Py::Tuple&);
105 Py::Object getViewer(const Py::Tuple&);
106 Py::Object sequence_item(Py_ssize_t) override;
107 Py::Object close(const Py::Tuple&);
108 PyCxx_ssize_t sequence_length() override;
109
110 private:
111 Gui::MDIViewPy base;
112 };
113
114 /** The SplitView3DInventor class allows one to create a window with two or more Inventor views.
115 * \author Werner Mayer
116 */
117 class GuiExport SplitView3DInventor: public AbstractSplitView
118 {
119 TYPESYSTEM_HEADER_WITH_OVERRIDE();
120
121 public:
122 SplitView3DInventor(
123 int views,
124 Gui::Document* pcDocument,
125 QWidget* parent,
126 Qt::WindowFlags wflags = Qt::WindowFlags()
127 );
128 ~SplitView3DInventor() override;
129 };
130
131 } // namespace Gui
132
133 #endif // GUI_SPLITVIEW3DINVENTOR_H