#include <gcu/object.h>

Public Member Functions | |
| Object (TypeId Id=OtherType) | |
| virtual | ~Object () |
| TypeId | GetType () |
| void | SetId (gchar *Id) |
| const gchar * | GetId () |
| void | AddChild (Object *object) |
| Object * | GetMolecule () |
| Object * | GetReaction () |
| Object * | GetGroup () |
| Document * | GetDocument () |
| Object * | GetParentOfType (TypeId Id) |
| Object * | GetChild (const gchar *Id) |
| Object * | GetFirstChild (map< string, Object * >::iterator &i) |
| Object * | GetNextChild (map< string, Object * >::iterator &i) |
| Object * | GetDescendant (const gchar *Id) |
| Object * | GetParent () |
| void | SetParent (Object *Parent) |
| virtual xmlNodePtr | Save (xmlDocPtr xml) |
| 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) |
| void | SaveId (xmlNodePtr node) |
| xmlNodePtr | GetNodeByProp (xmlNodePtr node, char *Property, char *Id) |
| xmlNodePtr | GetNextNodeByProp (xmlNodePtr node, char *Property, char *Id) |
| xmlNodePtr | GetNodeByName (xmlNodePtr node, char *Name) |
| xmlNodePtr | GetNextNodeByName (xmlNodePtr node, char *Name) |
| virtual void | Add (GtkWidget *w) |
| virtual void | Print (GnomePrintContext *pc) |
| virtual void | Update (GtkWidget *w) |
| virtual void | SetSelected (GtkWidget *w, int state) |
| bool | HasChildren () |
| unsigned | GetChildrenNumber () |
| virtual Object * | GetAtomAt (double x, double y, double z=0.) |
| virtual bool | Build (list< Object * > &Children) throw (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 (set< Object * >::iterator &i) |
| Object * | GetNextLink (set< Object * >::iterator &i) |
| void | Unlink (Object *object) |
| virtual void | OnUnlink (Object *object) |
| void | GetPossibleAncestorTypes (set< TypeId > &types) |
Static Public Member Functions | |
| static TypeId | AddType (string TypeName, Object *(*CreateFunc)(), TypeId id=OtherType) |
| static Object * | CreateObject (const string &TypeName, Object *parent=NULL) |
| static TypeId | GetTypeId (const string &Name) |
| static string | GetTypeName (TypeId Id) |
| static void | AddRule (TypeId type1, RuleId rule, TypeId type2) |
| static void | AddRule (const string &type1, RuleId rule, const string &type2) |
| static const set< TypeId > & | GetRules (TypeId type, RuleId rule) |
| static const set< TypeId > & | GetRules (const string &type, RuleId rule) |
| static void | SetCreationLabel (TypeId Id, string Label) |
| static const string & | GetCreationLabel (TypeId Id) |
| static const string & | GetCreationLabel (const string &TypeName) |
| static SignalId | CreateNewSignalId () |
Definition at line 127 of file object.h.
| gcu::Object::Object | ( | TypeId | Id = OtherType |
) |
Used to create an object of type Id. Shold 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.
| TypeId gcu::Object::GetType | ( | ) | [inline] |
| void gcu::Object::SetId | ( | gchar * | Id | ) |
| Id,: | the id of the Object instance. |
| const gchar* gcu::Object::GetId | ( | ) | [inline] |
| void gcu::Object::AddChild | ( | Object * | object | ) |
| Object* gcu::Object::GetMolecule | ( | ) |
| Object* gcu::Object::GetReaction | ( | ) |
| Object* gcu::Object::GetGroup | ( | ) |
| Document* gcu::Object::GetDocument | ( | ) |
| Id,: | the type of the ancestor searched. |
| Object* gcu::Object::GetChild | ( | const gchar * | Id | ) |
| Id,: | the Id of the child searched. |
| i,: | a C++ std::map iterator. |
| i,: | a C++ std::map iterator initialized by Object::GetFirstChild. |
| Object* gcu::Object::GetDescendant | ( | const gchar * | Id | ) |
| Object* gcu::Object::GetParent | ( | ) | [inline] |
| void gcu::Object::SetParent | ( | Object * | Parent | ) |
| virtual xmlNodePtr gcu::Object::Save | ( | xmlDocPtr | xml | ) | [virtual] |
| xml,: | the xmlDoc used to save the document. |
| 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;
| 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. |
| virtual void gcu::Object::Transform2D | ( | Matrix2D & | m, | |
| double | x, | |||
| double | y | |||
| ) | [virtual] |
| m,: | the 2D Matrix of the transformation. | |
| x,: | the x component of the center of the transformation. | |
| y,: | the y component of the center of the transformation. |
| bool gcu::Object::SaveChildren | ( | xmlDocPtr | xml, | |
| xmlNodePtr | node | |||
| ) |
| xml,: | the xmlDoc used to save the document. | |
| node,: | the node representing the Object. |
| void gcu::Object::SaveId | ( | xmlNodePtr | node | ) |
| node,: | the node representing the Object. |
| xmlNodePtr gcu::Object::GetNodeByProp | ( | xmlNodePtr | node, | |
| char * | Property, | |||
| char * | 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. |
| xmlNodePtr gcu::Object::GetNextNodeByProp | ( | xmlNodePtr | node, | |
| char * | Property, | |||
| char * | 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 * | Name | |||
| ) |
| node,: | the node where the search is to be done. | |
| Name,: | the name of the xmlNode searched. |
| xmlNodePtr gcu::Object::GetNextNodeByName | ( | xmlNodePtr | node, | |
| char * | Name | |||
| ) |
| node,: | the xmlNodePtr returned by Object::GetNodeByName or the last call to Object::GetNextNodeByName. | |
| Name,: | the name of the xmlNode searched. |
| virtual void gcu::Object::Add | ( | GtkWidget * | w | ) | [virtual] |
| virtual void gcu::Object::Print | ( | GnomePrintContext * | pc | ) | [virtual] |
| pc,: | the GnomePrintContext to which the document is printed. |
| virtual void gcu::Object::Update | ( | GtkWidget * | w | ) | [virtual] |
| virtual void gcu::Object::SetSelected | ( | GtkWidget * | w, | |
| int | state | |||
| ) | [virtual] |
| bool gcu::Object::HasChildren | ( | ) | [inline] |
| unsigned gcu::Object::GetChildrenNumber | ( | ) | [inline] |
| 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 |
| virtual bool gcu::Object::Build | ( | list< Object * > & | Children | ) | throw (invalid_argument) [virtual] |
| Children,: | the list of objects used as children to build the object |
| virtual double gcu::Object::GetYAlign | ( | ) | [virtual] |
Used to retreive 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.
| virtual bool gcu::Object::BuildContextualMenu | ( | GtkUIManager * | UIManager, | |
| Object * | object, | |||
| double | x, | |||
| double | y | |||
| ) | [virtual] |
| UIManager,: | the GtkUIanager 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. |
| void gcu::Object::EmitSignal | ( | SignalId | Signal | ) |
| Signal,: | the appropriate SignalId |
| Signal,: | the appropriate SignalId | |
| Child,: | the child which emitted the signal or NULL |
| void gcu::Object::Lock | ( | bool | state = true |
) |
| state,: | whether to block signals or not |
Since 0.4.2
| bool gcu::Object::IsLocked | ( | ) | [inline] |
| i,: | a C++ std::set<Object*> iterator. |
| i,: | a C++ std::set<Object*> iterator initialized by Object::GetFirstLink. |
| void gcu::Object::Unlink | ( | Object * | object | ) |
| virtual void gcu::Object::OnUnlink | ( | Object * | object | ) | [virtual] |
| object,: | the object just unlinked by Object::Unlink. |
| void gcu::Object::GetPossibleAncestorTypes | ( | set< TypeId > & | types | ) |
| types,: | the list of TypeId values to fill |
| static TypeId gcu::Object::AddType | ( | 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. |
| static Object* gcu::Object::CreateObject | ( | const 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. |
| static TypeId gcu::Object::GetTypeId | ( | const string & | Name | ) | [static] |
| static string gcu::Object::GetTypeName | ( | TypeId | Id | ) | [static] |
| 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 void gcu::Object::AddRule | ( | const string & | type1, | |
| RuleId | rule, | |||
| const 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 |
| type,: | the TypeId of a class | |
| rule,: | a RuleId value |
| type,: | the name of a class | |
| rule,: | a RuleId value |
| static void gcu::Object::SetCreationLabel | ( | TypeId | Id, | |
| string | Label | |||
| ) | [static] |
| Id,: | the TypeId of a class | |
| Label,: | the string to display in a contextual menu |
| static const string& gcu::Object::GetCreationLabel | ( | TypeId | Id | ) | [static] |
| Id,: | the TypeId of a class |
| static const string& gcu::Object::GetCreationLabel | ( | const string & | TypeName | ) | [static] |
| TypeName,: | the name of a class |
| static SignalId gcu::Object::CreateNewSignalId | ( | ) | [static] |
1.5.4