Salome HOME
8546dadfe738a66882384653709c74f447251328
[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
26 #ifndef DISABLE_SALOMEOBJECT
27   #include <SALOME_InteractiveObject.hxx>
28   #include <qmap.h>
29
30   class SALOME_ListIO;
31   class TColStd_IndexedMapOfInteger;
32   class TColStd_MapOfInteger;
33 #else
34 #include <qstringlist.h>
35 #endif
36
37 class LightApp_Application;
38
39 class LIGHTAPP_EXPORT LightApp_SelectionMgr : public SUIT_SelectionMgr
40 {
41   Q_OBJECT
42
43 public:
44   LightApp_SelectionMgr( LightApp_Application*, const bool = true );
45   virtual ~LightApp_SelectionMgr();
46
47   LightApp_Application* application() const;
48
49 #ifndef DISABLE_SALOMEOBJECT
50   typedef QMap< Handle(SALOME_InteractiveObject), TColStd_IndexedMapOfInteger > MapIOOfMapOfInteger;
51   typedef QMap< QString, TColStd_IndexedMapOfInteger > MapEntryOfMapOfInteger;
52
53   void                   selectedObjects( SALOME_ListIO&, const QString& = QString::null, const bool = true ) const;
54   void                   setSelectedObjects( const SALOME_ListIO&, const bool = false );
55
56   void                   GetIndexes( const Handle(SALOME_InteractiveObject)& IObject, 
57                                      TColStd_IndexedMapOfInteger& theIndex );
58   void                   GetIndexes( const QString& theEntry, 
59                                      TColStd_IndexedMapOfInteger& theIndex );
60
61   bool                   AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, 
62                                            const TColStd_MapOfInteger& theIndices, 
63                                            bool modeShift );
64
65   void                   selectObjects( const Handle(SALOME_InteractiveObject)& IObject, 
66                                         TColStd_IndexedMapOfInteger theIndex, bool append );
67   void                   selectObjects( MapIOOfMapOfInteger theMapIO, bool append );
68
69   void                   selectedSubOwners( MapEntryOfMapOfInteger& theMap );
70 #else
71   void                   selectedObjects( QStringList&, const QString& = QString::null, const bool = true ) const;
72 #endif
73
74 signals:
75   void                   currentSelectionChanged();
76
77 private:
78   virtual void           selectionChanged( SUIT_Selector* );
79
80 private:
81   LightApp_Application* myApp;
82 };
83
84 #endif