Back to index

salome-gui  6.5.0
LightApp_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   : LightApp_DataObject.h
00024 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
00025 
00026 #ifndef LIGHTAPP_DATAOBJECT_H
00027 #define LIGHTAPP_DATAOBJECT_H
00028 
00029 #include "LightApp.h"
00030 #include <CAM_DataObject.h>
00031 
00032 class CAM_DataModel;
00033 class LightApp_Study;
00034 
00035 class LIGHTAPP_EXPORT LightApp_DataObject : public virtual CAM_DataObject
00036 {
00037   class Key;
00038 
00039 public:
00041   enum { 
00042     EntryId = VisibilityId + 1,    
00043     RefEntryId                     
00044   };
00045 
00046 public:
00047   LightApp_DataObject( SUIT_DataObject* = 0 );
00048   virtual ~LightApp_DataObject();
00049 
00050   virtual SUIT_DataObjectKey*     key() const;
00051   virtual QString                 entry() const;
00052 
00053   virtual QString                 refEntry() const;
00054   virtual bool                    isReference() const;
00055 
00056   virtual QString                 text( const int = NameId ) const;
00057   virtual QColor                  color( const ColorRole, const int = NameId ) const;
00058 
00059   virtual SUIT_DataObject*        componentObject() const;
00060   virtual QString                 componentDataType() const;
00061 
00062   virtual bool                    customSorting( const int = NameId ) const;
00063   virtual bool                    compare( const QVariant&, const QVariant&, const int = NameId ) const;
00064   virtual int                     groupId() const;
00065   virtual QVariant                customData(Qtx::CustomDataType type);
00066 
00067   virtual bool                    isVisible() const;
00068   virtual bool                    isDraggable() const;
00069   virtual bool                    isDropAccepted() const;
00070   virtual bool                    renameAllowed( const int = NameId ) const;
00071   virtual bool                    setName( const QString& );
00072 
00073 protected:
00074   QString                         myCompDataType;
00075   SUIT_DataObject*                myCompObject;
00076 };
00077 
00078 class LIGHTAPP_EXPORT LightApp_ModuleObject
00079 : public virtual LightApp_DataObject, public CAM_ModuleObject
00080 {
00081 public:
00082   LightApp_ModuleObject( SUIT_DataObject* = 0 );
00083   LightApp_ModuleObject( CAM_DataModel*, SUIT_DataObject* = 0 );
00084 
00085   virtual ~LightApp_ModuleObject();
00086 
00087   virtual QString        name() const;
00088   QPixmap                icon( const int = NameId ) const;
00089   QString                toolTip( const int = NameId ) const;
00090 
00091   virtual void           insertChild( SUIT_DataObject*, int );
00092 };
00093 
00094 class LIGHTAPP_EXPORT LightApp_RootObject : public virtual LightApp_DataObject
00095 {
00096 public:
00097   LightApp_RootObject( LightApp_Study* );
00098 
00099   virtual ~LightApp_RootObject();
00100 
00101   void                   setStudy( LightApp_Study* );
00102   LightApp_Study*        study() const;
00103 
00104 private:
00105   LightApp_Study*        myStudy;
00106 };
00107 
00108 #endif  // LIGHTAPP_DATAOBJECT_H