Tulip  4.9.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
Workspace.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
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 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef WORKSPACE_H
22 #define WORKSPACE_H
23 
24 #include <QWidget>
25 #include <QMap>
26 #include <QVector>
27 
28 #include <tulip/tulipconf.h>
29 
30 class PlaceHolderWidget;
31 
32 namespace Ui {
33 class Workspace;
34 }
35 
36 class QPushButton;
37 class QLabel;
38 class QMimeData;
39 
40 namespace tlp {
41 class PluginProgress;
42 class View;
43 class WorkspacePanel;
44 class Graph;
45 class GraphHierarchiesModel;
46 class TulipProject;
47 
48 class TLP_QT_SCOPE Workspace: public QWidget {
49  Q_OBJECT
50 
51  Q_PROPERTY(bool bottomFrameVisible READ isBottomFrameVisible WRITE setBottomFrameVisible)
52 
53  Ui::Workspace* _ui;
54  QList<WorkspacePanel*> _panels;
55  int _currentPanelIndex;
56  QWidget* _oldWorkspaceMode;
57  WorkspacePanel* _focusedPanel;
58  bool _focusedPanelHighlighting;
59 
60  QMap<QWidget*,QVector<PlaceHolderWidget*> > _modeToSlots;
61  QMap<QWidget*,QWidget*> _modeSwitches;
62  GraphHierarchiesModel* _model;
63 
64  QString panelTitle(WorkspacePanel*) const;
65 
66  QLabel* _pageCountLabel;
67  bool _autoCenterViews;
68 
69 public:
70  explicit Workspace(QWidget *parent = NULL);
71  virtual ~Workspace();
72 
73  int addPanel(tlp::View*);
74  QList<tlp::View*> panels() const;
75 
76  bool isBottomFrameVisible() const;
77 
78 public slots:
79  void delView(tlp::View* view);
80  void switchToStartupMode();
81  void switchToSingleMode();
82  void setSingleModeSwitch(QWidget*);
83  void switchToSplitMode();
84  void setSplitModeSwitch(QWidget*);
85  void switchToSplitHorizontalMode();
86  void setSplitHorizontalModeSwitch(QWidget*);
87  void switchToSplit3Mode();
88  void setSplit3ModeSwitch(QWidget*);
89  void switchToSplit32Mode();
90  void setSplit32ModeSwitch(QWidget*);
91  void switchToSplit33Mode();
92  void setSplit33ModeSwitch(QWidget*);
93  void switchToGridMode();
94  void setGridModeSwitch(QWidget*);
95  void switchToSixMode();
96  void setSixModeSwitch(QWidget*);
97 
98  void nextPage();
99  void previousPage();
100  void setExposeModeSwitch(QPushButton *);
101  void expose(bool);
102  void showExposeMode();
103  void hideExposeMode();
104  void closeAll();
105  void setActivePanel(tlp::View*);
106  void setModel(tlp::GraphHierarchiesModel*);
107  tlp::GraphHierarchiesModel* graphModel() const;
108 
109  void writeProject(tlp::TulipProject*,QMap<tlp::Graph*,QString>, tlp::PluginProgress*);
110  void readProject(tlp::TulipProject*,QMap<QString,tlp::Graph*>,tlp::PluginProgress*);
111 
112  void setBottomFrameVisible(bool);
113  void setPageCountLabel(QLabel* l);
114 
115  void redrawPanels(bool center=false);
116 
117  void setAutoCenterPanelsOnDraw(bool);
118 
119  void setFocusedPanelHighlighting(bool);
120 
121  void setGraphForFocusedPanel(tlp::Graph*);
122 
123 signals:
124  void panelFocused(tlp::View*);
125  void focusedPanelSynchronized();
126  void addPanelRequest(tlp::Graph* g = NULL);
127  void importGraphRequest();
128 
129 protected slots:
130  void viewNeedsDraw();
131  void switchWorkspaceMode(QWidget* page);
132  void panelDestroyed(QObject*);
133  void updatePageCountLabel();
134  void updateAvailableModes();
135  void updatePanels();
136  void uncheckExposeButton();
137  QWidget* suitableMode(QWidget* oldMode);
138  WorkspacePanel* panelForScene(QObject* obj);
139  void swapPanelsRequested(WorkspacePanel* panel);
140  void updateStartupMode();
141  void changeFocusedPanelSynchronization(bool);
142 
143 protected:
144 
145  virtual void dragEnterEvent(QDragEnterEvent* event);
146  virtual void dropEvent(QDropEvent* event);
147 
148  bool handleDragEnterEvent(QEvent* e, const QMimeData* mimedata);
149  bool handleDropEvent(const QMimeData* mimedata);
150 
151  bool eventFilter(QObject *, QEvent *);
152 
153  QWidget* currentModeWidget() const;
154  QVector<PlaceHolderWidget*> currentModeSlots() const;
155  unsigned int currentSlotsCount() const;
156 
157  void setFocusedPanel(WorkspacePanel* panel);
158 };
159 }
160 
161 #endif // WORKSPACE_H
162 ///@endcond
The TulipProject object handles the content of a Tulip project.
Definition: TulipProject.h:71
PluginProcess subclasses are meant to notify about the progress state of some process (typically a pl...
View plugins provide a way to dynamically add to a Tulip plateform various ways to visualize a graph...
Definition: View.h:73