#include <gcu/object.h>

Public Member Functions | |
| Object (TypeId Id=OtherType) | |
| virtual | ~Object () |
| TypeId | GetType () const |
| void | SetId (gchar const *Id) |
| gchar const * | GetId () const |
| virtual void | AddChild (Object *object) |
| Object * | GetMolecule () const |
| Object * | GetReaction () const |
| Object * | GetGroup () const |
| Document * | GetDocument () const |
| Object * | GetParentOfType (TypeId Id) const |
| Object * | GetChild (const gchar *Id) const |
| Object * | GetFirstChild (std::map< std::string, Object * >::iterator &i) |
| Object * | GetNextChild (std::map< std::string, Object * >::iterator &i) |
| Object * | GetDescendant (const gchar *Id) const |
| Object * | GetParent () const |
| void | SetParent (Object *Parent) |
| virtual xmlNodePtr | Save (xmlDocPtr xml) const |
| virtual bool | Load (xmlNodePtr node) |
| virtual void | Move (double x, double y, double z=0.) |
| virtual void | Transform2D (Matrix2D &m, double x, double y) |
| bool | SaveChildren (xmlDocPtr xml, xmlNodePtr node) const |
| void | SaveId (xmlNodePtr node) const |
| xmlNodePtr | GetNodeByProp (xmlNodePtr node, char const *Property, char const *Id) |
| xmlNodePtr | GetNextNodeByProp (xmlNodePtr node, char const *Property, char const *Id) |
| xmlNodePtr | GetNodeByName (xmlNodePtr node, char const *Name) |
| xmlNodePtr | GetNextNodeByName (xmlNodePtr node, char const *Name) |
| bool | HasChildren () const |
| unsigned | GetChildrenNumber () const |
| virtual Object * | GetAtomAt (double x, double y, double z=0.) |
| virtual bool | Build (std::list< Object * > &Children) throw (std::invalid_argument) |
| virtual double | GetYAlign () |
| virtual bool | BuildContextualMenu (GtkUIManager *UIManager, Object *object, double x, double y) |
| void | EmitSignal (SignalId Signal) |
| virtual bool | OnSignal (SignalId Signal, Object *Child) |
| void | Lock (bool state=true) |
| bool | IsLocked () |
| Object * | GetFirstLink (std::set< Object * >::iterator &i) |
| Object * | GetNextLink (std::set< Object * >::iterator &i) |
| void | Link (Object *object) |
| void | Unlink (Object *object) |
| virtual void | OnUnlink (Object *object) |
| void | GetPossibleAncestorTypes (std::set< TypeId > &types) const |
| virtual bool | SetProperty (unsigned property, char const *value) |
| virtual std::string | GetProperty (unsigned property) const |
| virtual void | OnLoaded () |
| void | SetDirty (bool dirty=true) |
| virtual void | Clear () |
| virtual std::string | Name () |
| std::string | Identity () |
| virtual char const * | HasPropertiesDialog () const |
| void | ShowPropertiesDialog () |
| bool | GetDirty (void) const |
Static Public Member Functions | |
| static TypeId | AddType (std::string TypeName, Object *(*CreateFunc)(), TypeId id=OtherType) |
| static void | AddAlias (TypeId id, std::string TypeName) |
| static Object * | CreateObject (const std::string &TypeName, Object *parent=NULL) |
| static TypeId | GetTypeId (const std::string &Name) |
| static std::string | GetTypeName (TypeId Id) |
| static void | AddMenuCallback (TypeId Id, BuildMenuCb cb) |
| static void | AddRule (TypeId type1, RuleId rule, TypeId type2) |
| static void | AddRule (const std::string &type1, RuleId rule, const std::string &type2) |
| static const std::set< TypeId > & | GetRules (TypeId type, RuleId rule) |
| static const std::set< TypeId > & | GetRules (const std::string &type, RuleId rule) |
| static void | SetCreationLabel (TypeId Id, std::string Label) |
| static const std::string & | GetCreationLabel (TypeId Id) |
| static const std::string & | GetCreationLabel (const std::string &TypeName) |
| static SignalId | CreateNewSignalId () |
Protected Member Functions | |
| virtual Dialog * | BuildPropertiesDialog () |
Definition at line 140 of file object.h.
| gcu::Object::Object | ( | TypeId | Id = OtherType |
) |
Used to create an object of type Id. Should only be called from the constructor of a derived class.
| virtual gcu::Object::~Object | ( | ) | [virtual] |
The standard destructor of Object instances. Automatically called when the object is destroyed.
| static void gcu::Object::AddAlias | ( | TypeId | id, | |
| std::string | TypeName | |||
| ) | [static] |
| id | the Id of an existing type. | |
| TypeName | a new name for the type. |
| virtual void gcu::Object::AddChild | ( | Object * | object | ) | [virtual] |
| object | the Object instance to add as a child. |
Reimplemented in gcu::CrystalDoc, gcu::Molecule, and gcp::Molecule.
| static void gcu::Object::AddMenuCallback | ( | TypeId | Id, | |
| BuildMenuCb | cb | |||
| ) | [static] |
| Id | the TypeId of the Object derived class | |
| cb | the BuildMenuCb callback to call when building the menu. |
| static void gcu::Object::AddRule | ( | const std::string & | type1, | |
| RuleId | rule, | |||
| const std::string & | type2 | |||
| ) | [static] |
| type1 | the name of the first class in the rule | |
| rule | the new rule value | |
| type2 | the name of the second class in the rule |
| type1 | the TypeId of the first class in the rule | |
| rule | the new rule value | |
| type2 | the TypeId of the second class in the rule |
| static TypeId gcu::Object::AddType | ( | std::string | TypeName, | |
| Object *(*)() | CreateFunc, | |||
| TypeId | id = OtherType | |||
| ) | [static] |
| TypeName | the name of the new type. | |
| CreateFunc | a pointer to a function returning a pointer to a new object of the new type. | |
| id | the Id of the type to create if a standard one or OtherType for a new type. In this last case, this parameter can be omitted. |
| virtual bool gcu::Object::Build | ( | std::list< Object * > & | Children | ) | throw (std::invalid_argument) [virtual] |
| Children | the list of objects used as children to build the object |
Reimplemented in gcp::Mesomery, and gcp::Reaction.
| virtual bool gcu::Object::BuildContextualMenu | ( | GtkUIManager * | UIManager, | |
| Object * | object, | |||
| double | x, | |||
| double | y | |||
| ) | [virtual] |
| UIManager | the GtkUIManager to populate. | |
| object | the Object on which occured the mouse click. | |
| x | x coordinate of the mouse click. | |
| y | y coordinate of the mouse click. |
Reimplemented in gcp::Mesomery, gcp::Molecule, gcp::Reactant, gcp::ReactionArrow, and gcp::Reaction.
| virtual Dialog* gcu::Object::BuildPropertiesDialog | ( | ) | [protected, virtual] |
| virtual void gcu::Object::Clear | ( | ) | [virtual] |
Deletes all children. Derived classes might override this method if needed.
Reimplemented in gcu::Chem3dDoc, gcu::Molecule, gcp::Document, and gcp::Molecule.
| static SignalId gcu::Object::CreateNewSignalId | ( | ) | [static] |
| static Object* gcu::Object::CreateObject | ( | const std::string & | TypeName, | |
| Object * | parent = NULL | |||
| ) | [static] |
| TypeName | the name of the new type. | |
| parent | the parent of the newly created object or NULL. if NULL, the parameter can be omitted. |
| void gcu::Object::EmitSignal | ( | SignalId | Signal | ) |
| Signal | the appropriate SignalId |
| virtual Object* gcu::Object::GetAtomAt | ( | double | x, | |
| double | y, | |||
| double | z = 0. | |||
| ) | [virtual] |
| x | the x coordinate | |
| y | the y coordinate | |
| z | the z coordinate |
Reimplemented in gcp::Bond, gcp::Fragment, and gcp::Molecule.
| Object* gcu::Object::GetChild | ( | const gchar * | Id | ) | const |
| Id | the Id of the child searched. |
| unsigned gcu::Object::GetChildrenNumber | ( | ) | const [inline] |
| static const std::string& gcu::Object::GetCreationLabel | ( | const std::string & | TypeName | ) | [static] |
| TypeName | the name of a class |
| static const std::string& gcu::Object::GetCreationLabel | ( | TypeId | Id | ) | [static] |
| Id | the TypeId of a class |
| Object* gcu::Object::GetDescendant | ( | const gchar * | Id | ) | const |
| gcu::Object::GetDirty | ( | void | ) | const [inline] |
| Document* gcu::Object::GetDocument | ( | ) | const |
| i | a C++ std::map iterator. |
| i | a C++ std::set<Object*> iterator. |
| Object* gcu::Object::GetGroup | ( | ) | const |
| gchar const* gcu::Object::GetId | ( | ) | const [inline] |
Definition at line 166 of file object.h.
Referenced by gcp::Molecule::GetAlignmentId().
| Object* gcu::Object::GetMolecule | ( | ) | const |
Used to get the Molecule in the Object instances ancestors. Overloaded methods should call the base class Object::AddChild.
| i | a C++ std::map iterator initialized by Object::GetFirstChild. |
| i | a C++ std::set<Object*> iterator initialized by Object::GetFirstLink. |
| xmlNodePtr gcu::Object::GetNextNodeByName | ( | xmlNodePtr | node, | |
| char const * | Name | |||
| ) |
| node | the xmlNodePtr returned by Object::GetNodeByName or the last call to Object::GetNextNodeByName. | |
| Name | the name of the xmlNode searched. |
| xmlNodePtr gcu::Object::GetNextNodeByProp | ( | xmlNodePtr | node, | |
| char const * | Property, | |||
| char const * | Id | |||
| ) |
| node | the xmlNodePtr returned by Object::GetNodeByProp or the last call to Object::GetNextNodeByProp. | |
| Property | the name of the property used in the search. | |
| Id | the value to match to the property. |
| xmlNodePtr gcu::Object::GetNodeByName | ( | xmlNodePtr | node, | |
| char const * | Name | |||
| ) |
| node | the node where the search is to be done. | |
| Name | the name of the xmlNode searched. |
| xmlNodePtr gcu::Object::GetNodeByProp | ( | xmlNodePtr | node, | |
| char const * | Property, | |||
| char const * | Id | |||
| ) |
| node | the node where the search is to be done. | |
| Property | the name of the property used in the search. | |
| Id | the value to match to the property. |
| Object* gcu::Object::GetParent | ( | ) | const [inline] |
| Id | the type of the ancestor searched. |
| void gcu::Object::GetPossibleAncestorTypes | ( | std::set< TypeId > & | types | ) | const |
| types | the list of TypeId values to fill |
| virtual std::string gcu::Object::GetProperty | ( | unsigned | property | ) | const [virtual] |
| property | the property id as defined in objprops.h |
Reimplemented in gcu::Atom, gcu::Bond, gcu::CrystalAtom, gcu::CrystalDoc, gcp::Bond, gcp::Document, and gcp::TextObject.
| Object* gcu::Object::GetReaction | ( | ) | const |
| static const std::set<TypeId>& gcu::Object::GetRules | ( | const std::string & | type, | |
| RuleId | rule | |||
| ) | [static] |
| type | the name of a class | |
| rule | a RuleId value |
| type | the TypeId of a class | |
| rule | a RuleId value |
| TypeId gcu::Object::GetType | ( | ) | const [inline] |
Reimplemented in gcp::Bond.
| static TypeId gcu::Object::GetTypeId | ( | const std::string & | Name | ) | [static] |
| static std::string gcu::Object::GetTypeName | ( | TypeId | Id | ) | [static] |
| virtual double gcu::Object::GetYAlign | ( | ) | [virtual] |
Used to retrieve the y coordinate for alignment. The default implementation returns 0.0 and every derived class for which alignment has a meaning should implement this method.
Reimplemented in gcp::Arrow, gcp::Atom, gcp::Bond, gcp::Document, gcp::Fragment, gcp::MechanismStep, gcp::Mesomer, gcp::Mesomery, gcp::Molecule, gcp::Reactant, gcp::ReactionOperator, gcp::ReactionStep, gcp::Reaction, and gcp::Text.
| bool gcu::Object::HasChildren | ( | ) | const [inline] |
| virtual char const* gcu::Object::HasPropertiesDialog | ( | ) | const [virtual] |
| std::string gcu::Object::Identity | ( | ) |
| bool gcu::Object::IsLocked | ( | ) | [inline] |
| void gcu::Object::Link | ( | Object * | object | ) |
| object | the object to link. |
| virtual bool gcu::Object::Load | ( | xmlNodePtr | node | ) | [virtual] |
| node | a pointer to the xmlNode containing the serialized object. |
Example:
std::string str = (const char*)node->name; Object* pObject = Object::CreateObject(str, this); if (pObject) { if (!pObject->Load(node)) delete Object; } else cerr << "Warning: unknown object: " << str << endl;
Reimplemented in gcu::Atom, gcu::Bond, gcp::Arrow, gcp::Atom, gcp::Document, gcp::Electron, gcp::FragmentAtom, gcp::FragmentResidue, gcp::Fragment, gcp::MechanismArrow, gcp::MechanismStep, gcp::Mesomer, gcp::MesomeryArrow, gcp::Mesomery, gcp::Molecule, gcp::Reactant, gcp::ReactionArrow, gcp::ReactionProp, gcp::ReactionStep, gcp::Reaction, gcp::TextObject, and gcp::Text.
| void gcu::Object::Lock | ( | bool | state = true |
) |
| state | whether to block signals or not |
Since 0.4.2
| virtual void gcu::Object::Move | ( | double | x, | |
| double | y, | |||
| double | z = 0. | |||
| ) | [virtual] |
| x | the x component of the transation vector. | |
| y | the y component of the transation vector. | |
| z | the z component of the transation vector. |
Reimplemented in gcu::Atom, gcu::Bond, gcp::Arrow, gcp::Bond, gcp::Fragment, gcp::ReactionArrow, gcp::ReactionOperator, and gcp::TextObject.
| virtual std::string gcu::Object::Name | ( | ) | [virtual] |
Reimplemented in gcu::Atom, gcu::Bond, gcu::Chain, gcu::Cycle, gcu::Document, gcu::Molecule, gcp::Arrow, gcp::Electron, gcp::Fragment, gcp::MechanismArrow, gcp::MechanismStep, gcp::Mesomer, gcp::MesomeryArrow, gcp::Mesomery, gcp::Reactant, gcp::ReactionArrow, gcp::ReactionOperator, gcp::ReactionProp, gcp::ReactionStep, gcp::Reaction, and gcp::Text.
| virtual void gcu::Object::OnLoaded | ( | ) | [virtual] |
This method should be called when an object has been fully loaded. The default method doesn't do anything.
Reimplemented in gcu::Bond, gcp::MechanismArrow, and gcp::Molecule.
| Signal | the appropriate SignalId | |
| Child | the child which emitted the signal or NULL |
Reimplemented in gcp::Document, gcp::Electron, gcp::MechanismStep, gcp::Mesomer, gcp::Mesomery, gcp::Molecule, gcp::Reactant, gcp::ReactionArrow, gcp::ReactionProp, gcp::ReactionStep, and gcp::Reaction.
| virtual void gcu::Object::OnUnlink | ( | Object * | object | ) | [virtual] |
| object | the object just unlinked by Object::Unlink. |
| virtual xmlNodePtr gcu::Object::Save | ( | xmlDocPtr | xml | ) | const [virtual] |
| xml | the xmlDoc used to save the document. |
Reimplemented in gcu::Atom, gcu::Bond, gcp::Atom, gcp::Electron, gcp::FragmentAtom, gcp::FragmentResidue, gcp::Fragment, gcp::MechanismArrow, gcp::MesomeryArrow, gcp::Molecule, gcp::Reactant, gcp::ReactionArrow, gcp::ReactionStep, and gcp::Text.
| bool gcu::Object::SaveChildren | ( | xmlDocPtr | xml, | |
| xmlNodePtr | node | |||
| ) | const |
| xml | the xmlDoc used to save the document. | |
| node | the node representing the Object. |
| void gcu::Object::SaveId | ( | xmlNodePtr | node | ) | const |
| node | the node representing the Object. |
| static void gcu::Object::SetCreationLabel | ( | TypeId | Id, | |
| std::string | Label | |||
| ) | [static] |
| Id | the TypeId of a class | |
| Label | the string to display in a contextual menu |
| void gcu::Object::SetDirty | ( | bool | dirty = true |
) |
| dirty | should be true if the object needs some update, false otherwise. For a document, it means that the document has been changed. |
Reimplemented in gcp::Document.
| void gcu::Object::SetId | ( | gchar const * | Id | ) |
| Id | the id of the Object instance. |
| void gcu::Object::SetParent | ( | Object * | Parent | ) |
| virtual bool gcu::Object::SetProperty | ( | unsigned | property, | |
| char const * | value | |||
| ) | [virtual] |
| property | the property id as defined in objprops.h | |
| value | the property value as a string |
Reimplemented in gcu::Atom, gcu::Bond, gcu::CrystalAtom, gcu::CrystalDoc, gcp::Arrow, gcp::Bond, gcp::Document, gcp::Fragment, gcp::ReactionArrow, and gcp::Text.
| void gcu::Object::ShowPropertiesDialog | ( | ) |
Exposes the gcu::Dialog related to the object properties if it exists.
| virtual void gcu::Object::Transform2D | ( | Matrix2D & | m, | |
| double | x, | |||
| double | y | |||
| ) | [virtual] |
| m | the Matrix2D of the transformation. | |
| x | the x component of the center of the transformation. | |
| y | the y component of the center of the transformation. |
Reimplemented in gcu::Atom, gcu::Bond, gcp::Arrow, gcp::Atom, gcp::Bond, gcp::Electron, gcp::Fragment, gcp::MechanismArrow, gcp::Mesomery, gcp::Molecule, gcp::Reaction, and gcp::Text.
| void gcu::Object::Unlink | ( | Object * | object | ) |
1.5.9