Salome HOME
Copyrights update
[modules/gui.git] / src / LightApp / LightApp_SelectionMgr.h
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
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.
7 // 
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/
18 //
19 #ifndef LIGHTAPP_SELECTIONMGR_H
20 #define LIGHTAPP_SELECTIONMGR_H
21
22 #include "LightApp.h"
23
24 #include <SUIT_SelectionMgr.h>
25 #include <SALOME_InteractiveObject.hxx>
26
27 #include <qmap.h>
28
29 class SALOME_ListIO;
30 class LightApp_Application;
31 class TColStd_IndexedMapOfInteger;
32 class TColStd_MapOfInteger;
33
34 class LIGHTAPP_EXPORT LightApp_SelectionMgr : public SUIT_SelectionMgr
35 {
36   Q_OBJECT
37
38 public:
39   LightApp_SelectionMgr( LightApp_Application*, const bool = true );
40   virtual ~LightApp_SelectionMgr();
41
42   typedef QMap< Handle(SALOME_InteractiveObject), TColStd_IndexedMapOfInteger > MapIOOfMapOfInteger;
43   typedef QMap< QString, TColStd_IndexedMapOfInteger > MapEntryOfMapOfInteger;
44
45   LightApp_Application* application() const;
46
47   void                   selectedObjects( SALOME_ListIO&, const QString& = QString::null, const bool = true ) const;
48   void                   setSelectedObjects( const SALOME_ListIO&, const bool = false );
49
50   void                   GetIndexes( const Handle(SALOME_InteractiveObject)& IObject, 
51                                      TColStd_IndexedMapOfInteger& theIndex );
52   void                   GetIndexes( const QString& theEntry, 
53                                      TColStd_IndexedMapOfInteger& theIndex );
54
55   bool                   AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, 
56                                            const TColStd_MapOfInteger& theIndices, 
57                                            bool modeShift );
58
59   void                   selectObjects( const Handle(SALOME_InteractiveObject)& IObject, 
60                                         TColStd_IndexedMapOfInteger theIndex, bool append );
61   void                   selectObjects( MapIOOfMapOfInteger theMapIO, bool append );
62
63   void                   selectedSubOwners( MapEntryOfMapOfInteger& theMap );
64
65 signals:
66   void                   currentSelectionChanged();
67
68 private:
69   virtual void           selectionChanged( SUIT_Selector* );
70
71 private:
72   LightApp_Application* myApp;
73 };
74
75 #endif