MvcDiagram/views/diagramviewevents.h

Go to the documentation of this file.
00001 /*  -*- c++ -*-  (for Emacs)
00002  *
00003  *  diagramviewevents.h
00004  *  Digest
00005  * 
00006  *  Created by Aidan Lane on Thu Jun 15 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 DIAGRAMVIEWEVENTS_H
00026 #define DIAGRAMVIEWEVENTS_H
00027 
00028 
00029 #include "MvcCore/elementdocviewevents.h"
00030 
00031 #include "mvcdiagram.h"
00032 #include "diagramcontainers.h"
00033 
00034 
00035 class VDiagramEvent : public VElementDocEvent {
00036 public:
00037   enum Type {
00038     ElementControlPointInserted  = VElementDocEvent::User,
00039     ElementControlPointRemoved,
00040     ElementControlPointMoved,
00041     ElementSelectionChanged,
00042     User                         = VElementDocEvent::User + 1000
00043   };
00044 
00045   VDiagramEvent( Type type, MvcBase* sender )
00046     : VElementDocEvent((VElementDocEvent::Type)type, sender) {}
00047 
00049   inline static MvcModuleId_t classModuleId() { return MvcDiagram::id(); }
00051   virtual MvcModuleId_t moduleId() const { return classModuleId(); }
00052 };
00053 
00054 
00055 class VDiagramElementEvent : public VDiagramEvent,
00056                              public AbstractElementContainer {
00057 public:
00058   VDiagramElementEvent( Type type, AbstractElement* element,
00059                         MvcBase* sender )
00060     : VDiagramEvent(type, sender),
00061       AbstractElementContainer(element) {}
00062 };
00063 
00064 
00069 class VControlPointEvent : public VDiagramElementEvent, public IndexContainer {
00070 public:
00071   VControlPointEvent( Type type, AbstractElement* element,
00072                       int index, MvcBase* sender )
00073     : VDiagramElementEvent(type, element, sender),
00074       IndexContainer(index) {}
00075 };
00076 
00077 
00078 
00079 class VControlPointInsertedEvent : public VControlPointEvent,
00080                                    public ControlPointContainer {
00081 public:
00082   VControlPointInsertedEvent( AbstractElement* element,
00083                               int index, const QPointF& pos, MvcBase* sender )
00084     : VControlPointEvent(ElementControlPointInserted, element, index, sender),
00085       ControlPointContainer(pos) {}
00086 };
00087 
00088 
00097 class VControlPointRemovedEvent : public VControlPointEvent {
00098 public:
00099   VControlPointRemovedEvent( AbstractElement* element,
00100                              int index, MvcBase* sender )
00101     : VControlPointEvent(ElementControlPointRemoved, element, index, sender) {}
00102 };
00103 
00104 
00105 class VControlPointMovedEvent : public VControlPointEvent,
00106                                 public ControlPointContainer {
00107 public:
00108   VControlPointMovedEvent( AbstractElement* element,
00109                            int index, const QPointF& pos, MvcBase* sender )
00110     : VControlPointEvent(ElementControlPointMoved, element, index, sender),
00111       ControlPointContainer(pos) {}
00112 };
00113 
00114 
00131 class VElementSelectionChangedEvent : public VDiagramEvent {
00132 public:
00133   VElementSelectionChangedEvent( const AbstractElementSet& addedToSelection,
00134                                  const AbstractElementSet& removedFromSelection,
00135                                  MvcBase* sender )
00136     : VDiagramEvent(ElementSelectionChanged, sender),
00137       m_addedToSelection(addedToSelection),
00138       m_removedFromSelection(removedFromSelection) {}
00139 
00140   const AbstractElementSet& addedToSelection() {
00141     return m_addedToSelection;
00142   }
00143   const AbstractElementSet& removedFromSelection() {
00144     return m_removedFromSelection;
00145   }
00146 
00147 private:
00148   const AbstractElementSet m_addedToSelection;
00149   const AbstractElementSet m_removedFromSelection;
00150 };
00151 
00152 
00153 #endif //  ! DIAGRAMVIEWEVENTS_H

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