]> SALOME platform Git repositories - modules/gui.git/blob - src/CAM/CAM_DataModel.h
Salome HOME
9a065239d1e037ea9a9e5c36ffcba72a1e1d6189
[modules/gui.git] / src / CAM / CAM_DataModel.h
1 #ifndef CAM_DATAMODEL_H
2 #define CAM_DATAMODEL_H
3
4 #include "CAM.h"
5
6 #include <qobject.h>
7 #include <qstringlist.h>
8
9 class CAM_Module;
10 class CAM_DataObject;
11 class CAM_Study;
12 class SUIT_DataObject;
13
14 class CAM_EXPORT CAM_DataModel : public QObject
15 {
16   Q_OBJECT
17
18 public:
19   CAM_DataModel( CAM_Module* );
20   virtual ~CAM_DataModel();
21
22   virtual void     initialize();
23
24   CAM_DataObject*  root() const;
25   CAM_Module*      module() const;
26
27   /** @name These methods should be redefined in successors.*/
28   //@{
29   virtual bool     open( const QString&, CAM_Study*, QStringList ) { return true; }//!< return true
30   virtual bool     save( QStringList& ) { return true; };
31   virtual bool     saveAs( const QString&, CAM_Study*, QStringList&  ) { return true; };
32   virtual bool     close() { return true; };
33   virtual bool     create( CAM_Study* ) { return true; }
34   //@}
35
36 protected:
37   /*! setRoot() should be used to specify custom root object instance.\n
38    * Such an object can be created in several ways, depending on application or module needs:\n
39    * \li by initialize()
40    * \li while the model is being loaded
41    * \li when the model is updated and becomes non-empty 
42    */
43   virtual void     setRoot( const CAM_DataObject* );
44
45 private slots:
46   void             onDestroyed( SUIT_DataObject* );
47
48 signals:
49   void             rootChanged( const CAM_DataModel* );
50
51 private:
52   CAM_DataObject*  myRoot;
53   CAM_Module*      myModule;
54 };
55
56 #endif