![]() |
Tulip
4.6.0
Better Visualization Through Research
|
00001 /* 00002 * 00003 * This file is part of Tulip (www.tulip-software.org) 00004 * 00005 * Authors: David Auber and the Tulip development Team 00006 * from LaBRI, University of Bordeaux 00007 * 00008 * Tulip is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation, either version 3 00011 * of the License, or (at your option) any later version. 00012 * 00013 * Tulip is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 * See the GNU General Public License for more details. 00017 * 00018 */ 00019 ///@cond DOXYGEN_HIDDEN 00020 00021 #ifndef WORKSPACE_H 00022 #define WORKSPACE_H 00023 00024 #include <QWidget> 00025 #include <QMap> 00026 #include <QVector> 00027 00028 #include <tulip/tulipconf.h> 00029 00030 class PlaceHolderWidget; 00031 00032 namespace Ui { 00033 class Workspace; 00034 } 00035 00036 class QPushButton; 00037 class QLabel; 00038 class QMimeData; 00039 00040 namespace tlp { 00041 class PluginProgress; 00042 class View; 00043 class WorkspacePanel; 00044 class Graph; 00045 class GraphHierarchiesModel; 00046 class TulipProject; 00047 00048 class TLP_QT_SCOPE Workspace: public QWidget { 00049 Q_OBJECT 00050 00051 Q_PROPERTY(bool bottomFrameVisible READ isBottomFrameVisible WRITE setBottomFrameVisible) 00052 00053 Ui::Workspace* _ui; 00054 QList<WorkspacePanel*> _panels; 00055 int _currentPanelIndex; 00056 QWidget* _oldWorkspaceMode; 00057 WorkspacePanel* _focusedPanel; 00058 bool _focusedPanelHighlighting; 00059 00060 QMap<QWidget*,QVector<PlaceHolderWidget*> > _modeToSlots; 00061 QMap<QWidget*,QWidget*> _modeSwitches; 00062 GraphHierarchiesModel* _model; 00063 00064 QString panelTitle(WorkspacePanel*) const; 00065 00066 QLabel* _pageCountLabel; 00067 bool _autoCenterViews; 00068 00069 public: 00070 explicit Workspace(QWidget *parent = NULL); 00071 virtual ~Workspace(); 00072 00073 int addPanel(tlp::View*); 00074 QList<tlp::View*> panels() const; 00075 00076 bool isBottomFrameVisible() const; 00077 00078 public slots: 00079 void delView(tlp::View* view); 00080 void switchToStartupMode(); 00081 void switchToSingleMode(); 00082 void setSingleModeSwitch(QWidget*); 00083 void switchToSplitMode(); 00084 void setSplitModeSwitch(QWidget*); 00085 void switchToSplitHorizontalMode(); 00086 void setSplitHorizontalModeSwitch(QWidget*); 00087 void switchToSplit3Mode(); 00088 void setSplit3ModeSwitch(QWidget*); 00089 void switchToSplit32Mode(); 00090 void setSplit32ModeSwitch(QWidget*); 00091 void switchToSplit33Mode(); 00092 void setSplit33ModeSwitch(QWidget*); 00093 void switchToGridMode(); 00094 void setGridModeSwitch(QWidget*); 00095 void switchToSixMode(); 00096 void setSixModeSwitch(QWidget*); 00097 00098 void nextPage(); 00099 void previousPage(); 00100 void setExposeModeSwitch(QPushButton *); 00101 void expose(bool); 00102 void showExposeMode(); 00103 void hideExposeMode(); 00104 void closeAll(); 00105 void setActivePanel(tlp::View*); 00106 void setModel(tlp::GraphHierarchiesModel*); 00107 tlp::GraphHierarchiesModel* graphModel() const; 00108 00109 void writeProject(tlp::TulipProject*,QMap<tlp::Graph*,QString>, tlp::PluginProgress*); 00110 void readProject(tlp::TulipProject*,QMap<QString,tlp::Graph*>,tlp::PluginProgress*); 00111 00112 void setBottomFrameVisible(bool); 00113 void setPageCountLabel(QLabel* l); 00114 00115 void redrawPanels(bool center=false); 00116 00117 void setAutoCenterPanelsOnDraw(bool); 00118 00119 void setFocusedPanelHighlighting(bool); 00120 00121 void setGraphForFocusedPanel(tlp::Graph*); 00122 00123 signals: 00124 void panelFocused(tlp::View*); 00125 void focusedPanelSynchronized(); 00126 void addPanelRequest(tlp::Graph* g = NULL); 00127 void importGraphRequest(); 00128 00129 protected slots: 00130 void viewNeedsDraw(); 00131 void switchWorkspaceMode(QWidget* page); 00132 void panelDestroyed(QObject*); 00133 void updatePageCountLabel(); 00134 void updateAvailableModes(); 00135 void updatePanels(); 00136 void uncheckExposeButton(); 00137 QWidget* suitableMode(QWidget* oldMode); 00138 WorkspacePanel* panelForScene(QObject* obj); 00139 void swapPanelsRequested(WorkspacePanel* panel); 00140 void updateStartupMode(); 00141 void changeFocusedPanelSynchronization(bool); 00142 00143 protected: 00144 00145 virtual void dragEnterEvent(QDragEnterEvent* event); 00146 virtual void dropEvent(QDropEvent* event); 00147 00148 bool handleDragEnterEvent(QEvent* e, const QMimeData* mimedata); 00149 bool handleDropEvent(const QMimeData* mimedata); 00150 00151 bool eventFilter(QObject *, QEvent *); 00152 00153 QWidget* currentModeWidget() const; 00154 QVector<PlaceHolderWidget*> currentModeSlots() const; 00155 unsigned int currentSlotsCount() const; 00156 00157 void setFocusedPanel(WorkspacePanel* panel); 00158 }; 00159 } 00160 00161 #endif // WORKSPACE_H 00162 ///@endcond