X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_DataTreeModel.h;h=676c9d8fdf98e249441ae195287e952f57e4d033;hb=d86c77d1c6210bbe04fbc3e5b00f9e212e1ec930;hp=3be26bd2a53c0f1200c99c7e84cd8c5efaff32c1;hpb=1ee8245fa4f613308c85ee9e844fe8d6af016930;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_DataTreeModel.h b/src/XGUI/XGUI_DataTreeModel.h index 3be26bd2a..676c9d8fd 100644 --- a/src/XGUI/XGUI_DataTreeModel.h +++ b/src/XGUI/XGUI_DataTreeModel.h @@ -1,29 +1,35 @@ - #ifndef XGUI_DataTreeModel_H #define XGUI_DataTreeModel_H +#include "XGUI.h" +#include "XGUI_Constants.h" + #include #include -#include "XGUI_Constants.h" - /**\class XGUI_FeaturesModel * \ingroup GUI * \brief Abstaract class of model object which operates with features data. */ -class XGUI_FeaturesModel : public QAbstractItemModel +class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel { public: - XGUI_FeaturesModel(const std::shared_ptr& theDocument, QObject* theParent): + XGUI_FeaturesModel(const boost::shared_ptr& theDocument, QObject* theParent): QAbstractItemModel(theParent), myDocument(theDocument) {} //! Returns Feature object by the given Model index. //! Returns 0 if the given index is not index of a feature virtual FeaturePtr feature(const QModelIndex& theIndex) const = 0; + //! Returns parent index of the given feature + virtual QModelIndex findParent(const boost::shared_ptr& theFeature) const = 0; + + //! Returns index corresponded to the group + virtual QModelIndex findGroup(const std::string& theGroup) const = 0; + protected: - std::shared_ptr myDocument; + boost::shared_ptr myDocument; }; @@ -34,10 +40,13 @@ protected: class XGUI_PartModel : public XGUI_FeaturesModel { public: - XGUI_PartModel(const std::shared_ptr& theDocument, QObject* theParent): + XGUI_PartModel(const boost::shared_ptr& theDocument, QObject* theParent): XGUI_FeaturesModel(theDocument, theParent) {} - void setPartId(int theId) { myId = theId; } + void setPartId(int theId) { myId = theId; } + + //! Returns true if the given document is a sub-document of this tree + virtual bool hasDocument(const boost::shared_ptr& theDoc) const = 0; protected: //! Id of the current part object in the document