Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/gui.git] / src / OCCViewer / OCCViewer_AISSelector.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/ or email : webmaster.salome@opencascade.com
18 //
19 #if !defined( OCCVIEWER_AISSELECTOR_H )
20 #define OCCVIEWER_AISSELECTOR_H
21
22 #include "OCCViewer.h"
23 #include <qobject.h>
24
25 #include <Quantity_NameOfColor.hxx>
26 #include <AIS_InteractiveContext.hxx>
27
28 class OCCVIEWER_EXPORT OCCViewer_AISSelector : public QObject
29 {
30   Q_OBJECT
31     
32 public:
33   // constructor
34   OCCViewer_AISSelector( QObject* parent, const Handle (AIS_InteractiveContext)& );
35   // destructor
36   ~OCCViewer_AISSelector();
37   
38   // enables/disables selection
39   void enableSelection( bool );
40   // enables/disables multiple selection
41   void enableMultipleSelection( bool );
42   
43   // detects the interactive objects at position (x,y).
44   bool moveTo ( int, int, const Handle (V3d_View)& );
45   // selects the objects covered by the rectangle.
46   bool select ( int, int, int, int, const Handle (V3d_View)& );
47   // adds new selected objects covered by the rectangle to the objects
48   // previously selected.
49   bool shiftSelect ( int, int, int, int, const Handle (V3d_View)& );
50   // selects the detected interactive objects.
51   bool select ();
52   // adds new selected objects to the objects previously selected.
53   bool shiftSelect ();
54   
55   // sets the interactive context for this selector
56   void setAISContext ( const Handle (AIS_InteractiveContext)& );
57   // sets the color to hilight the detected objects
58   void setHilightColor ( Quantity_NameOfColor color );
59   // sets the color to display the selected objects
60   void setSelectColor ( Quantity_NameOfColor color );
61   
62 protected:
63   // checks the status of pick and emits 'selSelectionDone' or 'selSelectionCancel'.
64   bool checkSelection ( AIS_StatusOfPick status, bool hadSelection, bool addTo );
65   
66 signals:
67   // 'selection done' signal
68   void selSelectionDone( bool bAdded );
69   // 'selection cancelled' signal
70   void selSelectionCancel( bool bAdded );
71   
72 protected:
73   Handle (AIS_InteractiveContext) myAISContext;    // graphic context
74   Quantity_NameOfColor            myHilightColor;  // color for hilight object
75   Quantity_NameOfColor            mySelectColor;   // color for selected object
76   
77   int  myNumSelected;                              // nymber of selected objects
78   bool myEnableSelection;                          // enable selection flag
79   bool myEnableMultipleSelection;                  // enable multiple selection flag
80 };
81
82 #endif // OCCVIEWER_AISSELECTOR_H