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