Salome HOME
NRI : Add message (GUI lib not found).
[modules/kernel.git] / src / SALOMEGUI / SALOME_Selection.h
1 //  File      : SALOME_Selection.h
2 //  Created   : Wed Feb 20 17:24:59 2002
3 //  Author    : Nicolas REJNERI
4 //  Project   : SALOME
5 //  Module    : SALOMEGUI
6 //  Copyright : Open CASCADE 2002
7 //  $Header$
8
9 #ifndef SALOME_SELECTION_H
10 #define SALOME_SELECTION_H
11
12 #include "SALOME_Filter.hxx"
13 #include "SALOME_ListIO.hxx"
14 #include "SALOME_ListOfFilter.hxx"
15 #include "SALOME_InteractiveObject.hxx"
16 #include "SALOME_DataMapOfIOMapOfInteger.hxx"
17
18 // Qt Includes
19 #include <qlist.h>
20 #include <qstring.h>
21 #include <qobject.h>
22
23 // Open CASCADE Include
24 #include <TColStd_MapOfInteger.hxx>
25
26 class SALOME_Selection : public QObject
27 {
28   Q_OBJECT
29     
30 public:
31         SALOME_Selection(const QString& aName);
32         ~SALOME_Selection();
33
34         static bool                CreateSelection(const QString& aName) ;
35         static SALOME_Selection*   Selection      (const QString& aName) ;
36         static bool                RemoveSelection(const QString& aName) ;
37         static bool                FindSelection  (const QString& aName) ;
38
39         void Clear () ;
40
41         void ClearIObjects () ;
42         int  AddIObject    ( const Handle(SALOME_InteractiveObject)& anObject, bool update = true) ;
43         int  RemoveIObject ( const Handle(SALOME_InteractiveObject)& anObject, bool update = true) ;
44
45         const SALOME_ListIO&             StoredIObjects() ;
46         int                              IObjectCount() ;
47
48         Handle(SALOME_InteractiveObject) firstIObject() ;
49         Handle(SALOME_InteractiveObject) lastIObject() ;
50
51         void                       AddFilter(const Handle(SALOME_Filter)& aFilter,
52                                              bool updateSelection = true ) ;
53         bool                       RemoveFilter(const Handle(SALOME_Filter)& aFilter) ;
54         void                       ClearFilters();
55         const SALOME_ListOfFilter& StoredFilters();
56         bool                       FindFilter(const Handle(SALOME_Filter)& aFilter);
57
58         bool                       IsOk( const Handle(SALOME_InteractiveObject)& IObject ) ;
59
60
61         void                       SetSelectionMode(int mode, bool activeCompOnly = false);
62         int                        SelectionMode();
63         bool                       IsSelectActiveCompOnly() const;
64         
65         bool                        HasIndex( const Handle(SALOME_InteractiveObject)& IObject );
66         void                       GetIndex( const Handle(SALOME_InteractiveObject)& IObject, 
67                                              TColStd_MapOfInteger& theIndex );
68         
69         bool                        AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, int index, bool modeShift, bool update=true );
70         void                        RemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, int index );
71         bool                        IsIndexSelected(const Handle(SALOME_InteractiveObject)& IObject, int index);
72
73 signals:
74         void                        currentSelectionChanged();
75
76 private:
77         QString               myName;
78         SALOME_ListOfFilter   myFilters;
79         SALOME_ListIO         myIObjects;
80
81         SALOME_DataMapOfIOMapOfInteger myMapIOSubIndex;
82
83         int                   mySelectionMode;
84         bool                  mySelActiveCompOnly;
85 };
86
87 #endif
88