1 // Copyright (C) 2009-2012 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 <QItemSelectionModel>
24 #include <LightApp_SelectionMgr.h>
26 #include <SVTK_ViewWindow.h>
27 #include <SVTK_Selector.h>
29 // #include <SOCC_ViewModel.h>
30 // #include <SOCC_ViewWindow.h>
31 // #include <OCCViewer_ViewWindow.h>
33 #include "MyGEOMBase_Helper.hxx"
35 #include "klinkitemselectionmodel.hxx"
37 class OCCViewer_ViewWindow;
45 class SelectionModel: public QItemSelectionModel
51 SelectionModel( QAbstractItemModel * model );
52 virtual ~SelectionModel();
54 QModelIndex indexBy( int role, const QString& value );
55 QModelIndex indexBy( int role, const QVariant& var );
56 QModelIndex indexOf( const QString& anIOEntry, int role );
57 QModelIndexList indexListOf( const QString& anEntry, int role );
58 void setIgnoreSignal(bool state) { ignoreSignal = state; }
60 virtual void geomSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ) {}
61 virtual void vtkSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ) {}
63 bool salomeNothingSelected;
67 virtual void onCurrentChanged( const QModelIndex & current,
68 const QModelIndex & previous ) {}
70 virtual void onSelectionChanged( const QItemSelection & selected,
71 const QItemSelection & deselected ) {}
73 void salomeSelectionChanged(); // Salome to Qt
76 QModelIndexList getSelectionFromModel(const Handle(SALOME_InteractiveObject)& anIObject);
77 QModelIndexList getSelectionAssociactions(const Handle(SALOME_InteractiveObject)& anIObject);
80 // bool _theModelSelectionChanged;
81 // bool _theVtkSelectionChanged;
82 // bool _theGeomSelectionChanged;
85 class PatternBuilderSelectionModel: public KLinkItemSelectionModel
88 PatternBuilderSelectionModel( QAbstractItemModel *model,
89 QItemSelectionModel *proxySelector, QObject *parent = 0 ):
90 KLinkItemSelectionModel( model, proxySelector, parent )
95 class PatternDataSelectionModel : public SelectionModel
100 PatternDataSelectionModel( QAbstractItemModel * model );
101 virtual ~PatternDataSelectionModel();
103 void highlightEltsWithAssocs(const QModelIndexList& elts);
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 PatternGeomSelectionModel : public SelectionModel
121 PatternGeomSelectionModel( QAbstractItemModel * model );
122 virtual ~PatternGeomSelectionModel();
124 QModelIndex getModelIndex(const Handle(SALOME_InteractiveObject)& anIObject);
126 // void highlightEltsWithAssocs(const QModelIndexList& elts);
129 // virtual void geomSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject );
130 // virtual void vtkSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject );
133 virtual void onCurrentChanged( const QModelIndex & current, const QModelIndex & previous );
134 virtual void onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected );
139 class GroupsSelectionModel : public SelectionModel
144 GroupsSelectionModel( QAbstractItemModel * model );
145 virtual ~GroupsSelectionModel();
148 // virtual void onCurrentChanged( const QModelIndex & current, const QModelIndex & previous );
149 virtual void onSelectionChanged( const QItemSelection & selected,
150 const QItemSelection & deselected );
155 class MeshSelectionModel : public SelectionModel
160 MeshSelectionModel( QAbstractItemModel * model );
161 virtual ~MeshSelectionModel();
164 // virtual void onCurrentChanged( const QModelIndex & current, const QModelIndex & previous );
165 virtual void onSelectionChanged( const QItemSelection & selected,
166 const QItemSelection & deselected );