Salome HOME
SMH: Add again in binary mode
[modules/gui.git] / src / OCCViewer / OCCViewer_AISSelector.h
1 #if !defined( OCCVIEWER_AISSELECTOR_H )
2 #define OCCVIEWER_AISSELECTOR_H
3
4 #include "OCCViewer.h"
5 #include <qobject.h>
6
7 #include <Quantity_NameOfColor.hxx>
8 #include <AIS_InteractiveContext.hxx>
9
10 class OCCVIEWER_EXPORT OCCViewer_AISSelector : public QObject
11 {
12   Q_OBJECT
13     
14 public:
15   // constructor
16   OCCViewer_AISSelector( QObject* parent, const Handle (AIS_InteractiveContext)& );
17   // destructor
18   ~OCCViewer_AISSelector();
19   
20   // enables/disables selection
21   void enableSelection( bool );
22   // enables/disables multiple selection
23   void enableMultipleSelection( bool );
24   
25   // detects the interactive objects at position (x,y).
26   bool moveTo ( int, int, const Handle (V3d_View)& );
27   // selects the objects covered by the rectangle.
28   bool select ( int, int, int, int, const Handle (V3d_View)& );
29   // adds new selected objects covered by the rectangle to the objects
30   // previously selected.
31   bool shiftSelect ( int, int, int, int, const Handle (V3d_View)& );
32   // selects the detected interactive objects.
33   bool select ();
34   // adds new selected objects to the objects previously selected.
35   bool shiftSelect ();
36   
37   // sets the interactive context for this selector
38   void setAISContext ( const Handle (AIS_InteractiveContext)& );
39   // sets the color to hilight the detected objects
40   void setHilightColor ( Quantity_NameOfColor color );
41   // sets the color to display the selected objects
42   void setSelectColor ( Quantity_NameOfColor color );
43   
44 protected:
45   // checks the status of pick and emits 'selSelectionDone' or 'selSelectionCancel'.
46   bool checkSelection ( AIS_StatusOfPick status, bool hadSelection, bool addTo );
47   
48 signals:
49   // 'selection done' signal
50   void selSelectionDone( bool bAdded );
51   // 'selection cancelled' signal
52   void selSelectionCancel( bool bAdded );
53   
54 protected:
55   Handle (AIS_InteractiveContext) myAISContext;    // graphic context
56   Quantity_NameOfColor            myHilightColor;  // color for hilight object
57   Quantity_NameOfColor            mySelectColor;   // color for selected object
58   
59   int  myNumSelected;                              // nymber of selected objects
60   bool myEnableSelection;                          // enable selection flag
61   bool myEnableMultipleSelection;                  // enable multiple selection flag
62 };
63
64 #endif // OCCVIEWER_AISSELECTOR_H