Salome HOME
Stream object creation improved to do not use the transaction during it modification.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ZLevelsModel.h
index 62c5f1b99a4487a94e4678f195ea34bd877510be..e1585abdd28c3989a90f4b21b8c6ac28b59bef62 100644 (file)
@@ -23,6 +23,8 @@
 #ifndef HYDROGUI_ZLEVELSMODEL_H
 #define HYDROGUI_ZLEVELSMODEL_H
 
+#include <HYDROGUI.h>
+#include <HYDROData_Entity.h>
 #include <QAbstractListModel>
 #include <QPixmap>
 
@@ -32,13 +34,17 @@ const int HYDROGUI_VisibleRole = Qt::UserRole + 1;
  * \class HYDROGUI_ZLevelsModel
  * \brief The class representing custom list model for the Z levels
  */
-class HYDROGUI_ZLevelsModel : public QAbstractListModel
+class HYDRO_EXPORT HYDROGUI_ZLevelsModel : public QAbstractListModel
 {
   Q_OBJECT
 
 public:
   enum OpType { Top, Up, Down, Bottom, DragAndDrop };
 
+  typedef QPair<Handle(HYDROData_Entity), bool> Object2Visible;
+  typedef QList<Object2Visible> Object2VisibleList;
+  typedef QList<Handle(HYDROData_Entity)> ObjectList;
+
 public:
   HYDROGUI_ZLevelsModel( QObject* theParent = 0 );
   virtual ~HYDROGUI_ZLevelsModel();
@@ -59,7 +65,8 @@ public:
 
   QList<int> getIds( const QModelIndexList& theIndexes, bool theIsToSort = true ) const;
 
-  void setObjects( const QList<QPair<QString, bool>>& theObjects );
+  void setObjects( const Object2VisibleList& theObjects );
+  ObjectList getObjects() const;
 
   bool move( const int theItem, const OpType theType, bool theIsVisibleOnly,
              const int theDropItem = -1 );
@@ -67,10 +74,13 @@ public:
              const int theDropItem = -1 );
 
 protected:
-  bool IsObjectVisible( int theIndex ) const;
+  bool isObjectVisible( int theIndex ) const;
+  bool isDragAndDropAllowed( const QList<int>& theItems, const int theDropItem ) const;
 
 private:
-  QList<QPair<QString, bool>> myObjects;
+  friend class test_HYDROGUI_ZLevelsModel;
+
+  Object2VisibleList myObjects;
   QPixmap myEmpty, myEye;
 };