Salome HOME
Minor fix.
[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    */
51   HYDROGUI_DataObject( SUIT_DataObject* theParent,
52                        Handle(HYDROData_Object) theData );
53     
54   /**
55    * Returns the unique object identifier string.
56    */
57   virtual QString entry() const;
58
59   /**
60    * Returns the name of object.
61    */
62   virtual QString name() const;
63
64   /**
65    * Returns the model data object.
66    */
67   const Handle(HYDROData_Object)& modelObject() const { return myData; }
68
69   /**
70    * Redefines the object.
71    */
72   void setObject( Handle(HYDROData_Object) theObject ) { myData = theObject; }
73
74   /**
75    * Returns the entry prefix for all HYDRO data objects.
76    */
77   static QString entryPrefix() { return QString( "HYDRO_" ); }
78
79   /**
80    * Returns the full entry for the specified data object.
81    */
82   static QString dataObjectEntry( const Handle(HYDROData_Object)& theObject );
83
84 protected:
85   Handle(HYDROData_Object) myData; ///< object from data model
86 };
87
88 /**
89  * \class HYDROGUI_NamedObject
90  * \brief Module data object, used for object browser tree creation.
91  *
92  * It contains only name inside, without additional data: it is just information
93  * or grouping object in the Object Browser.
94  * This class inherits CAM_DataObject virtually, so it is necessary to call in the class
95  * constructor the CAM object constructor manually for the correct initialization
96  */
97 class HYDROGUI_NamedObject : public virtual LightApp_DataObject
98 {
99 public:
100   /**
101    * Constructor.
102    * \param theParent parent data object
103    * \param theName displayed name
104    */
105   HYDROGUI_NamedObject( SUIT_DataObject* theParent,
106                         const QString& theName );
107     
108   /**
109    * Returns the unique object identifier string.
110    */
111   virtual QString entry() const;
112
113   /**
114    * Returns the name of object.
115    */
116   virtual QString name() const;
117
118 private:
119   QString myName; ///< name in the OB
120 };
121
122 #endif