The Gnome Chemistry Utils  0.14.16
reactant.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  * GChemPaint library
5  * reactant.h
6  *
7  * Copyright (C) 2004-2011 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_REACTANT_H
26 #define GCHEMPAINT_REACTANT_H
27 
28 #include <gcu/object.h>
29 #include "text.h"
30 
33 namespace gcu {
34 class UIManager;
35 }
36 
37 namespace gcp {
38 
39 class ReactionStep;
40 
47 class Reactant: public gcu::Object
48 {
49 public:
53  Reactant ();
57  virtual ~Reactant ();
58 
63  Reactant (ReactionStep* step, gcu::Object* object) throw (std::invalid_argument);
64 
71  virtual xmlNodePtr Save (xmlDocPtr xml) const;
79  virtual bool Load (xmlNodePtr node);
80 
84  unsigned GetStoichiometry () const {return m_Stoich;}
90  void SetStoichiometry (unsigned coef) {m_Stoich = coef;}
95  virtual double GetYAlign ();
105  bool BuildContextualMenu (gcu::UIManager *UIManager, gcu::Object *object, double x, double y);
116  bool OnSignal (gcu::SignalId Signal, gcu::Object *Child);
117 
122  void AddStoichiometry ();
128  void AddStoichiometry (gcp::Text *stoichiometry);
132  gcu::Object *GetChild () {return Child;}
136  gcu::Object const *GetChild () const {return Child;}
140  gcu::Object *GetStoichChild () {return Stoichiometry;}
145  void SetMolecule (gcu::Object *molecule);
152  std::string GetProperty (unsigned property) const;
164  bool SetProperty (unsigned property, char const *value);
168  std::string Name ();
169 
170 private:
171  unsigned m_Stoich; //always positive
172  gcu::Object *Stoichiometry;
173  gcu::Object *Child;
174 };
175 
176 } // namespace gcp
177 
178 #endif // GCHEMPAINT_REACTANT_H
GChemPaint specific C++ classes.
gcu::Object * GetStoichChild()
Definition: reactant.h:140
the list of reactants before or after a reaction arrow.
Definition: reaction-step.h:49
base class for a user interface manager
Definition: ui-manager.h:33
The Gnome Chemistry Utils C++ classes.
unsigned SignalId
Definition: object.h:151
gcu::Object const * GetChild() const
Definition: reactant.h:136
Class for reactants and products of a chemical reaction.
Definition: reactant.h:47
gcu::Object * GetChild()
Definition: reactant.h:132
void SetStoichiometry(unsigned coef)
Definition: reactant.h:90
unsigned GetStoichiometry() const
Definition: reactant.h:84