Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/gui.git] / src / LightApp / LightApp_Selection.h
1 //  LightApp_Selection
2 //
3 //  Copyright (C) 2003  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 //
23 //
24 //  File   : LightApp_Selection.h
25 //  Author : Alexander SOLOVYOV
26 //  Module : GUI
27 //  $Header$
28
29 #ifndef LIGHTAPP_SELECTION_HeaderFile
30 #define LIGHTAPP_SELECTION_HeaderFile
31
32 #include "LightApp.h"
33 #include <QtxPopupMgr.h>
34
35 class LightApp_SelectionMgr;
36 class LightApp_DataOwner;
37 class LightApp_Study;
38 class SUIT_ViewWindow;
39
40 /*!
41   \class LightApp_Selection 
42   Custom selection class, allowing to build popup with rules on the base
43   of owners selected in all selectors (popup client has more priority).
44   It is able to return values of standard object properties
45   (isVisible,isComponent,canBeDisplayed,isReference, etc)
46 */
47 class LIGHTAPP_EXPORT LightApp_Selection : public QtxPopupMgr::Selection
48 {
49 public:
50   LightApp_Selection();
51   virtual ~LightApp_Selection();
52
53   virtual void                   init( const QString&, LightApp_SelectionMgr* );
54   virtual void                   processOwner( const LightApp_DataOwner* );
55
56   virtual int                    count() const;
57   virtual QtxValue               param( const int, const QString& ) const;
58   virtual QtxValue               globalParam( const QString& ) const;
59   void                           setModuleName( const QString );
60
61 protected:
62   QString                        entry( const int ) const;
63   bool                           isReference( const int ) const;
64   /*!Gets study.*/
65   LightApp_Study*                study() const { return myStudy; }
66   QString                        activeViewType() const;
67   SUIT_ViewWindow*               activeVW() const;
68   virtual QString                referencedToEntry( const QString& ) const;
69
70 private:
71   QString                        myPopupClient;
72   QMap<int,QString>              myEntries; // entries of selected objects
73   QMap<int,bool>                 myIsReferences; // whether i-th selected object was a reference
74   LightApp_Study*                myStudy;
75 };
76
77 #endif