The Gnome Chemistry Utils  0.14.0
mechanism-arrow.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  * GChemPaint library
5  * mechanism-arrow.h
6  *
7  * Copyright (C) 2009-2010 Jean Bréfort <jean.brefort@normalesup.org>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 3 of the
12  * License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22  * USA
23  */
24 
25 #ifndef GCHEMPAINT_MECHANISM_ARROW_H
26 #define GCHEMPAINT_MECHANISM_ARROW_H
27 
30 #include <gccv/item-client.h>
31 #include <gcu/object.h>
32 
33 namespace gcp {
34 
39 
46 {
47 public:
51  MechanismArrow ();
55  virtual ~MechanismArrow ();
56 
63  void SetSource (gcu::Object *source);
72  void SetSourceAux (gcu::Object *aux);
78  void SetTarget (gcu::Object *target);
88  void SetControlPoint (int num, double dx, double dy);
95  void SetShowControls (bool show);
102  void SetPair (bool is_pair);
109  void SetEndAtNewBondCenter (bool end_at_new_bond_center);
110 
111  // virtual gcu::Object methods
118  xmlNodePtr Save (xmlDocPtr xml) const;
125  bool Load (xmlNodePtr node);
133  void Transform2D (gcu::Matrix2D& m, double x, double y);
134 
135  // virtual gccv::ItemClient methods
139  void AddItem ();
147  void SetSelected (int state);
148 
152  void OnUnlink (Object *object);
153 
157  void OnLoaded ();
158 
162  std::string Name ();
163 
167  bool CanSelect () const;
168 
169 private:
170  double m_CPx1, m_CPy1, m_CPx2, m_CPy2;
171 
180 GCU_RO_PROP (gcu::Object *, SourceAux)
184 GCU_RO_PROP (gcu::Object *, Target)
188 GCU_RO_PROP (bool, ShowControls)
192 GCU_RO_PROP (bool, Pair)
197 GCU_RO_PROP (bool, EndAtNewBondCenter)
198 };
199 
200 } // namespace gcp
201 
202 #endif // GCHEMPAINT_MECHANISM_ARROW_H