1 /***************************************************************************
2 * Copyright (C) 2007 by Schpilka Yannick *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
20 * In addition, as a special exception, the copyright holders give *
21 * permission to link the code of this program with any edition of *
22 * the Qt library by Trolltech AS, Norway (or with modified versions *
23 * of Qt that use the same license as Qt), and distribute linked *
24 * combinations including the two. You must obey the GNU General *
25 * Public License in all respects for all of the code used other than *
26 * Qt. If you modify this file, you may extend this exception to *
27 * your version of the file, but you are not obligated to do so. If *
28 * you do not wish to do so, delete this exception statement from *
30 ***************************************************************************/
34 #include <qscrollview.h>
37 @author Schpilka Yannick <yschpilka@gmail.com>
46 class Graph : public QScrollView
50 Graph(QWidget *parent,QString id);
54 /**Ajouter un noeud dans le graphe*/
55 void operator<<( Node *node );
57 void add (Node *n,QPoint p);
59 void link(Node *source, Node *cible );
61 /** Dessin du graphe*/
62 void paintEvent(QPaintEvent *ev);
66 /** Creation d'un noeud a l'aide de boite de dialogue*/
69 /** Creation d'un lien a l'aide de boite de dialogue*/
72 /** Commencer la creation d'un lien a partir d'un noeud source*/
73 void beginEdge(QString);
75 /** Terminer la creation d'un lien a partir d'un noeud cible*/
76 void endEdge(QString target);
78 /** Annuler la creation d'un lien*/
81 /** Montre une vue d'ensemble du graphe */
84 /** Ouvrir une boite de dialogue de choix de couleur*/
87 /** Met a jour le tooltip */
100 /** On drag un noeud ou une couleur*/
101 void dragEnterEvent(QDragEnterEvent *event);
102 void dropEvent(QDropEvent *event);
104 /** Pop du menu contextuel*/
105 void mouseReleaseEvent(QMouseEvent *event);
107 /** Quand on bouge la souris dans le graphe */
108 void contentsMouseMoveEvent ( QMouseEvent * event);
113 /** Menu contextuel */
114 QPopupMenu *context_menu;
116 /** Liste des noeuds */
119 /** Liste des liens */
120 QPtrList<Edge> edges;
122 /** Flag a true quand on est mode dessin*/
125 QPoint start_drawing_edge;
126 QString source_drawing_edge;
128 /** Initialisation du menu contextuel */
129 void initContextMenu();