1 // -*- C++ -*- 2 3 /* 4 * Gnome Chemistry Utils 5 * object.h 6 * 7 * Copyright (C) 2002-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 GCU_OBJECT_H 26 #define GCU_OBJECT_H 27 28 #include "macros.h" 29 #include "matrix2d.h" 30 #include <libxml/parser.h> 31 #include <map> 32 #include <set> 33 #include <list> 34 #include <string> 35 #include <stdexcept> 36 37 #define square(x) ((x)*(x)) 38 39 /*!\file*/ 40 namespace gcu 41 { 42 43 class Dialog; 44 class Application; 45 class UIManager; 46 47 /*!\enum GcuTypeId 48 This enumeration is used to determine the type of an Object instance. 49 Possible values are: 50 - NoType invalid type 51 - AtomType an atom 52 - FragmentType several atoms linked and represented by a text such as COOH (only in GChemPaint). 53 - BondType a bond between two (or more) atoms. 54 - MoleculeType a molecule. 55 - ChainType a chain of atoms. 56 - CycleType a cycle. 57 - ReactantType a molecule involved in a reaction (only in GChemPaint). 58 - ReactionArrowType a reaction arrow (only in GChemPaint). 59 - ReactionOperatorType a + sign in a reaction (only in GChemPaint). 60 - ReactionType a reaction. 61 - MesomeryType a mesomery representation (only in GChemPaint). 62 - MesomeryArrowType a double headed arrow used to represent mesomery (only in GChemPaint). 63 - DocumentType a document, generally the top node in the objects tree. 64 - TextType some text (only in GChemPaint). 65 - OtherType if the type of an object is at least equal to OtherType, then it is a dynamically created type returned 66 by the static Object::AddType method. 67 . 68 Some types are not used in the Gnome Chemistry Utils, but only in GChemPaint 69 and might disappear from this list in future versions and replaced by dynamically created types. 70 */ 71 enum GcuTypeId 72 { 73 NoType, 74 AtomType, 75 FragmentType, 76 BondType, 77 MoleculeType, 78 ChainType, 79 CycleType, 80 ReactantType, 81 ReactionArrowType, 82 ReactionOperatorType, 83 ReactionType, 84 MesomeryType, 85 MesomeryArrowType, 86 DocumentType, 87 TextType, 88 OtherType 89 }; 90 91 /*! 92 The type of an object instance. Either predefined types are defined in the enum above 93 or dynamically defined types by calls to Object::AddType. 94 */ 95 typedef unsigned TypeId; 96 97 class Object; 98 99 /*! 100 The type of callbacks for adding new items to the contextual menu of an object. 101 @param target the Object whose menu is being built. 102 @param uim the UIManager to populate. 103 @param object the Object on which occured the mouse click. 104 @param x x coordinate of the mouse click. 105 @param y y coordinate of the mouse click. 106 */ 107 // FIXME: create a class for UIManager 108 typedef bool (*BuildMenuCb) (Object *target, UIManager *uim, Object *object, double x, double y); 109 110 class TypeDesc 111 { 112 public: 113 TypeDesc (); 114 115 TypeId Id; 116 Object* (*Create) (); 117 std::set <TypeId> PossibleChildren; 118 std::set <TypeId> PossibleParents; 119 std::set <TypeId> RequiredChildren; 120 std::set <TypeId> RequiredParents; 121 std::string CreationLabel; 122 std::list <BuildMenuCb> MenuCbs; 123 }; 124 125 class Object; 126 127 /*!\enum RuleId 128 This enumeration is used to maintain a set of rules about the possible 129 hierarchical of the document. They are used with two class names or ids. 130 Possible values are: 131 - RuleMayContain an instance of the first class may contain an instance of the second. 132 This implies that an instance of the second class may be in an instance of the first (see RuleMayBeIn); 133 - RuleMustContain an instance of the first class may contain an instance of the second class (implies RuleMayContain); 134 if no instance of the first class is present, the object is not valid. 135 - RuleMayBeIn an instance of the first class may be the child of an instance of the second class (see also RuleMayContain); 136 - RuleMustBeIn an instance of the first class must be the child of an instance of the second class, otherwise 137 it is not valid. 138 */ 139 enum RuleId 140 { 141 RuleMayContain, 142 RuleMustContain, 143 RuleMayBeIn, 144 RuleMustBeIn 145 }; 146 147 /*! 148 The types of the signals used in Object::EmitSignal() and Object::OnSignal(). Each signal 149 must type be retrieved from a call to Object::CreateNewSignalId(). 150 */ 151 typedef unsigned SignalId; 152 153 class Document; 154 155 /*!\class Object gcu/object.h 156 This is the base class for most other objects in the gcu namespace. 157 */ 158 class Object 159 { 160 friend class Application; 161 public: 162 /*! 163 Used to create an object of type Id. Should only be called from the constructor of a derived class. 164 */ 165 Object (TypeId Id = OtherType); 166 /*! 167 The standard destructor of Object instances. Automatically called when the object is destroyed. 168 */ 169 virtual ~Object (); 170 171 /*! 172 @return the type of the object. If the type is at least equal to OtherType, it is a dynamically created type returned by 173 the Object::AddType method. 174 */ GetType()175 TypeId GetType () const {return m_Type;} 176 /*! 177 @param Id the id of the Object instance. 178 179 Every object must have an Id, since searches in the document tree uses it. 180 */ 181 void SetId (gchar const *Id); 182 /*! 183 @return the Id of the Object instance. 184 */ GetId()185 char const *GetId () const {return m_Id;} 186 /*! 187 @param object the Object instance to add as a child. 188 189 Each Object instance maintains a list of its children. If object has already a parent, it will be removed from its 190 parent children list. The new parent Object must have a Document ancestor to ensure that Ids are unique. 191 */ 192 virtual void AddChild (Object* object); 193 /*! 194 Used to get the Molecule in the Object instances ancestors. Overloaded methods should call the 195 base class Object::AddChild. 196 197 @return the first Object of type MoleculeType encountered when exploring 198 the Objects tree or NULL if none is found. 199 */ 200 Object* GetMolecule () const; 201 /*! 202 Used to get the Reaction in the Object instances ancestors. 203 204 @return the first Object of type ReactionType encountered when exploring 205 the Objects tree or NULL if none is found. 206 */ 207 Object* GetReaction () const; 208 /*! 209 Used to get the highest ancestor just before the document 210 in the Object instances ancestors. 211 212 @return the last Object encountered before the document when exploring 213 the Objects tree or NULL if the object's parent is the document itself. 214 */ 215 Object* GetGroup () const; 216 /*! 217 Used to get the Document in the Object instances ancestors. 218 219 @return the first Object of type DocumentType encountered when exploring 220 the Objects tree (only one should be found) or NULL if none is found. 221 */ 222 Document* GetDocument () const; 223 /*! 224 Used to get the Application owning the Object. 225 226 @return the Application owning the Object or NULL. 227 */ 228 Application* GetApplication () const; 229 /*! 230 @param Id the type of the ancestor searched. 231 232 Used to get the first ancestor of type Id in the Object instances ancestors. 233 GetDocument, GetMolecule and GetReaction are special cases of this method. 234 235 @return the first Object of type Id encountered when exploring 236 the Objects tree (only one should be found) or NULL if none is found. 237 */ 238 Object* GetParentOfType (TypeId Id) const; 239 /*! 240 @param Id the Id of the child searched. 241 242 To search the Object in lower shells of the tree, use the Object::GetDescendant method. 243 @return the Object instance of type Id if found in the children list or NULL if not found. 244 */ 245 Object* GetChild (const gchar* Id) const; 246 /*! 247 @param i a C++ std::map iterator. 248 249 Use this function to retrieve the first child of the object and initialize the iterator. 250 @return the first child of the object or NULL. 251 */ 252 Object *GetFirstChild (std::map<std::string, Object*>::iterator& i); 253 Object const *GetFirstChild (std::map<std::string, Object*>::const_iterator& i) const; 254 /*! 255 @param i a C++ std::map iterator initialized by Object::GetFirstChild. 256 257 Use this method to iterate through the list of the Object children. 258 @return the next child of the object or NULL. 259 */ 260 Object *GetNextChild (std::map<std::string, Object*>::iterator& i); 261 Object const *GetNextChild (std::map<std::string, Object*>::const_iterator& i) const; 262 /*! 263 @param Id the Id of the descendant searched. 264 265 This method searches the Object in its children and if not found calls the GetDescendant method for its children. 266 @return the Object instance of type Id if found in the decendants or NULL if not found. 267 */ 268 Object* GetDescendant (const char* Id) const; 269 /*! 270 @return the parent of the Object. 271 */ GetParent()272 Object* GetParent () const {return m_Parent;}; 273 /*! 274 @param Parent the new parent of the Object or NULL. 275 276 When Parent is not NULL, this is equivalent to \code Parent->AddChild(this);\endcode 277 Otherwise, it removes the Object from the Document tree. 278 */ 279 void SetParent (Object* Parent); 280 /*! 281 @param xml the xmlDoc used to save the document. 282 283 Used to save the Object to the xmlDoc. Each serializable Object should implement this virtual method. 284 @return the xmlNode containing the serialized object. The name of the node should be the name of the 285 corresponding type used as first parameter to the Object::AddType method. The 286 default method just saves the id and children. 287 */ 288 virtual xmlNodePtr Save (xmlDocPtr xml) const; 289 /*! 290 @param node a pointer to the xmlNode containing the serialized object. 291 292 Used to load an Object in memory. The Object must already exist. 293 294 Example: \code 295 std::string str = (const char*)node->name; 296 Object* pObject = Object::CreateObject(str, this); 297 if (pObject) { 298 if (!pObject->Load(node)) delete Object; 299 } else 300 cerr << "Warning: unknown object: " << str << endl; 301 \endcode 302 303 @return true on succes, false otherwise. 304 */ 305 virtual bool Load (xmlNodePtr node); 306 /*! 307 @param x a pointer to the double value which will receive the x coordinate of the Object. 308 @param y a pointer to the double value which will receive the y coordinate of the Object. 309 @param z a pointer to the double value which will receive the z coordinate of the Object or NULL for 2D representations. 310 311 Retrieves the coordinates of this Object if relevant. 312 @return true if successful and false if an error occurs (if x or y is NULL). 313 */ 314 virtual bool GetCoords (double *x, double *y, double *z = NULL) const; 315 /*! 316 @param x the x component of the transation vector. 317 @param y the y component of the transation vector. 318 @param z the z component of the transation vector. 319 320 Used to move an object. This virtual method should most often be overrided by Object derived classes for which it makes sense. 321 The base Object class has no coordinates and the default method only loads its id and children. 322 */ 323 virtual void Move (double x, double y, double z = 0.); 324 /*! 325 @param m the Matrix2D of the transformation. 326 @param x the x component of the center of the transformation. 327 @param y the y component of the center of the transformation. 328 329 Used to move and/or transform an object. 330 This virtual method must be overrided by Object derived classes for which it makes sense. 331 The base Object class has no coordinates and the default method calls the corresponding method 332 for every child. 333 */ 334 virtual void Transform2D (Matrix2D& m, double x, double y); 335 /*! 336 @param xml the xmlDoc used to save the document. 337 @param node the node representing the Object. 338 339 This method calls Object::Save fo each child of the Object instance and add the xmlNode returned to the children of node. 340 It might be called from the Save method of objects having serializable children. 341 @return true on succes, false otherwise. 342 */ 343 bool SaveChildren (xmlDocPtr xml, xmlNodePtr node) const; 344 /*! 345 @param node the node representing the Object. 346 347 This helper method saves the Id of the node as a property of the xmlNode. 348 */ 349 void SaveId (xmlNodePtr node) const; 350 /*! 351 @param node the node where the search is to be done. 352 @param Property the name of the property used in the search. 353 @param Id the value to match to the property. 354 355 Helper method used in conjunction with Object::GetNextNodeByProp to search xmlNode instances having a property Property 356 whose value is Id in the children of node. 357 358 @return the node corresponding to the first match. This value is to be passed to Object::GetNextNodeByProp to iterate in the list 359 */ 360 xmlNodePtr GetNodeByProp (xmlNodePtr node, char const *Property, char const *Id); 361 /*! 362 @param node the xmlNodePtr returned by Object::GetNodeByProp or the last call to Object::GetNextNodeByProp. 363 @param Property the name of the property used in the search. 364 @param Id the value to match to the property. 365 366 Helper method used to iterate through a list of xmlNodePtr searching for a special value of a property. 367 Generally, the iteration is initialized by a call to Object::GetNodeByProp. 368 @return the next matching node. 369 */ 370 xmlNodePtr GetNextNodeByProp (xmlNodePtr node, char const *Property, char const *Id); 371 /*! 372 @param node the node where the search is to be done. 373 @param Name the name of the xmlNode searched. 374 375 Helper method used in conjunction with Object::GetNextNodeByProp to search xmlNode instances of name Name 376 in the children of node. 377 378 @return the node corresponding to the first match. This value is to be passed to Object::GetNextNodeByName to iterate in the list. 379 */ 380 xmlNodePtr GetNodeByName (xmlNodePtr node, char const *Name); 381 /*! 382 @param node the xmlNodePtr returned by Object::GetNodeByName or the last call to Object::GetNextNodeByName. 383 @param Name the name of the xmlNode searched. 384 385 Helper method used to iterate through a list of xmlNodePtr searching for nodes whose name is Name. 386 Generally, the iteration is initialized by a call to Object::GetNodeByName. 387 @return the next matching node. 388 */ 389 xmlNodePtr GetNextNodeByName (xmlNodePtr node, char const *Name); 390 /*! 391 @return true if the Object has at least a child an false if it has none. 392 */ HasChildren()393 bool HasChildren () const {return m_Children.size () != 0;} 394 395 /*! 396 @return the children number of the Object. 397 */ GetChildrenNumber()398 unsigned GetChildrenNumber () const {return m_Children.size ();} 399 400 /*! 401 @param x the x coordinate 402 @param y the y coordinate 403 @param z the z coordinate 404 405 @return a pointer to a child of type Atomtype at or near position defined by the coordinates 406 passed as parameters. Default implementation returns NULL. 407 */ 408 virtual Object* GetAtomAt (double x, double y, double z = 0.); 409 410 /*! 411 @param Children the list of objects used as children to build the object 412 413 This method is called to build a parent object from its children. The object must already exist. 414 @return true in case of success and false if failed. 415 */ 416 virtual bool Build (std::set < Object * > const &Children) throw (std::invalid_argument); 417 418 /*! 419 Used to retrieve the y coordinate for alignment. The default implementation returns 0.0 and 420 every derived class for which alignment has a meaning should implement this method. 421 @return y coordinate used for objects alignment. 422 */ 423 virtual double GetYAlign (); 424 425 /*! 426 @param uim the UIManager to populate. 427 @param object the Object on which occured the mouse click. 428 @param x x coordinate of the mouse click. 429 @param y y coordinate of the mouse click. 430 431 This method is called to build a contextual menu for the object. It is called by Object::ShowContextualMenu, so 432 it should not be necessary to call it directly. It should be overriden by derived classes when a contextual menu 433 is needed. Typically, each class adds a submenu and calls the same method for its parent. 434 Default implementation calls registered BuildMenuCb callbacks and the parent's method. 435 Derived classes should call Object::BuildContextualMenu before returning. 436 @return true if something is added to the UIManager, false otherwise. 437 */ 438 virtual bool BuildContextualMenu (UIManager *uim, Object *object, double x, double y); 439 440 /*! 441 @param Signal the appropriate SignalId 442 443 Sends a signal to the object parent. The signal may be propagated to the ancestors (see 444 Object::OnSignal ()). 445 */ 446 void EmitSignal (SignalId Signal); 447 448 /*! 449 @param Signal the appropriate SignalId 450 @param Child the child which emitted the signal or NULL 451 452 This function is called by the framework when a signal has been emitted for the object. 453 It should not be called by a program; call Object::EmitSignal instead. 454 455 @return true if the signal should be propagated to the parent, false otherwise. 456 */ 457 virtual bool OnSignal (SignalId Signal, Object *Child); 458 459 /*! 460 @param state whether to block signals or not 461 462 Blocks signals if State is true and unblocs if state is false. 463 464 Since 0.4.2 465 */ 466 void Lock (bool state = true); 467 468 /*! 469 470 @return true if signals are locked, false otherwise 471 472 Since 0.4.2 473 */ IsLocked()474 bool IsLocked () {return m_Locked > 0;} 475 476 /*! 477 @param i a C++ std::set<Object*> iterator. 478 479 Use this function to retrieve the first object linked to the object and initialize the iterator. 480 Links can be used when the relation between the objects is not a parent to child one. 481 @return the first object linked to the object or NULL. 482 */ 483 Object* GetFirstLink (std::set<Object*>::iterator& i); 484 485 /*! 486 @param i a C++ std::set<Object*> iterator initialized by Object::GetFirstLink. 487 488 Use this method to iterate through the list of Object instances linked to the object. 489 @return the next object linked to the object or NULL. 490 */ 491 Object* GetNextLink (std::set<Object*>::iterator& i); 492 493 /*! 494 @param object the object to link. 495 496 Adds a link to \a object. 497 */ 498 void Link (Object *object); 499 500 /*! 501 @param object the object to unlink. 502 503 Unlinks object and calls Object::OnUnlink. 504 */ 505 void Unlink (Object *object); 506 507 /*! 508 @param object the object just unlinked by Object::Unlink. 509 510 Virtual method called when an object has been unlinked. Programs should not call it 511 directly, but should call Object::OnUnlink instead. 512 */ 513 virtual void OnUnlink (Object *object); 514 515 /*! 516 @param types the list of TypeId values to fill 517 518 Fills types with all valid ancestor types for the object as defined by rules created with AddRule 519 */ 520 void GetPossibleAncestorTypes (std::set<TypeId>& types) const; 521 522 /*! 523 @param property the property id as defined in objprops.h 524 @param value the property value as a string 525 526 Used when loading to set properties to various objects. If the method returns false, 527 the property should be set again later. This might happen if an atom does not exists when one 528 of its bonds is loaded. All classes supporting the mechanism must overload this method. 529 @return true if the property could be set, or if the property is not relevant, false otherwise. 530 */ 531 virtual bool SetProperty (unsigned property, char const *value); 532 533 /*! 534 @param property the property id as defined in objprops.h 535 536 Used when saving to get properties from various objects. All classes 537 supporting the mechanism must overload this method. 538 @return the value of the property as a string. 539 */ 540 virtual std::string GetProperty (unsigned property) const; 541 542 /*! 543 This method should be called when an object has been fully loaded. The default method doesn't do anything. 544 */ 545 virtual void OnLoaded (); 546 547 /*! 548 @param dirty should be true if the object needs some update, false otherwise. For a document, 549 it means that the document has been changed. 550 */ 551 void SetDirty (bool dirty = true); 552 553 /*! 554 Deletes all children. Derived classes might override this method if needed. 555 */ 556 virtual void Clear (); 557 558 /*! 559 @return the object generic name. 560 */ 561 virtual std::string Name (); 562 563 /*! 564 @return the object identity composed of the object name as returned by 565 gcu::Object::Name() concatenated with its unique Id as returned by gcu::Object::GetId(). 566 */ 567 std::string Identity (); 568 569 /*! 570 @return the name of the properties dialog for this object if one exists, or NULL. 571 */ 572 virtual char const *HasPropertiesDialog () const; 573 574 /*! 575 @return true if the object can be safely selected. Default implementation returns true. 576 */ CanSelect()577 virtual bool CanSelect () const {return true;} 578 579 /*! 580 Called by Object::Destructor() when the parent becomes empty. Default implementation does 581 nothing. 582 */ NotifyEmpty()583 virtual void NotifyEmpty () {;} 584 585 /*! 586 Exposes the gcu::Dialog related to the object properties if it exists. 587 */ 588 void ShowPropertiesDialog (); 589 590 /*! 591 @param TypeName the name of the new type. 592 @param CreateFunc a pointer to a function returning a pointer to a new object of the new type. 593 @param id the Id of the type to create if a standard one or OtherType for a new type. In this last case, this parameter 594 can be omitted. 595 596 This method is used to register a new type derived from Object. 597 598 This method is deprecated, use Application::AddType() instead. 599 600 @return the Id of the new type. 601 */ 602 static TypeId AddType (std::string TypeName, Object* (*CreateFunc) (), TypeId id = OtherType); 603 604 /*! 605 @param id the Id of an existing type. 606 @param TypeName a new name for the type. 607 608 This method is used to add an alternative name to an existing type. 609 */ 610 static void AddAlias (TypeId id, std::string TypeName); 611 612 /*! 613 @param TypeName the name of the new type. 614 @param parent the parent of the newly created object or NULL. if NULL, the parameter can be omitted. 615 616 Used to create an object of type name TypeName. The Object::AddType method must have been called with the same 617 TypeName parameter. if parent is given and not NULL, the new Object will be a child of parent. 618 It will also be given a default Id. 619 620 This method is deprecated, use Application::CreateObject() instead. 621 622 @return a pointer to the newly created Object or NULL if the Object could not be created. 623 */ 624 static Object* CreateObject (const std::string& TypeName, Object* parent = NULL); 625 626 /*! 627 @param Name the name of the Object derived class 628 629 @return the TypeId corresponding to Name 630 */ 631 static TypeId GetTypeId (const std::string& Name); 632 633 /*! 634 @param Id the TypeId of the Object derived class 635 636 @return the name of the type. 637 */ 638 static std::string GetTypeName (TypeId Id); 639 640 /*! 641 @param Id the TypeId of the Object derived class 642 @param cb the BuildMenuCb callback to call when building the menu. 643 644 adds a callback for modifying the contextual menu of objects of type Id. 645 646 This method is deprecated, use Application::AddMenuCallback() instead. 647 */ 648 static void AddMenuCallback (TypeId Id, BuildMenuCb cb); 649 650 /*! 651 @param type1 the TypeId of the first class in the rule 652 @param rule the new rule value 653 @param type2 the TypeId of the second class in the rule 654 655 This method is deprecated, use Application::AddRule() instead. 656 657 Adds a rule. 658 */ 659 static void AddRule (TypeId type1, RuleId rule, TypeId type2); 660 661 /*! 662 @param type1 the name of the first class in the rule 663 @param rule the new rule value 664 @param type2 the name of the second class in the rule 665 666 This method is deprecated, use Application::AddRule() instead. 667 668 Adds a rule. 669 */ 670 static void AddRule (const std::string& type1, RuleId rule, const std::string& type2); 671 672 /*! 673 @param type the TypeId of a class 674 @param rule a RuleId value 675 676 This method is deprecated, use Application::GetRules() instead. 677 678 @return the set of rules correponding to the RuleId value for this class. 679 */ 680 static const std::set<TypeId>& GetRules (TypeId type, RuleId rule); 681 682 /*! 683 @param type the name of a class 684 @param rule a RuleId value 685 686 This method is deprecated, use Application::GetRules() instead. 687 688 @return the set of rules correponding to the RuleId value for this class. 689 */ 690 static const std::set<TypeId>& GetRules (const std::string& type, RuleId rule); 691 692 /*! 693 @param Id the TypeId of a class 694 @param Label the string to display in a contextual menu 695 696 Used to give a label for contextual menus used when the creation of an instance of 697 the class seems possible. 698 699 This method is deprecated, use Application::SetCreationLabel() instead. 700 */ 701 static void SetCreationLabel (TypeId Id, std::string Label); 702 703 /*! 704 @param Id the TypeId of a class 705 706 This method is deprecated, use Application::GetCreationLabel() instead. 707 708 @return the string defined by SetCreationLabel. 709 */ 710 static const std::string& GetCreationLabel (TypeId Id); 711 712 /*! 713 @param TypeName the name of a class 714 715 This method is deprecated, use Application::GetCreationLabel() instead. 716 717 @return the string defined by SetCreationLabel. 718 */ 719 static const std::string& GetCreationLabel (const std::string& TypeName); 720 721 /*! 722 @return a new SignalId. 723 */ 724 static SignalId CreateNewSignalId (); 725 726 protected: 727 /*! 728 @return the gcu::Dialog related to the object properties or NULL if none exists. 729 */ 730 virtual Dialog *BuildPropertiesDialog (); 731 732 private: 733 Object* RealGetDescendant (const gchar* Id) const; 734 735 private: 736 char* m_Id; 737 TypeId m_Type; 738 Object *m_Parent; 739 std::map<std::string, Object*> m_Children; //string is Id of object, so each object must have an Id 740 std::set<Object*> m_Links; //objects linked to this but outside of the hierarchy 741 TypeDesc const *m_TypeDesc; 742 743 private: 744 /*! 745 Set to true while loading to avoid signal propagation. 746 */ 747 int m_Locked; 748 749 /*!\fn GetDirty() 750 @return true if the document has changed since it was opened or last saved, 751 false otherwise. 752 */ 753 GCU_RO_PROP (bool, Dirty); 754 }; 755 756 } 757 #endif //GCU_OBJECT_H 758