The Gnome Chemistry Utils  0.13.6
gcp/arrow.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /*
00004  * GChemPaint library
00005  * arrow.h
00006  *
00007  * Copyright (C) 2002-2011 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_ARROW_H
00026 #define GCHEMPAINT_ARROW_H
00027 
00028 #include <gcu/object.h>
00029 #include <gccv/item-client.h>
00030 
00032 namespace gcp {
00033 
00034 class Step;
00035 
00039 enum ArrowTypes
00040 {
00044         SimpleArrow,
00048         ReversibleArrow,
00052         FullReversibleArrow,
00053 };
00054 
00057 class Arrow: public gcu::Object, public gccv::ItemClient
00058 {
00059 public:
00066         Arrow(gcu::TypeId Type);
00070         virtual ~Arrow();
00071 
00080         bool Load (xmlNodePtr node);
00088         void SetSelected (int state);
00097         void SetCoords (double xstart, double ystart, double xend, double yend);
00106         bool GetCoords (double* xstart, double* ystart, double* xend, double* yend) const;
00115         bool GetCoords (double *x, double *y, double *z = NULL) const;
00123         void Move (double x, double y, double z = 0);
00131         void Transform2D (gcu::Matrix2D& m, double x, double y);
00136         double GetYAlign ();
00146         bool SetProperty (unsigned property, char const *value);
00153         void SetStartStep (Step *step) {m_Start = step;}
00157         Step** GetStartStepPtr () {return &m_Start;}
00161         Step* GetStartStep () const {return m_Start;}
00168         void SetEndStep (Step *step) {m_End = step;}
00172         Step* GetEndStep () const {return m_End;}
00176         Step** GetEndStepPtr () {return &m_End;}
00180         void Reverse ();
00187         void RemoveStep (Step *step);
00188 
00189 protected:
00197         bool Save (xmlDocPtr xml, xmlNodePtr node) const;
00198 
00199         std::string Name ();
00200 
00204         void OnLoaded ();
00205 
00206 protected:
00210         double m_x;
00214         double m_y;
00218         double m_width;
00222         double m_height;
00223 
00224 private:
00225         Step *m_Start, *m_End;
00226 
00227 GCU_RO_PROP (double, Length)
00228 };
00229 
00230 }       //      namespace gcp
00231 
00232 #endif  //GCHEMPAINT_ARROW_H