![]() |
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 00022 #ifndef _TLP_MIMES_H 00023 #define _TLP_MIMES_H 00024 00025 #include <QMimeData> 00026 #include <QStringList> 00027 00028 #include <tulip/tulipconf.h> 00029 #include <tulip/DataSet.h> 00030 00031 namespace tlp { 00032 class Graph; 00033 class WorkspacePanel; 00034 class Algorithm; 00035 class DataSet; 00036 00037 00038 const QString GRAPH_MIME_TYPE=QString("application/x-tulip-mime;value=\"graph\""); 00039 const QString WORKSPACE_PANEL_MIME_TYPE=QString("application/x-tulip-mime;value=\"workspace-panel\""); 00040 const QString ALGORITHM_NAME_MIME_TYPE=QString("application/x-tulip-mime;value=\"algorithm-name\""); 00041 const QString DATASET_MIME_TYPE=QString("application/x-tulip-mime;value=\"dataset\""); 00042 00043 /** 00044 * @brief The GraphMimeType class allows to tranfer a graph pointer trought a QMimeData 00045 */ 00046 class TLP_QT_SCOPE GraphMimeType : public QMimeData { 00047 public: 00048 GraphMimeType():QMimeData(),_graph(NULL) {} 00049 void setGraph(tlp::Graph* graph) { 00050 _graph = graph; 00051 } 00052 00053 tlp::Graph* graph() const { 00054 return _graph; 00055 } 00056 00057 QStringList formats()const; 00058 00059 private: 00060 tlp::Graph* _graph; 00061 }; 00062 00063 class TLP_QT_SCOPE AlgorithmMimeType : public QMimeData { 00064 Q_OBJECT 00065 00066 QString _algorithm; 00067 tlp::DataSet _params; 00068 public: 00069 00070 00071 00072 AlgorithmMimeType(QString algorithmName, const tlp::DataSet& data); 00073 void run(tlp::Graph*) const; 00074 00075 QString algorithm() const { 00076 return _algorithm; 00077 } 00078 tlp::DataSet params() const { 00079 return _params; 00080 } 00081 00082 QStringList formats()const; 00083 00084 signals: 00085 void mimeRun(tlp::Graph*) const; 00086 }; 00087 00088 class TLP_QT_SCOPE PanelMimeType : public QMimeData { 00089 public: 00090 00091 00092 00093 void setPanel(tlp::WorkspacePanel* panel) { 00094 _panel = panel; 00095 } 00096 00097 tlp::WorkspacePanel* panel() const { 00098 return _panel; 00099 } 00100 00101 QStringList formats()const; 00102 00103 private: 00104 tlp::WorkspacePanel* _panel; 00105 }; 00106 } 00107 #endif //_TLP_MIMES_H 00108 ///@endcond