00001 /* This file is part of Rocs, 00002 Copyright (C) 2008 by: 00003 Tomaz Canabrava <tomaz.canabrava@gmail.com> 00004 00005 Rocs is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 Rocs is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with Step; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 */ 00019 00020 #ifndef SUI_GRAPHVISUALEDITOR_H 00021 #define SUI_GRAPHVISUALEDITOR_H 00022 00023 #include <QWidget> 00024 #include <QString> 00025 #include <QCursor> 00026 #include <KIcon> 00027 #include <QTime> 00028 #include "AlignAction.h" 00029 00030 class GraphDocument; 00031 class Graph; 00032 class Node; 00033 class GraphScene; 00034 class QToolButton; 00035 class MainWindow; 00036 class NodeItem; 00037 class QGraphicsView; 00038 00039 class GraphVisualEditor : public QWidget 00040 { 00041 Q_OBJECT 00042 public: 00045 GraphVisualEditor( MainWindow* parent = 0 ); 00046 00047 GraphScene* scene() const; 00048 QGraphicsView* view() const; 00049 MainWindow* mainWindow(); 00050 00054 void releaseGraphDocument(); 00055 00056 public slots: 00060 void setActiveGraph( Graph* g ); 00061 00062 void setActiveGraphDocument( GraphDocument* graphDocument ); 00063 QList<NodeItem*> selectedNodes() const; 00064 void displaySadnessSlot(); 00065 00066 private: 00067 void setupWidgets(); 00070 void drawGraphOnScene( Graph* g ); 00071 00072 QToolButton* setupToolButton( const QString& actionName, const QString& tooltip, AlignAction::Orientation o, QWidget* parent ); 00073 00074 00075 00076 GraphScene* _scene; 00077 GraphDocument* _graphDocument; 00078 Graph* _graph; 00079 00080 MainWindow* _mainWindow; 00081 00082 qreal _topNode; 00083 qreal _bottomNode; 00084 qreal _leftNode; 00085 qreal _rightNode; 00086 00087 QGraphicsView* _graphicsView; 00088 QTime _time; 00089 00090 }; 00091 00092 #endif