Debian Codegraph @

src/Gui/MDIViewPyWrap.h

raw
1 /***************************************************************************
2 * Copyright (c) 2022 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_MDIVIEWPYWRAP_H
24 #define GUI_MDIVIEWPYWRAP_H
25
26 #include <memory>
27 #include <Gui/MDIView.h>
28 #include <CXX/Objects.hxx>
29
30
31 namespace Gui
32 {
33
34 class MDIViewPyWrapImp;
35 class GuiExport MDIViewPyWrap: public MDIView
36 {
37 Q_OBJECT
38
39 TYPESYSTEM_HEADER_WITH_OVERRIDE();
40
41 public:
42 /** View constructor
43 * Attach the view to the given document. If the document is zero
44 * the view will attach to the active document. Be aware, there isn't
45 * always an active document.
46 */
47 explicit MDIViewPyWrap(
48 const Py::Object& py,
49 Gui::Document* pcDocument,
50 QWidget* parent = nullptr,
51 Qt::WindowFlags wflags = Qt::WindowFlags()
52 );
53 /** View destructor
54 * Detach the view from the document, if attached.
55 */
56 ~MDIViewPyWrap() override;
57
58 /// Message handler
59 bool onMsg(const char* pMsg, const char** ppReturn) override;
60 /// Message handler test
61 bool onHasMsg(const char* pMsg) const override;
62 /// overwrite when checking on close state
63 bool canClose() override;
64 PyObject* getPyObject() override;
65 /** @name Printing */
66 //@{
67 public Q_SLOTS:
68 void print(QPrinter* printer) override;
69
70 public:
71 /** Print content of view */
72 void print() override;
73 /** Print to PDF file */
74 void printPdf() override;
75 /** Show a preview dialog */
76 void printPreview() override;
77 //@}
78
79 /** @name Undo/Redo actions */
80 //@{
81 QStringList undoActions() const override;
82 QStringList redoActions() const override;
83 //@}
84
85 private:
86 std::unique_ptr<MDIViewPyWrapImp> ptr;
87 };
88
89 } // namespace Gui
90
91 #endif // GUI_MDIVIEWPYWRAP_H