|
Public Member Functions |
| Object (TypeId Id=OtherType) |
virtual | ~Object () |
TypeId | GetType () |
void | SetId (gchar const *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 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) |
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 | AddMenuCallback (TypeId Id, BuildMenuCb cb) |
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 () |
virtual xmlNodePtr gcu::Object::Save |
( |
xmlDocPtr |
xml |
) |
[virtual] |
- Parameters:
-
| xml,: | the xmlDoc used to save the document. |
Used to save the
Object to the xmlDoc. Each serializable
Object should implement this virtual method.
- Returns:
- the xmlNode containing the serialized object. The name of the node should be the name of the corresponding type used as first parameter to the Object::AddType method. The default method just saves the id and children.
Reimplemented in gcu::Atom, gcu::Bond, gcu::CrystalBond, gcp::Atom, gcp::Electron, gcp::FragmentAtom, gcp::Fragment, gcp::MesomeryArrow, gcp::Molecule, gcp::Reactant, gcp::ReactionArrow, gcp::ReactionProp, gcp::ReactionStep, and gcp::Text.
virtual bool gcu::Object::Load |
( |
xmlNodePtr |
node |
) |
[virtual] |
- Parameters:
-
| node,: | a pointer to the xmlNode containing the serialized object. |
Used to load an
Object in memory. The
Object must already exist.
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;
- Returns:
- true on succes, false otherwise.
Reimplemented in gcu::Atom, gcu::Bond, gcu::CrystalBond, gcp::Arrow, gcp::Atom, gcp::Document, gcp::Electron, gcp::FragmentAtom, gcp::Fragment, gcp::Mesomer, gcp::MesomeryArrow, gcp::Mesomery, gcp::Molecule, gcp::Reactant, gcp::ReactionArrow, gcp::ReactionProp, gcp::ReactionStep, gcp::Reaction, gcp::TextObject, and gcp::Text.
virtual void gcu::Object::Move |
( |
double |
x, |
|
|
double |
y, |
|
|
double |
z = 0. | |
|
) |
| | [virtual] |
- Parameters:
-
| x,: | the x component of the transation vector. |
| y,: | the y component of the transation vector. |
| z,: | the z component of the transation vector. |
Used to move an object. This virtual method should most often be overrided by
Object derived classes for which it makes sense. The base
Object class has no coordinates and the default method only loads its id and children.
Reimplemented in gcu::Atom, gcu::Bond, gcu::CrystalBond, gcp::Arrow, gcp::Bond, gcp::Fragment, gcp::ReactionArrow, gcp::ReactionOperator, and gcp::TextObject.
virtual void gcu::Object::Transform2D |
( |
Matrix2D & |
m, |
|
|
double |
x, |
|
|
double |
y | |
|
) |
| | [virtual] |
- Parameters:
-
| 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. |
Used to move and/or transform an object. This virtual method must be overrided by
Object derived classes for which it makes sense. The base
Object class has no coordinates and the default method calls the corresponding method for every child.
Reimplemented in gcu::Atom, gcu::Bond, gcp::Arrow, gcp::Atom, gcp::Bond, gcp::Electron, gcp::Fragment, gcp::Mesomery, gcp::Molecule, gcp::Reaction, and gcp::Text.
virtual void gcu::Object::Add |
( |
GtkWidget * |
w |
) |
[virtual] |
- Parameters:
-
| w,: | the GtkWidget inside which the Object will be displayed. |
Used to add a representation of the
Object in the widget. This method might be overrided for displayable
Object classes unless the application uses another mechanism.
Reimplemented in gcp::Atom, gcp::Bond, gcp::Electron, gcp::FragmentAtom, gcp::Fragment, gcp::MesomeryArrow, gcp::Molecule, gcp::ReactionArrow, gcp::ReactionOperator, gcp::ReactionStep, and gcp::Text.
virtual void gcu::Object::Update |
( |
GtkWidget * |
w |
) |
[virtual] |
virtual bool gcu::Object::BuildContextualMenu |
( |
GtkUIManager * |
UIManager, |
|
|
Object * |
object, |
|
|
double |
x, |
|
|
double |
y | |
|
) |
| | [virtual] |
- Parameters:
-
| 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. |
This method is called to build a contextual menu for the object. It is called by Object::ShowContextualMenu, so it should not be necessary to call it directly. It should be overrided by derived classes when a contextual menu is needed. Typically, each class adds a submenu and calls the same method for its parent. Default implementation calls registered BuildMenuCb callbacks and the parent's method. Derived classes should call
Object::BuildContextualMenu before returning.
- Returns:
- true if something is added to the UIManager, false otherwise.
Reimplemented in gcp::Atom, gcp::Bond, gcp::Mesomery, gcp::Molecule, gcp::Reactant, gcp::ReactionArrow, and gcp::Reaction.