00001 /* This file is part of Rocs, 00002 Copyright (C) 2008 by: 00003 Tomaz Canabrava <tomaz.canabrava@gmail.com> 00004 Ugo Sangiori <ugorox@gmail.com> 00005 00006 Rocs is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 Rocs is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with Step; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 #ifndef MOVENODE_H 00022 #define MOVENODE_H 00023 00024 #include "AbstractAction.h" 00025 #include <QObject> 00026 #include <QPointF> 00027 class QGraphicsLineItem; 00028 class QGraphicsSvgItem; 00029 class QGraphicsItem; 00030 class QObject; 00031 class NodeItem; 00032 class Node; 00033 class Graph; 00034 class QGraphicsView; 00035 00042 class MoveNodeAction : public AbstractAction 00043 { 00044 Q_OBJECT 00045 public: 00051 explicit MoveNodeAction( GraphScene* scene, QObject* parent = 0 ); 00052 00056 ~MoveNodeAction(); 00057 public slots: 00062 void executePress( QPointF pos ); 00066 void executeMove( QPointF pos ); 00067 00071 void executeRelease( QPointF pos ); 00072 00073 signals: 00074 void addEdge( Node* from, Node* to, QGraphicsSvgItem* cFrom, QGraphicsSvgItem* cTo ); 00075 00076 protected: 00078 NodeItem* _movableNode; 00079 00082 Node* _node; 00083 00085 Graph* _g; 00086 00087 GraphScene* _graphScene; 00088 00090 QGraphicsView* _view; 00091 00093 QPointF _startPos; 00094 00096 QGraphicsLineItem* _tmpLine; 00097 00099 NodeItem* _nodeTo; 00100 00102 QGraphicsSvgItem* _svgAt; 00103 00105 QGraphicsSvgItem* _svgFrom; 00106 00108 QList<QGraphicsItem*> _itemsUnderCursor; 00109 }; 00110 00111 #endif