Back to index

salome-gui  6.5.0
SUIT_SelectionMgr.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef SUIT_SELECTIONMGR_H
00024 #define SUIT_SELECTIONMGR_H
00025 
00026 #include "SUIT_DataOwner.h"
00027 
00028 #include <QList>
00029 #include <QObject>
00030 
00031 class SUIT_Selector;
00032 class SUIT_SelectionFilter;
00033 
00034 #ifdef WIN32
00035 #pragma warning ( disable : 4251 )
00036 #endif
00037 
00038 class SUIT_EXPORT SUIT_SelectionMgr : public QObject
00039 {
00040   Q_OBJECT
00041 
00042 public:
00043   SUIT_SelectionMgr( const bool = true, QObject* = 0 );
00044   virtual ~SUIT_SelectionMgr();
00045 
00046   void            clearSelected();
00047   virtual void    selected( SUIT_DataOwnerPtrList&, const QString& = QString() ) const;
00048   virtual void    setSelected( const SUIT_DataOwnerPtrList&, const bool = false );
00049 
00050   void            selectors( QList<SUIT_Selector*>& ) const;
00051   void            selectors( const QString&, QList<SUIT_Selector*>& ) const;
00052 
00053 
00054   void            setEnabled( const bool, const QString& = QString() );
00055 
00056 
00057   bool            hasSelectionMode( const int ) const;
00058   void            selectionModes( QList<int>& ) const;
00059 
00060   void            setSelectionModes( const int );
00061   virtual void    setSelectionModes( const QList<int>& );
00062 
00063   void            appendSelectionModes( const int );
00064   virtual void    appendSelectionModes( const QList<int>& );
00065 
00066   void            removeSelectionModes( const int );
00067   virtual void    removeSelectionModes( const QList<int>& );
00068 
00069 
00070   bool            isOk( const SUIT_DataOwner* ) const;
00071   bool            isOk( const SUIT_DataOwnerPtr& ) const;
00072 
00073   bool            hasFilter( SUIT_SelectionFilter* ) const;
00074 
00075   virtual void    installFilter( SUIT_SelectionFilter*, const bool = true );
00076   virtual void    removeFilter( SUIT_SelectionFilter* );
00077   virtual void    clearFilters();
00078 
00079   bool            autoDeleteFilter() const;
00080   void            setAutoDeleteFilter( const bool );
00081 
00082   bool            isSynchronizing() const;
00083 
00084 signals:
00085   void            selectionChanged();
00086 
00087 protected:
00088   virtual void    selectionChanged( SUIT_Selector* );
00089 
00090   virtual void    installSelector( SUIT_Selector* );
00091   virtual void    removeSelector( SUIT_Selector* );
00092 
00093 private:
00094   void            filterOwners( const SUIT_DataOwnerPtrList&, SUIT_DataOwnerPtrList& ) const;
00095 
00096   typedef QList<SUIT_Selector*>        SelectorList;
00097   typedef QList<SUIT_SelectionFilter*> SelFilterList;
00098 
00099 private:
00100   SelFilterList   myFilters;
00101   QList<int>      mySelModes;
00102   SelectorList    mySelectors;
00103   int             myIterations;
00104   bool            myAutoDelFilter;
00105   bool            myIsSelChangeEnabled;
00106 
00107   friend class SUIT_Selector;
00108 };
00109 
00110 #ifdef WIN32
00111 #pragma warning ( default : 4251 )
00112 #endif
00113 
00114 #endif