Salome HOME
Fix for bug 10438: Crash during Explode on Blocks operation (Global selection on...
[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
8 class CAM_Module;
9 class CAM_DataObject;
10 class CAM_Study;
11 class SUIT_DataObject;
12
13 class CAM_EXPORT CAM_DataModel : public QObject
14 {
15   Q_OBJECT
16
17 public:
18   CAM_DataModel( CAM_Module* );
19   virtual ~CAM_DataModel();
20
21   virtual void     initialize();
22
23   CAM_DataObject*  root() const;
24   CAM_Module*      module() const;
25
26   /** @name These methods should be redefined in successors.*/
27   //@{
28   virtual bool     open( const QString&, CAM_Study* ) { return true; }//!< return true
29   virtual bool     save() { return true; };
30   virtual bool     saveAs( const QString&, CAM_Study* ) { return true; };
31   virtual bool     close() { return true; };
32   virtual bool     create( CAM_Study* ) { return true; }
33   //@}
34
35 protected:
36   /*! setRoot() should be used to specify custom root object instance.\n
37    * Such an object can be created in several ways, depending on application or module needs:\n
38    * \li by initialize()
39    * \li while the model is being loaded
40    * \li when the model is updated and becomes non-empty 
41    */
42   virtual void     setRoot( const CAM_DataObject* );
43
44 private slots:
45   void             onDestroyed( SUIT_DataObject* );
46
47 signals:
48   void             rootChanged( const CAM_DataModel* );
49
50 private:
51   CAM_DataObject*  myRoot;
52   CAM_Module*      myModule;
53 };
54
55 #endif