]> SALOME platform Git repositories - modules/gui.git/blob - src/SUIT/SUIT_SelectionMgr.h
Salome HOME
19b6bb60bcc5696c6982ef3ff9b653b38fdcc13a
[modules/gui.git] / src / SUIT / SUIT_SelectionMgr.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 #ifndef SUIT_SELECTIONMGR_H
23 #define SUIT_SELECTIONMGR_H
24
25 #include "SUIT_DataOwner.h"
26
27 #include <QList>
28 #include <QObject>
29
30 class SUIT_Selector;
31 class SUIT_SelectionFilter;
32
33 #ifdef WIN32
34 #pragma warning ( disable : 4251 )
35 #endif
36
37 class SUIT_EXPORT SUIT_SelectionMgr : public QObject
38 {
39   Q_OBJECT
40
41 public:
42   SUIT_SelectionMgr( const bool = true, QObject* = 0 );
43   virtual ~SUIT_SelectionMgr();
44
45   void            clearSelected();
46   virtual void    selected( SUIT_DataOwnerPtrList&, const QString& = QString() ) const;
47   virtual void    setSelected( const SUIT_DataOwnerPtrList&, const bool = false );
48
49   void            selectors( QList<SUIT_Selector*>& ) const;
50   void            selectors( const QString&, QList<SUIT_Selector*>& ) const;
51
52
53   void            setEnabled( const bool, const QString& = QString() );
54
55
56   bool            hasSelectionMode( const int ) const;
57   void            selectionModes( QList<int>& ) const;
58
59   void            setSelectionModes( const int );
60   virtual void    setSelectionModes( const QList<int>& );
61
62   void            appendSelectionModes( const int );
63   virtual void    appendSelectionModes( const QList<int>& );
64
65   void            removeSelectionModes( const int );
66   virtual void    removeSelectionModes( const QList<int>& );
67
68
69   bool            isOk( const SUIT_DataOwner* ) const;
70   bool            isOk( const SUIT_DataOwnerPtr& ) const;
71
72   bool            hasFilter( SUIT_SelectionFilter* ) const;
73
74   virtual void    installFilter( SUIT_SelectionFilter*, const bool = true );
75   virtual void    removeFilter( SUIT_SelectionFilter* );
76   virtual void    clearFilters();
77
78   bool            autoDeleteFilter() const;
79   void            setAutoDeleteFilter( const bool );
80
81   bool            isSynchronizing() const;
82
83 signals:
84   void            selectionChanged();
85
86 protected:
87   virtual void    selectionChanged( SUIT_Selector* );
88
89   virtual void    installSelector( SUIT_Selector* );
90   virtual void    removeSelector( SUIT_Selector* );
91
92 private:
93   void            filterOwners( const SUIT_DataOwnerPtrList&, SUIT_DataOwnerPtrList& ) const;
94
95   typedef QList<SUIT_Selector*>        SelectorList;
96   typedef QList<SUIT_SelectionFilter*> SelFilterList;
97
98 private:
99   SelFilterList   myFilters;
100   QList<int>      mySelModes;
101   SelectorList    mySelectors;
102   int             myIterations;
103   bool            myAutoDelFilter;
104   bool            myIsSelChangeEnabled;
105
106   friend class SUIT_Selector;
107 };
108
109 #ifdef WIN32
110 #pragma warning ( default : 4251 )
111 #endif
112
113 #endif