Salome HOME
Update from BR_V5_DEV 13Feb2009
[modules/gui.git] / src / LightApp / LightApp_DataObject.h
index 4d3613dad736369fd8bb02f1e7de238598fdd6b6..94b4b838bbe7e9a77be92b974c87fa82773203f9 100644 (file)
@@ -1,40 +1,45 @@
-// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either 
-// version 2.1 of the License.
-// 
-// This library is distributed in the hope that it will be useful 
-// but WITHOUT ANY WARRANTY; without even the implied warranty of 
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-// Lesser General Public License for more details.
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-// You should have received a copy of the GNU Lesser General Public  
-// License along with this library; if not, write to the Free Software 
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File   : LightApp_DataObject.h
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
 //
 #ifndef LIGHTAPP_DATAOBJECT_H
 #define LIGHTAPP_DATAOBJECT_H
 
 #include "LightApp.h"
+#include <CAM_DataObject.h>
 
-#include "CAM_DataObject.h"
-#include "CAM_DataModel.h"
-#include "CAM_RootObject.h"
-
+class CAM_DataModel;
 class LightApp_Study;
 
-/*!Description : Data Object has empty entry so it's children must redefine metod entry() and return some unique string*/
-// to do : decomment virtual inheritance 
 class LIGHTAPP_EXPORT LightApp_DataObject : public virtual CAM_DataObject
 {
   class Key;
 
 public:
-  enum { CT_Value, CT_Entry, CT_IOR, CT_RefEntry };
+  //! Column id
+  enum { 
+    EntryId = NameId + 1    //!< entry column
+  };
 
 public:
   LightApp_DataObject( SUIT_DataObject* = 0 );
@@ -43,30 +48,48 @@ public:
   virtual SUIT_DataObjectKey*     key() const;
   virtual QString                 entry() const;
 
+  virtual QString                 text( const int = NameId ) const;
+
   virtual SUIT_DataObject*        componentObject() const;
   virtual QString                 componentDataType() const;
 
+  virtual bool                    customSorting( const int = NameId ) const;
+  virtual bool                    compare( const QVariant&, const QVariant&, const int = NameId ) const;
+  virtual int                     groupId() const;
+
 protected:
   QString                         myCompDataType;
   SUIT_DataObject*                myCompObject;
 };
 
-/*!
- * LightApp_ModuleObject - class for optimized access to DataModel from
- * CAM_RootObject.h.
- * In modules which will be redefine LightApp_DataObject, LightApp_ModuleObject must be children from rederined DataObject for having necessary properties and children from LightApp_ModuleObject.
- */
-
-class LIGHTAPP_EXPORT LightApp_ModuleObject : public CAM_RootObject
+class LIGHTAPP_EXPORT LightApp_ModuleObject
+: public virtual LightApp_DataObject, public CAM_ModuleObject
 {
 public:
   LightApp_ModuleObject( SUIT_DataObject* = 0 );
-  LightApp_ModuleObject ( CAM_DataModel*, SUIT_DataObject* = 0 );
+  LightApp_ModuleObject( CAM_DataModel*, SUIT_DataObject* = 0 );
 
   virtual ~LightApp_ModuleObject();
 
   virtual QString        name() const;
-  virtual void           insertChild( SUIT_DataObject*, int thePosition );
+  QPixmap                icon( const int = NameId ) const;
+  QString                toolTip( const int = NameId ) const;
+
+  virtual void           insertChild( SUIT_DataObject*, int );
+};
+
+class LIGHTAPP_EXPORT LightApp_RootObject : public virtual LightApp_DataObject
+{
+public:
+  LightApp_RootObject( LightApp_Study* );
+
+  virtual ~LightApp_RootObject();
+    
+  void                   setStudy( LightApp_Study* );
+  LightApp_Study*        study() const;
+  
+private:
+  LightApp_Study*        myStudy;
 };
 
-#endif
+#endif  // LIGHTAPP_DATAOBJECT_H