1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 #ifndef CAM_DATAMODEL_H
20 #define CAM_DATAMODEL_H
25 #include <qstringlist.h>
30 class SUIT_DataObject;
32 class CAM_EXPORT CAM_DataModel : public QObject
37 CAM_DataModel( CAM_Module* );
38 virtual ~CAM_DataModel();
40 virtual void initialize();
42 CAM_DataObject* root() const;
43 CAM_Module* module() const;
45 /** @name These methods should be redefined in successors.*/
47 virtual bool open( const QString&, CAM_Study*, QStringList ) { return true; }//!< return true
48 virtual bool save( QStringList& ) { return true; };
49 virtual bool saveAs( const QString&, CAM_Study*, QStringList& ) { return true; };
50 virtual bool close() { return true; };
51 virtual bool create( CAM_Study* ) { return true; }
55 /*! setRoot() should be used to specify custom root object instance.\n
56 * Such an object can be created in several ways, depending on application or module needs:\n
58 * \li while the model is being loaded
59 * \li when the model is updated and becomes non-empty
61 virtual void setRoot( const CAM_DataObject* );
64 void onDestroyed( SUIT_DataObject* );
67 void rootChanged( const CAM_DataModel* );
70 CAM_DataObject* myRoot;