The Gnome Chemistry Utils 0.13.3
|
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 00030 #include <gccv/item-client.h> 00031 #include <gcu/object.h> 00032 00033 namespace gcp { 00034 00038 extern gcu::TypeId MechanismArrowType; 00039 00045 class MechanismArrow: public gcu::Object, public gccv::ItemClient 00046 { 00047 public: 00051 MechanismArrow (); 00055 virtual ~MechanismArrow (); 00056 00063 void SetSource (gcu::Object *source); 00072 void SetSourceAux (gcu::Object *aux); 00078 void SetTarget (gcu::Object *target); 00088 void SetControlPoint (int num, double dx, double dy); 00095 void SetShowControls (bool show); 00102 void SetPair (bool is_pair); 00109 void SetEndAtNewBondCenter (bool end_at_new_bond_center); 00110 00111 // virtual gcu::Object methods 00118 xmlNodePtr Save (xmlDocPtr xml) const; 00125 bool Load (xmlNodePtr node); 00133 void Transform2D (gcu::Matrix2D& m, double x, double y); 00134 00135 // virtual gccv::ItemClient methods 00139 void AddItem (); 00147 void SetSelected (int state); 00148 00152 void OnUnlink (Object *object); 00153 00157 void OnLoaded (); 00158 00162 std::string Name (); 00163 00167 bool CanSelect () const; 00168 00169 private: 00170 double m_CPx1, m_CPy1, m_CPx2, m_CPy2; 00171 00176 GCU_RO_PROP (gcu::Object *, Source) 00180 GCU_RO_PROP (gcu::Object *, SourceAux) 00184 GCU_RO_PROP (gcu::Object *, Target) 00188 GCU_RO_PROP (bool, ShowControls) 00192 GCU_RO_PROP (bool, Pair) 00197 GCU_RO_PROP (bool, EndAtNewBondCenter) 00198 }; 00199 00200 } // namespace gcp 00201 00202 #endif // GCHEMPAINT_MECHANISM_ARROW_H