Tulip  4.4.0
Better Visualization Through Research
 All Classes Namespaces 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 <QFrame>
25 #include <QAction>
26 
27 #include <tulip/tulipconf.h>
28 
29 class QDragEnterEvent;
30 class QGraphicsObject;
31 class QPropertyAnimation;
32 class QGraphicsProxyWidget;
33 class QGraphicsRectItem;
34 class QMimeData;
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 {
47  Q_OBJECT
48 
49  Ui::WorkspacePanel* _ui;
50  tlp::View* _view;
51  QString _viewName;
52  QMap<QAction*, QWidget*> _actionTriggers;
53  QGraphicsRectItem* _overlayRect;
54 
55  QGraphicsProxyWidget* _viewConfigurationWidgets;
56  bool _viewConfigurationExpanded;
57  QGraphicsProxyWidget* _currentInteractorConfigurationItem;
58 
59  QPointF configurationTabPosition(bool expanded) const;
60  void setConfigurationTabExpanded(bool expanded, bool animate=true);
61 
62 public:
63  explicit WorkspacePanel(tlp::View* view, QWidget* parent=NULL);
64  virtual ~WorkspacePanel();
65 
66  bool eventFilter(QObject *, QEvent *);
67 
68  tlp::View* view() const;
69  QString viewName() const;
70 
71 public slots:
72  void setView(tlp::View* view);
73  void setCurrentInteractor(tlp::Interactor*);
74  void setGraphsModel(tlp::GraphHierarchiesModel*);
75  void viewGraphSet(tlp::Graph*);
76  void setOverlayMode(bool);
77 
78 signals:
79  void drawNeeded();
80  void swapWithPanels(WorkspacePanel* panel);
81 
82 protected slots:
83  void hideConfigurationTab();
84  void interactorActionTriggered();
85  void viewDestroyed();
86  void graphComboIndexChanged();
87  void setCurrentInteractorConfigurationVisible(bool);
88  void actionChanged();
89 
90  void scrollInteractorsRight();
91  void scrollInteractorsLeft();
92  void resetInteractorsScrollButtonsVisibility();
93  void refreshInteractorsToolbar();
94 
95 protected:
96 
97 
98  void resizeEvent(QResizeEvent *);
99 
100  void dragEnterEvent(QDragEnterEvent *);
101  void dropEvent(QDropEvent *);
102  void dragLeaveEvent(QDragLeaveEvent *);
103 
104  bool handleDragEnterEvent(QEvent* e, const QMimeData* mimedata);
105  bool handleDropEvent(const QMimeData* mimedata);
106 
107 };
108 
109 }
110 
111 #endif // WORKSPACEPANEL_H
112 ///@endcond