Salome HOME
Copyright update 2022
[modules/gui.git] / src / SalomeApp / SalomeApp_DataObject.h
1 // Copyright (C) 2007-2022  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, or (at your option) any later version.
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 // File   : SalomeApp_DataObject.h
24 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
25
26 #ifndef SALOMEAPP_DATAOBJECT_H
27 #define SALOMEAPP_DATAOBJECT_H
28
29 #include "SalomeApp.h"
30 #include <LightApp_DataObject.h>
31 #include <SALOMEDSClient.hxx>
32
33 class SalomeApp_Study;
34
35 class SALOMEAPPIMPL_EXPORT SalomeApp_DataObject : public virtual LightApp_DataObject
36 {
37
38 public:
39   //! Column id
40   enum {
41     ValueId = RefEntryId + 1,    //!< value column
42     IORId,                       //!< IOR column
43     LastId                       //!< indicates last Id value
44   };
45
46 public:
47   SalomeApp_DataObject( SUIT_DataObject* = 0 );
48   SalomeApp_DataObject( const _PTR(SObject)&, SUIT_DataObject* = 0 );
49   virtual ~SalomeApp_DataObject();
50
51   virtual QString        name() const;
52   virtual QString        entry() const;
53
54   virtual QString        text( const int = NameId ) const;
55   virtual QPixmap        icon( const int = NameId ) const;
56   virtual QColor         color( const ColorRole, const int = NameId ) const;
57   virtual QString        toolTip( const int = NameId ) const;
58   virtual QFont          font( const int = NameId ) const;
59
60   virtual _PTR(SObject)  object() const;
61
62   virtual QString        refEntry() const;
63   virtual bool           isReference() const;
64   _PTR(SObject)          referencedObject() const;
65
66   bool                   hasChildren() const;
67   bool                   expandable() const;
68
69   virtual bool           isVisible() const;
70
71   virtual QString        componentDataType() const;
72
73   virtual bool           customSorting( const int = NameId ) const;
74   virtual bool           compare( const QVariant&, const QVariant&, const int = NameId ) const;
75
76   virtual void           insertChildAtTag( SalomeApp_DataObject*, int );
77   virtual void           updateItem();
78
79 private:
80   QString                ior( const _PTR(SObject)& ) const;
81   QString                entry( const _PTR(SObject)& ) const;
82   QString                value( const _PTR(SObject)& ) const;
83
84 private:
85   _PTR(SObject)          myObject;
86 };
87
88 class SALOMEAPPIMPL_EXPORT SalomeApp_ModuleObject : public SalomeApp_DataObject,
89                                                 public CAM_ModuleObject
90 {
91 public:
92   SalomeApp_ModuleObject( SUIT_DataObject* = 0 );
93   SalomeApp_ModuleObject( const _PTR(SObject)&, SUIT_DataObject* = 0 );
94   SalomeApp_ModuleObject( CAM_DataModel*, const _PTR(SObject)&, SUIT_DataObject* = 0 );
95   virtual ~SalomeApp_ModuleObject();
96
97   virtual QString        name() const;
98   QPixmap                icon( const int = NameId ) const;
99   QString                toolTip( const int = NameId ) const;
100 };
101
102 class SALOMEAPPIMPL_EXPORT SalomeApp_RootObject : public SalomeApp_DataObject,
103                                               public LightApp_RootObject
104 {
105 public:
106   SalomeApp_RootObject( LightApp_Study* );
107   virtual ~SalomeApp_RootObject();
108
109   QString                name() const;
110   QString                entry() const;
111   QString                text( const int = NameId ) const;
112   QPixmap                icon( const int = NameId ) const;
113   QColor                 color( const ColorRole, const int = NameId ) const;
114   QString                toolTip( const int = NameId ) const;
115   void                   setToSynchronize(bool value){_toSynchronize=value;};
116   bool                   toSynchronize() const {return _toSynchronize;};
117 protected:
118   bool _toSynchronize;
119 };
120
121 class SALOMEAPPIMPL_EXPORT SalomeApp_SavePointObject : public virtual LightApp_DataObject
122 {
123 public:
124   SalomeApp_SavePointObject( SUIT_DataObject*, const int, SalomeApp_Study* );
125   virtual ~SalomeApp_SavePointObject();
126
127   virtual QString        name() const;
128   virtual QString        entry() const;
129
130   virtual QPixmap        icon( const int = NameId ) const;
131   virtual QString        toolTip( const int = NameId ) const;
132
133   int                    getId() const;
134
135 private:
136   int                    myId;
137   SalomeApp_Study*       myStudy;
138 };
139
140 class SALOMEAPPIMPL_EXPORT SalomeApp_SavePointRootObject : public SUIT_DataObject
141 {
142 public:
143   SalomeApp_SavePointRootObject( SUIT_DataObject* );
144
145   virtual QString        name() const;
146   virtual QString        toolTip( const int = NameId ) const;
147 };
148
149 #endif