1 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SALOME_Selection.h
25 // Author : Nicolas REJNERI
29 #ifndef SALOME_SELECTION_H
30 #define SALOME_SELECTION_H
32 #include "SALOME_Filter.hxx"
33 #include "SALOME_ListIO.hxx"
34 #include "SALOME_ListOfFilter.hxx"
35 #include "SALOME_InteractiveObject.hxx"
36 #include "SALOME_DataMapOfIOMapOfInteger.hxx"
43 // Open CASCADE Include
44 #include <TColStd_MapOfInteger.hxx>
57 class SALOME_Selection : public QObject
63 SALOME_Selection(const QString& aName);
66 static bool CreateSelection(const QString& aName) ;
67 static SALOME_Selection* Selection (const QString& aName) ;
68 static bool RemoveSelection(const QString& aName) ;
69 static bool FindSelection (const QString& aName) ;
73 void ClearIObjects () ;
74 int AddIObject ( const Handle(SALOME_InteractiveObject)& anObject, bool update = true) ;
75 int RemoveIObject ( const Handle(SALOME_InteractiveObject)& anObject, bool update = true) ;
77 const SALOME_ListIO& StoredIObjects() ;
80 Handle(SALOME_InteractiveObject) firstIObject() ;
81 Handle(SALOME_InteractiveObject) lastIObject() ;
83 void AddFilter(const Handle(SALOME_Filter)& aFilter,
84 bool updateSelection = true ) ;
85 bool RemoveFilter(const Handle(SALOME_Filter)& aFilter) ;
87 const SALOME_ListOfFilter& StoredFilters();
88 bool FindFilter(const Handle(SALOME_Filter)& aFilter);
90 bool IsOk( const Handle(SALOME_InteractiveObject)& IObject ) ;
93 void SetSelectionMode(Selection_Mode mode, bool activeCompOnly = false);
94 Selection_Mode SelectionMode();
95 bool IsSelectActiveCompOnly() const;
97 bool HasIndex( const Handle(SALOME_InteractiveObject)& IObject );
98 void GetIndex( const Handle(SALOME_InteractiveObject)& IObject,
99 TColStd_IndexedMapOfInteger& theIndex );
101 typedef std::set<int> TContainerOfId;
103 bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, int index, bool modeShift, bool update=true );
104 bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, const TColStd_MapOfInteger& theIndices, bool modeShift, bool update=true );
105 bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, const TContainerOfId& theIndices, bool modeShift, bool update=true );
106 void RemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, int index );
107 bool IsIndexSelected(const Handle(SALOME_InteractiveObject)& IObject, int index);
110 void BlockSignals( const bool );
111 void SelectionChanged();
114 void currentSelectionChanged();
118 SALOME_ListOfFilter myFilters;
119 SALOME_ListIO myIObjects;
121 SALOME_DataMapOfIOMapOfInteger myMapIOSubIndex;
123 Selection_Mode mySelectionMode;
124 bool mySelActiveCompOnly;