Debian Codegraph @

src/Gui/DAGView/DAGView.h

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 /***************************************************************************
3 * Copyright (c) 2015 Thomas Anderson <blobfish[at]gmx.com> *
4 * *
5 * This file is part of the FreeCAD CAx development system. *
6 * *
7 * This library is free software; you can redistribute it and/or *
8 * modify it under the terms of the GNU Library General Public *
9 * License as published by the Free Software Foundation; either *
10 * version 2 of the License, or (at your option) any later version. *
11 * *
12 * This library is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU Library General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU Library General Public *
18 * License along with this library; see the file COPYING.LIB. If not, *
19 * write to the Free Software Foundation, Inc., 59 Temple Place, *
20 * Suite 330, Boston, MA 02111-1307, USA *
21 * *
22 ***************************************************************************/
23
24 #ifndef DAGVIEW_H
25 #define DAGVIEW_H
26
27 #include <memory>
28 #include <QGraphicsView>
29 #include <boost/signals2.hpp>
30
31 #include <Gui/DockWindow.h>
32 #include <Gui/Document.h>
33 #include <Gui/Selection/Selection.h>
34
35 #include "DAGModel.h"
36
37
38 namespace Gui
39 {
40 namespace DAG
41 {
42 //! @brief view for DAG viewer
43 class View: public QGraphicsView, public SelectionObserver
44 {
45 Q_OBJECT
46 public:
47 explicit View(QWidget* parentIn = nullptr);
48 ~View() override;
49
50 public Q_SLOTS:
51 void awakeSlot(); //!< hooked up to event dispatcher for update when idle.
52
53 private:
54 void onSelectionChanged(const SelectionChanges& msg) override;
55
56 void slotActiveDocument(const Gui::Document& documentIn);
57 void slotDeleteDocument(const Gui::Document& documentIn);
58
59 using ModelMap = std::map<const Gui::Document*, std::shared_ptr<Model>>;
60 ModelMap modelMap;
61 boost::signals2::scoped_connection conActive;
62 boost::signals2::scoped_connection conDelete;
63 };
64
65 //! @brief dock window for DAG viewer
66 class DockWindow: public Gui::DockWindow
67 {
68 Q_OBJECT
69 public:
70 explicit DockWindow(Gui::Document* gDocumentIn = nullptr, QWidget* parent = nullptr);
71 ~DockWindow() override = default;
72
73 private:
74 View* dagView;
75 };
76 } // namespace DAG
77 } // namespace Gui
78
79 #endif // DAGVIEW_H