MvcDiagram/controllers/diagramcontrollerevents.h

Go to the documentation of this file.
00001 /*  -*- c++ -*-  (for Emacs)
00002  *
00003  *  diagramcontrollerevents.h
00004  *  Digest
00005  * 
00006  *  Created by Aidan Lane on Thu Jun 14 2005.
00007  *  Copyright (c) 2005 Optimisation and Constraint Solving Group,
00008  *  Monash University. All rights reserved.
00009  *
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00023  */
00024 
00025 #ifndef DIAGRAMCONTROLLEREVENTS_H
00026 #define DIAGRAMCONTROLLEREVENTS_H
00027 
00028 
00029 #include "MvcCore/elementdoccontrollerevents.h"
00030 
00031 #include "mvcdiagram.h"
00032 #include "diagramcontainers.h"
00033 
00034 class AbstractElement;
00035 
00036 
00037 class CDiagramEvent : public CElementDocEvent {
00038 public:
00039   enum Type {
00040     ElementControlPointInsert  = CElementDocEvent::User,
00041     ElementControlPointRemove,
00042     ElementControlPointMove,
00043     ChangeElementSelection,
00044     RemoveAllSelectedElements,
00045     User                       = CElementDocEvent::User + 1000
00046   };
00047 
00048   CDiagramEvent( Type type,
00049                  QObject* sender = 0, Flags flags = NoFlags )
00050     : CElementDocEvent((CElementDocEvent::Type)type, sender, flags) {}
00051 
00053   inline static MvcModuleId_t classModuleId() { return MvcDiagram::id(); }
00055   virtual MvcModuleId_t moduleId() const { return classModuleId(); }
00056 };
00057 
00058 
00059 class CDiagramElementEvent : public CDiagramEvent,
00060                              public AbstractElementContainer {
00061 public:
00062   CDiagramElementEvent( Type type, AbstractElement* element,
00063                         QObject* sender = 0,
00064                         Flags flags = NoFlags )
00065     : CDiagramEvent(type, sender, flags),
00066       AbstractElementContainer(element) {}
00067 };
00068 
00069 
00074 class CControlPointEvent : public CDiagramElementEvent, public IndexContainer {
00075 public:
00076   CControlPointEvent( Type type, AbstractElement* element, int index,
00077                       QObject* sender = 0, Flags flags = NoFlags )
00078     : CDiagramElementEvent(type, element, sender, flags),
00079       IndexContainer(index) {}
00080 };
00081 
00082 
00083 
00084 class CControlPointInsertEvent : public CControlPointEvent, public ControlPointContainer {
00085 public:
00086   CControlPointInsertEvent( AbstractElement* element,
00087                             int index, const QPointF& pos,
00088                             QObject* sender = 0,
00089                             Flags flags = NoFlags )
00090     : CControlPointEvent(ElementControlPointInsert, element, index,
00091                          sender, flags),
00092       ControlPointContainer(pos) {}
00093 };
00094 
00095 
00104 class CControlPointRemoveEvent : public CControlPointEvent {
00105 public:
00106   CControlPointRemoveEvent( AbstractElement* element, int index,
00107                             QObject* sender = 0,
00108                             Flags flags = NoFlags )
00109     : CControlPointEvent(ElementControlPointRemove, element, index,
00110                          sender, flags) {}
00111 };
00112 
00113 
00114 class CControlPointMoveEvent : public CControlPointEvent, public ControlPointContainer {
00115 public:
00116   CControlPointMoveEvent( AbstractElement* element,
00117                           int index, const QPointF& pos,
00118                           QObject* sender = 0,
00119                           Flags flags = NoFlags )
00120     : CControlPointEvent(ElementControlPointMove, element, index,
00121                          sender, flags),
00122       ControlPointContainer(pos) {}
00123 };
00124 
00125 
00145 class CChangeElementSelectionEvent : public CDiagramEvent {
00146 
00147 public:
00148   CChangeElementSelectionEvent( const AbstractElementSet& addToSelection,
00149                                 const AbstractElementSet& removeFromSelection,
00150                                 QObject* sender = 0, Flags flags = NoFlags )
00151     : CDiagramEvent(ChangeElementSelection, sender, flags),
00152       m_addToSelection(addToSelection),
00153       m_removeFromSelection(removeFromSelection) {}
00154 
00155   const AbstractElementSet& addToSelection() {
00156     return m_addToSelection;
00157   }
00158   const AbstractElementSet& removeFromSelection() {
00159     return m_removeFromSelection;
00160   }
00161 
00162 private:
00163   const AbstractElementSet m_addToSelection;
00164   const AbstractElementSet m_removeFromSelection;
00165 };
00166 
00167 
00168 #endif //  ! DIAGRAMCONTROLLEREVENTS_H

Generated on Mon Jul 30 09:46:50 2007 for Digest by  doxygen 1.5.2