Tulip  4.0.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
WorkspacePanel.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 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef WORKSPACEPANEL_H
22 #define WORKSPACEPANEL_H
23 
24 #include <QtCore/QAbstractItemModel>
25 #include <QtGui/QFrame>
26 #include <tulip/tulipconf.h>
27 #include <tulip/DataSet.h>
28 #include <tulip/SimplePluginProgress.h>
29 
30 class QDragEnterEvent;
31 class QGraphicsObject;
32 class QPropertyAnimation;
33 class QGraphicsProxyWidget;
34 class QGraphicsRectItem;
35 
36 namespace Ui {
37 class WorkspacePanel;
38 }
39 
40 namespace tlp {
41 class Graph;
42 class View;
43 class Interactor;
44 class GraphHierarchiesModel;
45 
46 class TLP_QT_SCOPE WorkspacePanel : public QFrame, public tlp::SimplePluginProgress {
47  Q_OBJECT
48  Q_PROPERTY(bool progressMode READ isProgressMode WRITE toggleProgressMode)
49 
50  Ui::WorkspacePanel* _ui;
51  tlp::View* _view;
52  QString _viewName;
53  QMap<QAction*, QWidget*> _actionTriggers;
54  QGraphicsRectItem* _overlayRect;
55 
56  QGraphicsProxyWidget* _viewConfigurationWidgets;
57  bool _viewConfigurationExpanded;
58  QGraphicsProxyWidget* _currentInteractorConfigurationItem;
59  QGraphicsObject* _progressItem;
60 
61  QPointF configurationTabPosition(bool expanded) const;
62  void setConfigurationTabExpanded(bool expanded, bool animate=true);
63 
64 public:
65  explicit WorkspacePanel(tlp::View* view, QWidget* parent=NULL);
66  virtual ~WorkspacePanel();
67 
68  bool eventFilter(QObject *, QEvent *);
69 
70  tlp::View* view() const;
71  QString viewName() const;
72  bool isProgressMode() const;
73 
74 public slots:
75  void toggleProgressMode(bool p);
76  void setView(tlp::View* view);
77  void setCurrentInteractor(tlp::Interactor*);
78  void setGraphsModel(tlp::GraphHierarchiesModel*);
79  void viewGraphSet(tlp::Graph*);
80  void setOverlayMode(bool);
81 
82 signals:
83  void drawNeeded();
84  void swapWithPanels(WorkspacePanel* panel);
85 
86 protected slots:
87  void hideConfigurationTab();
88  void interactorActionTriggered();
89  void viewDestroyed();
90  void graphComboIndexChanged();
91  void setCurrentInteractorConfigurationVisible(bool);
92  void actionChanged();
93 
94  void scrollInteractorsRight();
95  void scrollInteractorsLeft();
96  void resetInteractorsScrollButtonsVisibility();
97 
98 protected:
99  void progress_handler(int step, int max_step);
100  void refreshInteractorsToolbar();
101 
102  void resizeEvent(QResizeEvent *);
103 
104  void dragEnterEvent(QDragEnterEvent *);
105  void dropEvent(QDropEvent *);
106  void dragLeaveEvent(QDragLeaveEvent *);
107 
108  bool handleDragEnterEvent(QEvent* e, const QMimeData* mimedata);
109  bool handleDropEvent(const QMimeData* mimedata);
110 
111 };
112 
113 }
114 
115 #endif // WORKSPACEPANEL_H
116 ///@endcond