]> SALOME platform Git repositories - modules/gui.git/blob - src/SUIT/SUIT_Selector.h
Salome HOME
5be859d77349a1fdefe753d4d75ad5d104124d41
[modules/gui.git] / src / SUIT / SUIT_Selector.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_SELECTOR_H
23 #define SUIT_SELECTOR_H
24
25 #include "SUIT.h"
26
27 #include <QList>
28
29 class QObject;
30
31 class SUIT_SelectionMgr;
32 class SUIT_DataOwnerPtrList;
33
34 /*!
35   \class SUIT_Selector
36   Base class for all selectors used in SUIT-based applications.
37   Provides functionality to get/set selection from/into some widget
38   (ObjectBrowser, viewers, etc)
39   Used by selection manager for selection synhronizing
40 */
41
42 class SUIT_EXPORT SUIT_Selector
43 {
44   class Destroyer;
45
46 public:
47   SUIT_Selector( SUIT_SelectionMgr*, QObject* = 0 );
48   virtual ~SUIT_Selector();
49
50   virtual QString    type() const = 0;
51
52   SUIT_SelectionMgr* selectionMgr() const;
53
54   bool               isEnabled() const;
55   virtual void       setEnabled( const bool );
56
57   bool               autoBlock() const;
58   virtual void       setAutoBlock( const bool );
59
60   void               selected( SUIT_DataOwnerPtrList& ) const;
61   void               setSelected( const SUIT_DataOwnerPtrList& );
62
63   bool               hasSelectionMode( const int ) const;
64   void               selectionModes( QList<int>& ) const;
65
66 protected:
67   void               selectionChanged();
68   virtual void       getSelection( SUIT_DataOwnerPtrList& ) const = 0;
69   virtual void       setSelection( const SUIT_DataOwnerPtrList& ) = 0;
70
71 private:
72   SUIT_SelectionMgr* mySelMgr;
73   bool               myBlock;
74   bool               myEnabled;
75   bool               myAutoBlock;
76   Destroyer*         myDestroyer;
77 };
78
79 #endif