1 // Copyright (C) 2009-2013 CEA/DEN, EDF 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/ or email : webmaster.salome@opencascade.com
20 #ifndef _HEXABLOCKGUI_DOCUMENTSELECTIONMODEL_HXX_
21 #define _HEXABLOCKGUI_DOCUMENTSELECTIONMODEL_HXX_
23 #include "HEXABLOCKGUI_Export.hxx"
25 #include <QItemSelectionModel>
26 //#include <LightApp_SelectionMgr.h>
28 //#include <SVTK_ViewWindow.h>
29 #include <SVTK_Selector.h>
31 //#include "klinkitemselectionmodel.hxx"
33 #include "HEXABLOCKGUI_DocumentModel.hxx"
35 class OCCViewer_ViewWindow;
43 class HEXABLOCK_EXPORT SelectionModel: public QItemSelectionModel
49 SelectionModel( QAbstractItemModel * model );
50 virtual ~SelectionModel();
52 QModelIndex indexBy( int role, const QString& value );
53 QModelIndex indexBy( int role, const QVariant& var );
54 QModelIndex indexOf( const QString& anIOEntry, int role );
55 QModelIndexList indexListOf( const QString& anEntry, int role );
56 DocumentModel* getDocModel() const;
57 void showEltInfo(QModelIndex& elt);
59 virtual void geomSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ) {}
60 virtual void vtkSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ) {}
62 void clearHighlightedItems() { currentHighlightedItems.clear(); }
64 void setInfoMode(bool isOn) { infoMode = isOn; }
68 virtual void onCurrentChanged( const QModelIndex & current,
69 const QModelIndex & previous ) {}
71 virtual void onSelectionChanged( const QItemSelection & selected,
72 const QItemSelection & deselected ) {}
74 void salomeSelectionChanged(); // Salome to Qt
77 QModelIndexList getSelectionFromModel(const Handle(SALOME_InteractiveObject)& anIObject);
78 QModelIndexList currentHighlightedItems;
82 // class PatternBuilderSelectionModel: public KLinkItemSelectionModel
85 // PatternBuilderSelectionModel( QAbstractItemModel *model,
86 // QItemSelectionModel *proxySelector, QObject *parent = 0 ):
87 // KLinkItemSelectionModel( model, proxySelector, parent )
92 class HEXABLOCK_EXPORT PatternDataSelectionModel : public SelectionModel
97 PatternDataSelectionModel( QAbstractItemModel * model );
98 virtual ~PatternDataSelectionModel();
100 void highlightTreeItems(QModelIndexList& indexes,
101 Qt::GlobalColor bgColor = Qt::darkGreen,
102 Qt::GlobalColor fgColor = Qt::white, bool only=true);
103 void unhighlightTreeItems(bool clearSelected=true);
104 QModelIndexList getGeomAssociations(const QModelIndex& dataIndex);
107 virtual void geomSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject );
108 virtual void vtkSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject );
111 virtual void onCurrentChanged( const QModelIndex & current, const QModelIndex & previous );
112 virtual void onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected );
116 class HEXABLOCK_EXPORT PatternGeomSelectionModel : public SelectionModel
121 PatternGeomSelectionModel( QAbstractItemModel * model );
122 virtual ~PatternGeomSelectionModel();
124 QModelIndex getModelIndex(const Handle(SALOME_InteractiveObject)& anIObject);
125 void highlightTreeItems(QModelIndexList& indexes,
126 Qt::GlobalColor bgColor = Qt::darkGreen,
127 Qt::GlobalColor fgColor = Qt::white, bool only=true);
128 void unhighlightTreeItems(bool clearSelected=true);
131 virtual void onCurrentChanged( const QModelIndex & current, const QModelIndex & previous );
132 virtual void onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected );
137 class HEXABLOCK_EXPORT GroupsSelectionModel : public SelectionModel
142 GroupsSelectionModel( QAbstractItemModel * model );
143 virtual ~GroupsSelectionModel();
146 virtual void onSelectionChanged( const QItemSelection & selected,
147 const QItemSelection & deselected );
152 class HEXABLOCK_EXPORT MeshSelectionModel : public SelectionModel
157 MeshSelectionModel( QAbstractItemModel * model );
158 virtual ~MeshSelectionModel();
161 virtual void onSelectionChanged( const QItemSelection & selected,
162 const QItemSelection & deselected );