Back to index

salome-gui  6.5.0
SalomeApp_DataObject.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // File   : SalomeApp_DataObject.h
00024 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
00025 
00026 #ifndef SALOMEAPP_DATAOBJECT_H
00027 #define SALOMEAPP_DATAOBJECT_H
00028 
00029 #include "SalomeApp.h"
00030 #include <LightApp_DataObject.h>
00031 #include <SALOMEDSClient.hxx>
00032 
00033 class SalomeApp_Study;
00034 
00035 class SALOMEAPP_EXPORT SalomeApp_DataObject : public virtual LightApp_DataObject
00036 {
00037 
00038 public:
00040   enum {
00041     ValueId = RefEntryId + 1,    
00042     IORId,                       
00043     LastId                       
00044   };
00045 
00046 public:
00047   SalomeApp_DataObject( SUIT_DataObject* = 0 );
00048   SalomeApp_DataObject( const _PTR(SObject)&, SUIT_DataObject* = 0 );
00049   virtual ~SalomeApp_DataObject();
00050 
00051   virtual QString        name() const;
00052   virtual QString        entry() const;
00053 
00054   virtual QString        text( const int = NameId ) const;
00055   virtual QPixmap        icon( const int = NameId ) const;
00056   virtual QColor         color( const ColorRole, const int = NameId ) const;
00057   virtual QString        toolTip( const int = NameId ) const;
00058   virtual QFont          font( const int = NameId ) const;
00059 
00060   virtual _PTR(SObject)  object() const;
00061 
00062   virtual QString        refEntry() const;
00063   virtual bool           isReference() const;
00064   _PTR(SObject)          referencedObject() const;
00065 
00066   bool                   hasChildren() const;
00067   bool                   expandable() const;
00068 
00069   virtual bool           isVisible() const;
00070 
00071   virtual QString        componentDataType() const;
00072 
00073   virtual bool           customSorting( const int = NameId ) const;
00074   virtual bool           compare( const QVariant&, const QVariant&, const int = NameId ) const;
00075 
00076   virtual void           insertChildAtTag( SalomeApp_DataObject*, int );
00077   virtual void           updateItem();
00078 
00079 private:
00080   QString                ior( const _PTR(SObject)& ) const;
00081   QString                entry( const _PTR(SObject)& ) const;
00082   QString                value( const _PTR(SObject)& ) const;
00083 
00084 private:
00085   _PTR(SObject)          myObject;
00086 };
00087 
00088 class SALOMEAPP_EXPORT SalomeApp_ModuleObject : public SalomeApp_DataObject,
00089                                                 public CAM_ModuleObject
00090 {
00091 public:
00092   SalomeApp_ModuleObject( SUIT_DataObject* = 0 );
00093   SalomeApp_ModuleObject( const _PTR(SObject)&, SUIT_DataObject* = 0 );
00094   SalomeApp_ModuleObject( CAM_DataModel*, const _PTR(SObject)&, SUIT_DataObject* = 0 );
00095   virtual ~SalomeApp_ModuleObject();
00096 
00097   virtual QString        name() const;
00098   QPixmap                icon( const int = NameId ) const;
00099   QString                toolTip( const int = NameId ) const;
00100 };
00101 
00102 class SALOMEAPP_EXPORT SalomeApp_RootObject : public SalomeApp_DataObject,
00103                                               public LightApp_RootObject
00104 {
00105 public:
00106   SalomeApp_RootObject( LightApp_Study* );
00107   virtual ~SalomeApp_RootObject();
00108 
00109   QString                name() const;
00110   QString                entry() const;
00111   QString                text( const int = NameId ) const;
00112   QPixmap                icon( const int = NameId ) const;
00113   QColor                 color( const ColorRole, const int = NameId ) const;
00114   QString                toolTip( const int = NameId ) const;
00115   void                   setToSynchronize(bool value){_toSynchronize=value;};
00116   bool                   toSynchronize() const {return _toSynchronize;};
00117 protected:
00118   bool _toSynchronize;
00119 };
00120 
00121 class SALOMEAPP_EXPORT SalomeApp_SavePointObject : public virtual LightApp_DataObject
00122 {
00123 public:
00124   SalomeApp_SavePointObject( SUIT_DataObject*, const int, SalomeApp_Study* );
00125   virtual ~SalomeApp_SavePointObject();
00126 
00127   virtual QString        name() const;
00128   virtual QString        entry() const;
00129 
00130   virtual QPixmap        icon( const int = NameId ) const;
00131   virtual QString        toolTip( const int = NameId ) const;
00132 
00133   int                    getId() const;
00134 
00135 private:
00136   int                    myId;
00137   SalomeApp_Study*       myStudy;
00138 };
00139 
00140 class SALOMEAPP_EXPORT SalomeApp_SavePointRootObject : public SUIT_DataObject
00141 {
00142 public:
00143   SalomeApp_SavePointRootObject( SUIT_DataObject* );
00144 
00145   virtual QString        name() const;
00146   virtual QString        toolTip( const int = NameId ) const;
00147 };
00148 
00149 #endif