00001 /* -*- c++ -*- (for Emacs) 00002 * 00003 * diagramcontroller.h 00004 * Digest 00005 * 00006 * Imported into Digest by Aidan Lane on Thu Jun 9 2005. 00007 * Modifications Copyright (c) 2005 Optimisation and Constraint Solving Group, 00008 * Monash University. All rights reserved. 00009 * 00010 * Nodal file: 00011 * 00012 * projectcontroller.h 00013 * Nodal 00014 * 00015 * Imported into Nodal by Aidan Lane on Thu Feb 24 2005. 00016 * Modifications Copyright (c) 2005 CEMA, Monash University. All rights reserved. 00017 * 00018 * Original file: 00019 * 00020 * project.h 00021 * EverGreen 00022 * 00023 * Created by Aidan Lane on Wed Jul 14 2004. 00024 * Copyright (c) 2004 Aidan Lane. All rights reserved. 00025 * 00026 * This program is free software; you can redistribute it and/or modify 00027 * it under the terms of the GNU General Public License as published by 00028 * the Free Software Foundation; either version 2 of the License, or 00029 * (at your option) any later version. 00030 * 00031 * This program is distributed in the hope that it will be useful, 00032 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00033 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00034 * GNU General Public License for more details. 00035 * 00036 * You should have received a copy of the GNU General Public License 00037 * along with this program; if not, write to the Free Software 00038 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00039 */ 00040 00041 #ifndef DIAGRAMCONTROLLER_H 00042 #define DIAGRAMCONTROLLER_H 00043 00044 00045 #include "MvcCore/elementdoccontroller.h" 00046 00047 #include <QPointer> 00048 #include <QReadWriteLock> 00049 00050 #include "diagramcontrollerevents.h" 00051 00052 class Diagram; 00053 00054 00068 class DiagramController : public ElementDocController { 00069 00070 Q_OBJECT 00071 00072 public: 00073 DiagramController( QObject* parent = 0 ); 00074 DiagramController( AbstractModel* diagram, QObject* parent = 0 ); 00075 00076 Diagram* diagram() const; 00077 00084 const AbstractElementSet& elementSelection() const { 00085 return m_elementSelection; 00086 } 00087 00089 inline static MvcModuleId_t classModuleId() { return MvcDiagram::id(); } 00091 virtual MvcModuleId_t moduleId() const { return classModuleId(); } 00092 00093 00094 public slots: 00095 virtual void elementSelectionBringToFront(); 00096 virtual void elementSelectionSendToBack(); 00097 virtual void elementSelectionBringForward(); 00098 virtual void elementSelectionSendBackward(); 00099 00100 00101 protected: 00102 virtual void dispatchEvent( CEvent* ); 00103 00104 virtual void changeModelEvent( CChangeModelEvent* ); 00105 00106 virtual void elementRemoveEvent( CElementRemoveEvent* ); 00107 00108 virtual void controlPointInsertEvent( CControlPointInsertEvent* ); 00109 virtual void controlPointRemoveEvent( CControlPointRemoveEvent* ); 00110 virtual void controlPointMoveEvent( CControlPointMoveEvent* ); 00111 virtual void changeElementSelectionEvent( CChangeElementSelectionEvent* ); 00112 virtual void removeAllSelectedElementsEvent( CDiagramEvent* ); 00113 00114 00115 private: 00116 // The following variable is only used for synchronising graphical representations. 00117 AbstractElementSet m_elementSelection; 00118 mutable QReadWriteLock m_elementSelectionLock; 00119 00120 // Temporary caches: 00121 QPointer<Diagram> c_diagram; 00122 }; 00123 00124 00125 #endif // ! DIAGRAMCONTROLLER_H
1.5.2