X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_DataTreeModel.h;h=0b8844e2f494414f3874424e701b3c5ccadd1fe7;hb=4224f4dbe7ceaefe74b5d6b79a5840a9f5df2d7a;hp=3be26bd2a53c0f1200c99c7e84cd8c5efaff32c1;hpb=7ff9c971a42247ba4efd767781d0367dfb8a40e0;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_DataTreeModel.h b/src/XGUI/XGUI_DataTreeModel.h index 3be26bd2a..0b8844e2f 100644 --- a/src/XGUI/XGUI_DataTreeModel.h +++ b/src/XGUI/XGUI_DataTreeModel.h @@ -1,29 +1,47 @@ - #ifndef XGUI_DataTreeModel_H #define XGUI_DataTreeModel_H +#include "XGUI.h" +#include "XGUI_Constants.h" + #include -#include +#include +#include -#include "XGUI_Constants.h" +#include +#include /**\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): - QAbstractItemModel(theParent), myDocument(theDocument) {} + 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 ObjectPtr& theObject) const = 0; + + //! Returns index corresponded to the group + virtual QModelIndex findGroup(const std::string& theGroup) const = 0; + + void setItemsColor(const QColor& theColor) { myItemsColor = theColor; } + + QColor itemsColor() const { return myItemsColor; } protected: - std::shared_ptr myDocument; + QColor myItemsColor; }; @@ -34,10 +52,16 @@ protected: class XGUI_PartModel : public XGUI_FeaturesModel { public: - XGUI_PartModel(const std::shared_ptr& theDocument, QObject* theParent): - XGUI_FeaturesModel(theDocument, theParent) {} + XGUI_PartModel(QObject* theParent): + XGUI_FeaturesModel(theParent) {} + + void setPartId(int theId) { myId = theId; } + + //! Returns true if the given document is a sub-document of this tree + virtual bool hasDocument(const DocumentPtr& theDoc) const = 0; - void setPartId(int theId) { myId = theId; } + //! Return a Part object + virtual ResultPartPtr part() const = 0; protected: //! Id of the current part object in the document