Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/gui.git] / src / SalomeApp / SalomeApp_DataObject.h
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either 
6 // version 2.1 of the License.
7 // 
8 // This library is distributed in the hope that it will be useful 
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public  
14 // License along with this library; if not, write to the Free Software 
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #ifndef SALOMEAPP_DATAOBJECT_H
20 #define SALOMEAPP_DATAOBJECT_H
21
22 #include "SalomeApp.h"
23
24 #include "LightApp_DataObject.h"
25 #include "CAM_RootObject.h"
26
27 #include "SALOMEDSClient.hxx"
28
29 class SalomeApp_Study;
30
31 class SALOMEAPP_EXPORT SalomeApp_DataObject : public LightApp_DataObject
32 {
33
34 public:
35   enum { CT_Value, CT_Entry, CT_IOR, CT_RefEntry };
36
37 public:
38   SalomeApp_DataObject( SUIT_DataObject* = 0 );
39   SalomeApp_DataObject( const _PTR(SObject)&, SUIT_DataObject* = 0 );
40   virtual ~SalomeApp_DataObject();
41     
42   virtual QString                 name() const;
43   virtual QPixmap                 icon() const;
44   virtual QString                 toolTip() const;
45
46   virtual QString                 text( const int ) const;
47   virtual QColor                  color( const ColorRole ) const;
48
49   virtual QString                 entry() const;
50
51   /*! location of corresponding SALOMEDS::SObject  */
52   virtual _PTR(SObject)           object() const;
53
54   bool                            isReference() const;
55   _PTR(SObject)                   referencedObject() const;
56
57   /*! GEOM, SMESH, VISU, etc.*/
58   virtual QString                 componentDataType() const;
59
60 private:
61   QString                         ior( const _PTR(SObject)& ) const;
62   QString                         entry( const _PTR(SObject)& ) const;
63   QString                         value( const _PTR(SObject)& ) const;
64
65 private:
66   _PTR(SObject)                   myObject;
67   QString                         myEntry;
68   QString                         myName;
69 };
70
71 /*!
72  * SalomeApp_ModuleObject - class for optimized access to DataModel from
73  * SalomeApp_DataObject instances - see also CAM_RootObject.h
74  */
75
76 class SALOMEAPP_EXPORT SalomeApp_ModuleObject : public SalomeApp_DataObject,
77                                                 public CAM_RootObject
78 {
79 public:
80   SalomeApp_ModuleObject( SUIT_DataObject* = 0 );
81   SalomeApp_ModuleObject( const _PTR(SObject)&, SUIT_DataObject* = 0 );
82   SalomeApp_ModuleObject( CAM_DataModel*, const _PTR(SObject)&, SUIT_DataObject* = 0 );
83   virtual ~SalomeApp_ModuleObject();
84
85   virtual QString                 name() const;
86 };
87
88 /*!
89  * SalomeApp_SavePointObject - class that represents persistent visual_state object
90  * these objects are stored in data model, but NOT in SObjects structure, so we
91  * must handle them separately using this special class for them
92  */
93
94 class SALOMEAPP_EXPORT SalomeApp_SavePointObject : public virtual LightApp_DataObject
95 {
96 public:
97   SalomeApp_SavePointObject( SUIT_DataObject* parent, const int, SalomeApp_Study* study );
98   virtual ~SalomeApp_SavePointObject();
99   
100   virtual QString                 entry() const;
101
102   virtual QString                 name() const;
103   virtual QPixmap                 icon() const;
104   virtual QString                 toolTip() const;
105
106   int                             getId() const;
107
108 private:
109   int                             myId;
110   SalomeApp_Study*                myStudy;
111 };
112
113 /*!
114  * SalomeApp_SavePointRootObject - class that represents parent object for visual_state objects
115  */
116
117 class SALOMEAPP_EXPORT SalomeApp_SavePointRootObject : public SUIT_DataObject
118 {
119 public:
120   SalomeApp_SavePointRootObject( SUIT_DataObject* parent ) : SUIT_DataObject( parent ) {}
121   
122   virtual QString                 name() const   { return QObject::tr( "SAVE_POINT_ROOT_NAME" ); }
123   virtual QString                 toolTip() const{ return QObject::tr( "SAVE_POINT_ROOT_TOOLTIP" ); }
124 };
125
126 #endif