mechanism-arrow.h

00001 // -*- C++ -*-
00002 
00003 /* 
00004  * GChemPaint library
00005  * mechanism-arrow.h 
00006  *
00007  * Copyright (C) 2009-2010 Jean Bréfort <jean.brefort@normalesup.org>
00008  *
00009  * This program is free software; you can redistribute it and/or 
00010  * modify it under the terms of the GNU General Public License as 
00011  * published by the Free Software Foundation; either version 2 of the
00012  * License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
00022  * USA
00023  */
00024 
00025 #ifndef GCHEMPAINT_MECHANISM_ARROW_H
00026 #define GCHEMPAINT_MECHANISM_ARROW_H
00027 
00028 #include <gccv/item-client.h>
00029 #include <gcu/object.h>
00030 
00031 namespace gcp {
00032 
00033 extern gcu::TypeId MechanismArrowType;
00034 
00035 class MechanismArrow: public gcu::Object, public gccv::ItemClient
00036 {
00037 public:
00038         MechanismArrow ();
00039         virtual ~MechanismArrow ();
00040 
00041         void SetSource (gcu::Object *source);
00042         void SetSourceAux (gcu::Object *aux);
00043         void SetTarget (gcu::Object *target);
00044         void SetControlPoint (int num, double dx, double dy);
00045         void SetShowControls (bool show);
00046         void SetPair (bool is_pair);
00047 
00048         // virtual gcu::Object methods
00055         xmlNodePtr Save (xmlDocPtr xml) const;
00062         bool Load (xmlNodePtr node);
00070         void Transform2D (gcu::Matrix2D& m, double x, double y);
00071 
00072         // virtual gccv::ItemClient methods
00076         void AddItem ();
00084         void SetSelected (int state);
00085 
00089         void OnUnlink (Object *object);
00090 
00091         std::string Name ();
00092 
00093 private:
00094         double m_CPx1, m_CPy1, m_CPx2, m_CPy2;
00095 
00096 GCU_RO_PROP (gcu::Object *, Source)
00097 GCU_RO_PROP (gcu::Object *, SourceAux)
00098 GCU_RO_PROP (gcu::Object *, Target)
00099 GCU_RO_PROP (bool, ShowControls)
00100 GCU_RO_PROP (bool, Pair);
00101 };
00102 
00103 }       //      namespace gcp
00104 
00105 #endif  //      GCHEMPAINT_MECHANISM_ARROW_H
Generated by  doxygen 1.6.2-20100208