X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_DataTreeModel.h;h=72a3d93f5f4019787a1d1753a1acccb09d4d85f9;hb=511f8c9b21cf60aa5b9a5e837415e6cfb3d8aeac;hp=676c9d8fdf98e249441ae195287e952f57e4d033;hpb=c80e8ac643930b858f4f653e2659896ba587b165;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_DataTreeModel.h b/src/XGUI/XGUI_DataTreeModel.h index 676c9d8fd..72a3d93f5 100644 --- a/src/XGUI/XGUI_DataTreeModel.h +++ b/src/XGUI/XGUI_DataTreeModel.h @@ -1,12 +1,16 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> #ifndef XGUI_DataTreeModel_H #define XGUI_DataTreeModel_H #include "XGUI.h" -#include "XGUI_Constants.h" #include +#include +#include + #include +#include /**\class XGUI_FeaturesModel * \ingroup GUI @@ -14,24 +18,40 @@ */ class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel { -public: - XGUI_FeaturesModel(const boost::shared_ptr& theDocument, QObject* theParent): - QAbstractItemModel(theParent), myDocument(theDocument) {} + public: + XGUI_FeaturesModel(QObject* theParent) + : QAbstractItemModel(theParent), + myItemsColor(Qt::black) + { + } //! 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; + virtual ObjectPtr object(const QModelIndex& theIndex) const = 0; + + //! Returns QModelIndex which corresponds to the given feature + //! If the feature is not found then index is not valid + virtual QModelIndex objectIndex(const ObjectPtr& theFeature) const = 0; //! Returns parent index of the given feature - virtual QModelIndex findParent(const boost::shared_ptr& theFeature) const = 0; + virtual QModelIndex findParent(const ObjectPtr& theObject) const = 0; //! Returns index corresponded to the group virtual QModelIndex findGroup(const std::string& theGroup) const = 0; -protected: - boost::shared_ptr myDocument; -}; + void setItemsColor(const QColor& theColor) + { + myItemsColor = theColor; + } + QColor itemsColor() const + { + return myItemsColor; + } + + protected: + QColor myItemsColor; +}; /**\class XGUI_PartModel * \ingroup GUI @@ -39,19 +59,26 @@ protected: */ class XGUI_PartModel : public XGUI_FeaturesModel { -public: - XGUI_PartModel(const boost::shared_ptr& theDocument, QObject* theParent): - XGUI_FeaturesModel(theDocument, theParent) {} + public: + XGUI_PartModel(QObject* theParent) + : XGUI_FeaturesModel(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; + virtual bool hasDocument(const DocumentPtr& theDoc) const = 0; + + //! Return a Part object + virtual ResultPartPtr part() const = 0; -protected: + protected: //! Id of the current part object in the document int myId; }; - -#endif \ No newline at end of file +#endif