Salome HOME
33b53a36a8914b97a74ee413828d788b9ea1afb8
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_DataObject.h
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef HYDROGUI_DATAOBJECT_H
24 #define HYDROGUI_DATAOBJECT_H
25
26 #include <HYDROData_Object.h>
27
28 #include <LightApp_DataObject.h>
29
30 #include <QString>
31 #include <QMap>
32 #include <QPixmap>
33
34 /**
35  * \class HYDROGUI_DataObject
36  * \brief Module data object, used for object browser tree creation.
37  *
38  * This is an Object Browser object that contains reference to data structure 
39  * element inside.
40  * This class inherits CAM_DataObject virtually, so it is necessary to call in the class
41  * constructor the CAM object constructor manually for the correct initialization
42  */
43 class HYDROGUI_DataObject : public LightApp_DataObject
44 {
45 public:
46   /**
47    * Constructor.
48    * \param theParent parent data object
49    * \param theData reference to the corresponding object from data structure
50    * \param theParentEntry entry of the parent data object (for reference objects)
51    */
52   HYDROGUI_DataObject( SUIT_DataObject* theParent,
53                        Handle(HYDROData_Object) theData,
54                        const QString& theParentEntry );
55     
56   /**
57    * Returns the unique object identifier string.
58    */
59   virtual QString entry() const;
60
61   /**
62    * Returns the entry of the referenced object.
63    */
64   virtual QString refEntry() const;
65
66   /**
67    * Returns the name of object.
68    */
69   virtual QString name() const;
70
71   /**
72    * Returns the model data object.
73    */
74   const Handle(HYDROData_Object)& modelObject() const { return myData; }
75
76   /**
77    * Redefines the object.
78    */
79   void setObject( Handle(HYDROData_Object) theObject ) { myData = theObject; }
80
81   /**
82    * Returns the entry prefix for all HYDRO data objects.
83    */
84   static QString entryPrefix() { return QString( "HYDRO:" ); }
85
86   /**
87    * Returns the full entry for the specified data object.
88    */
89   static QString dataObjectEntry( const Handle(HYDROData_Object)& theObject );
90
91 protected:
92   Handle(HYDROData_Object) myData; ///< object from data model
93   QString myParentEntry;
94 };
95
96 /**
97  * \class HYDROGUI_NamedObject
98  * \brief Module data object, used for object browser tree creation.
99  *
100  * It contains only name inside, without additional data: it is just information
101  * or grouping object in the Object Browser.
102  * This class inherits CAM_DataObject virtually, so it is necessary to call in the class
103  * constructor the CAM object constructor manually for the correct initialization
104  */
105 class HYDROGUI_NamedObject : public virtual LightApp_DataObject
106 {
107 public:
108   /**
109    * Constructor.
110    * \param theParent parent data object
111    * \param theName displayed name
112    */
113   HYDROGUI_NamedObject( SUIT_DataObject* theParent,
114                         const QString& theName );
115     
116   /**
117    * Returns the unique object identifier string.
118    */
119   virtual QString entry() const;
120
121   /**
122    * Returns the name of object.
123    */
124   virtual QString name() const;
125
126 private:
127   QString myName; ///< name in the OB
128 };
129
130 #endif