Tulip  4.4.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
TulipViewsUtils.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 
20 /**
21  *
22  * This file is part of Tulip (www.tulip-software.org)
23  *
24  * Authors: David Auber and the Tulip development Team
25  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
26  *
27  * Tulip is free software; you can redistribute it and/or modify
28  * it under the terms of the GNU Lesser General Public License
29  * as published by the Free Software Foundation, either version 3
30  * of the License, or (at your option) any later version.
31  *
32  * Tulip is distributed in the hope that it will be useful,
33  * but WITHOUT ANY WARRANTY; without even the implied warranty of
34  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
35  * See the GNU General Public License for more details.
36  *
37  */
38 
39 #ifndef VIEW_MAIN_WINDOW_H
40 #define VIEW_MAIN_WINDOW_H
41 
42 #include <QMainWindow>
43 
44 #include <tulip/Graph.h>
45 #include <tulip/Observable.h>
46 #include <tulip/View.h>
47 #include <tulip/GraphHierarchiesModel.h>
48 #include <tulip/Workspace.h>
49 #include <tulip/WorkspacePanel.h>
50 
51 typedef std::set< tlp::Observable * >::iterator ObserverIterator;
52 
53 class TulipViewsManager;
54 
55 class ViewMainWindow : public QMainWindow {
56 
57  Q_OBJECT
58 
59 public :
60 
61  ViewMainWindow();
62 
63 };
64 
65 class TulipViewsManager : public QObject {
66 
67  Q_OBJECT
68 
69 public :
70 
71  TulipViewsManager();
72 
73  std::vector<std::string> getTulipViews();
74 
75  std::vector<tlp::View *> getOpenedViews();
76 
77  std::vector<tlp::View *> getOpenedViewsWithName(const std::string &viewName);
78 
79  tlp::View *addView(const std::string &viewName, tlp::Graph *graph, const tlp::DataSet &dataSet = tlp::DataSet(), bool show=true);
80 
81  void closeView(tlp::View *view);
82 
83  std::vector<tlp::View*> getViewsOfGraph(tlp::Graph *graph);
84 
85  void closeAllViews();
86 
87  void closeViewsRelatedToGraph(tlp::Graph* graph);
88 
89  void setViewVisible(tlp::View *view, const bool visible);
90 
91  bool areViewsVisible();
92 
93  void resizeView(tlp::View *view, int width, int height);
94 
95  void setViewPos(tlp::View *view, int x, int y);
96 
97  tlp::GraphHierarchiesModel *graphModel() const {
98  return model;
99  }
100 
101  tlp::Workspace *tlpWorkspace();
102 
103 public slots:
104 
105  void viewDestroyed(QObject *view);
106 
107 private:
108 
109  std::vector<tlp::View *> openedViews;
110  std::map<tlp::View *, tlp::WorkspacePanel *> viewToPanel;
111  std::map<tlp::View *, ViewMainWindow *> viewToWindow;
112  tlp::GraphHierarchiesModel *model;
113 
114 };
115 
116 #endif