Tulip  5.0.0
Large graphs analysis and drawing
TulipMimes.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
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 
22 #ifndef _TLP_MIMES_H
23 #define _TLP_MIMES_H
24 
25 #include <QMimeData>
26 #include <QStringList>
27 
28 #include <tulip/tulipconf.h>
29 #include <tulip/DataSet.h>
30 
31 namespace tlp {
32 class Graph;
33 class WorkspacePanel;
34 class Algorithm;
35 class DataSet;
36 
37 
38 const QString GRAPH_MIME_TYPE=QString("application/x-tulip-mime;value=\"graph\"");
39 const QString WORKSPACE_PANEL_MIME_TYPE=QString("application/x-tulip-mime;value=\"workspace-panel\"");
40 const QString ALGORITHM_NAME_MIME_TYPE=QString("application/x-tulip-mime;value=\"algorithm-name\"");
41 const QString DATASET_MIME_TYPE=QString("application/x-tulip-mime;value=\"dataset\"");
42 
43 /**
44  * @brief The GraphMimeType class allows to tranfer a graph pointer trought a QMimeData
45  */
46 class TLP_QT_SCOPE GraphMimeType : public QMimeData {
47 public:
48  GraphMimeType():QMimeData(),_graph(NULL) {}
49  void setGraph(tlp::Graph* graph) {
50  _graph = graph;
51  }
52 
53  tlp::Graph* graph() const {
54  return _graph;
55  }
56 
57  QStringList formats()const;
58 
59 private:
60  tlp::Graph* _graph;
61 };
62 
63 class TLP_QT_SCOPE AlgorithmMimeType : public QMimeData {
64  Q_OBJECT
65 
66  QString _algorithm;
67  tlp::DataSet _params;
68 public:
69 
70 
71 
72  AlgorithmMimeType(QString algorithmName, const tlp::DataSet& data);
73  void run(tlp::Graph*) const;
74 
75  QString algorithm() const {
76  return _algorithm;
77  }
78  tlp::DataSet params() const {
79  return _params;
80  }
81 
82  QStringList formats()const;
83 
84 signals:
85  void mimeRun(tlp::Graph*) const;
86 };
87 
88 class TLP_QT_SCOPE PanelMimeType : public QMimeData {
89 public:
90 
91 
92 
93  void setPanel(tlp::WorkspacePanel* panel) {
94  _panel = panel;
95  }
96 
97  tlp::WorkspacePanel* panel() const {
98  return _panel;
99  }
100 
101  QStringList formats()const;
102 
103 private:
104  tlp::WorkspacePanel* _panel;
105 };
106 }
107 #endif //_TLP_MIMES_H
108 ///@endcond
A container that can store data from any type.
Definition: DataSet.h:190