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 #ifndef ACTION_ABSTRACTACTION_H 00020 #define ACTION_ABSTRACTACTION_H 00021 00022 #include <KToggleAction> 00023 #include <QObject> 00024 #include <QString> 00025 class GraphScene; 00026 class Graph; 00027 class GraphDocument; 00028 00035 // TODO: Changer the behavior of this class, so it sends itself instead of the type of action to the graphscene. 00036 class AbstractAction : public KToggleAction 00037 { 00038 Q_OBJECT 00039 public: 00040 00045 AbstractAction( GraphScene* scene, QObject* parent ); 00046 00050 virtual void setActiveGraphDocument( GraphDocument* graphDocument ); 00051 00052 00053 const QString& name() const; 00054 public slots: 00058 virtual void setActiveGraph( Graph* graph ); 00059 00063 virtual void executePress( QPointF pos ); 00064 00068 virtual void executeMove( QPointF pos ); 00069 00073 virtual void executeRelease( QPointF pos ); 00074 00078 virtual void executeKeyPress( QKeyEvent* keyEvent ); 00079 00083 virtual void executeKeyRelease( QKeyEvent* keyEvent ); 00084 00085 00087 void sendExecuteBit(); 00088 00089 protected: 00091 GraphDocument* _graphDocument; 00092 00094 Graph* _graph; 00095 00097 GraphScene* _graphScene; 00098 00099 QString _name; 00100 }; 00101 00102 #endif