]> SALOME platform Git repositories - modules/gui.git/blob - src/SUIT/SUIT_SelectionMgr.h
Salome HOME
d471b2f730fcd05446f2c91da2708174a392c5e6
[modules/gui.git] / src / SUIT / SUIT_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 SUIT_SELECTIONMGR_H
20 #define SUIT_SELECTIONMGR_H
21
22 #include "SUIT_Selector.h"
23 #include "SUIT_DataOwner.h"
24 #include "SUIT_SelectionFilter.h"
25
26 #include <qobject.h>
27 #include <qptrlist.h>
28 #include <qvaluelist.h>
29
30 #ifdef WIN32
31 #pragma warning ( disable : 4251 )
32 #endif
33
34 class SUIT_EXPORT SUIT_SelectionMgr : public QObject
35 {
36   Q_OBJECT
37
38 public:
39   SUIT_SelectionMgr( const bool = true, QObject* = 0 );
40   virtual ~SUIT_SelectionMgr();
41
42   void            clearSelected();
43   virtual void    selected( SUIT_DataOwnerPtrList&, const QString& = QString::null ) const;
44   virtual void    setSelected( const SUIT_DataOwnerPtrList&, const bool = false );
45
46   void            selectors( QPtrList<SUIT_Selector>& ) const;
47   void            selectors( const QString&, QPtrList<SUIT_Selector>& ) const;
48
49
50   void            setEnabled( const bool, const QString& = QString::null );
51
52
53   bool            hasSelectionMode( const int ) const;
54   void            selectionModes( QValueList<int>& ) const;
55
56   void            setSelectionModes( const int );
57   virtual void    setSelectionModes( const QValueList<int>& );
58
59   void            appendSelectionModes( const int );
60   virtual void    appendSelectionModes( const QValueList<int>& );
61
62   void            removeSelectionModes( const int );
63   virtual void    removeSelectionModes( const QValueList<int>& );
64
65
66   bool            isOk( const SUIT_DataOwner* ) const;
67   bool            isOk( const SUIT_DataOwnerPtr& ) const;
68
69   bool            hasFilter( SUIT_SelectionFilter* ) const;
70
71   virtual void    installFilter( SUIT_SelectionFilter*, const bool = true );
72   virtual void    removeFilter( SUIT_SelectionFilter* );
73   virtual void    clearFilters();
74
75   bool            autoDeleteFilter() const;
76   void            setAutoDeleteFilter( const bool );
77
78   bool            isSynchronizing() const;
79
80 signals:
81   void            selectionChanged();
82
83 protected:
84   virtual void    selectionChanged( SUIT_Selector* );
85
86   typedef QPtrListIterator<SUIT_Selector>        SelectorListIterator;
87
88   virtual void    installSelector( SUIT_Selector* );
89   virtual void    removeSelector( SUIT_Selector* );
90
91 private:
92   void            filterOwners( const SUIT_DataOwnerPtrList&, SUIT_DataOwnerPtrList& ) const;
93
94   typedef QPtrList<SUIT_Selector>                SelectorList;
95   typedef QPtrList<SUIT_SelectionFilter>         SelFilterList;
96   typedef QPtrListIterator<SUIT_SelectionFilter> SelFilterListIterator;
97
98 protected:
99   SelectorList    mySelectors;
100
101 private:
102   SelFilterList   myFilters;
103   QValueList<int> mySelModes;
104   int             myIterations;
105   bool            myIsSelChangeEnabled;
106
107   friend class SUIT_Selector;
108 };
109
110 #ifdef WIN32
111 #pragma warning ( default : 4251 )
112 #endif
113
114 #endif