|
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 | 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 () |
bool | GetDirty (void) const |
Static Public Member Functions |
static TypeId | AddType (std::string TypeName, Object *(*CreateFunc)(), TypeId id=OtherType) |
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 () |
namespace.
virtual bool gcu::Object::BuildContextualMenu |
( |
GtkUIManager * |
UIManager, |
|
|
Object * |
object, |
|
|
double |
x, |
|
|
double |
y | |
|
) |
| | [virtual] |
- Parameters:
-
| 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. |
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 overriden 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::Mesomery, gcp::Molecule, gcp::Reactant, gcp::ReactionArrow, and gcp::Reaction.
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::FragmentResidue, 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] |
virtual xmlNodePtr gcu::Object::Save |
( |
xmlDocPtr |
xml |
) |
const [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, gcp::Atom, gcp::Electron, gcp::FragmentAtom, gcp::FragmentResidue, gcp::Fragment, gcp::MesomeryArrow, gcp::Molecule, gcp::Reactant, gcp::ReactionArrow, gcp::ReactionStep, and gcp::Text.
virtual bool gcu::Object::SetProperty |
( |
unsigned |
property, |
|
|
char const * |
value | |
|
) |
| | [virtual] |
- Parameters:
-
| property | the property id as defined in objprops.h |
| value | the property value as a string |
Used when loading to set properties to various objects. If the method returns false, the property should be set again later. This might happen if an atom does not exists when one of its bonds is loaded. All classes supporting the mechanism must overload this method.
- Returns:
- true if the property could be set, or if the property is not relevant, false otherwise.
Reimplemented in gcu::Atom, gcu::Bond, gcp::Arrow, gcp::Bond, gcp::Document, gcp::Fragment, gcp::ReactionArrow, and gcp::Text.
virtual void gcu::Object::Transform2D |
( |
Matrix2D & |
m, |
|
|
double |
x, |
|
|
double |
y | |
|
) |
| | [virtual] |
- Parameters:
-
| 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. |
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.