Salome HOME
Dialog SetupCurveDlg has been added
[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   // These methods should be redefined in successors.
27   virtual bool     open( const QString&, CAM_Study* ) { return true; }
28   virtual bool     save() { return true; };
29   virtual bool     saveAs( const QString&, CAM_Study* ) { return true; };
30   virtual bool     close() { return true; };
31   virtual bool     create( CAM_Study* ) { return true; }
32
33 protected:
34   virtual void     setRoot( const CAM_DataObject* );
35   // setRoot() should be used to specify custom root object instance.
36   // Such an object can be created in several ways, depending on application or module needs:
37   // - by initialize() 
38   // - while the model is being loaded 
39   // - when the model is updated and becomes non-empty
40
41 private slots:
42   void             onDestroyed( SUIT_DataObject* );
43
44 signals:
45   void             rootChanged( const CAM_DataModel* );
46
47 private:
48   CAM_DataObject*  myRoot;
49   CAM_Module*      myModule;
50 };
51
52 #endif